Mercurial > repos > jay > gaiac_time_synchronization
changeset 2:c1c1e2405c4e draft
planemo upload for repository https://github.com/jaidevjoshi83/gaiac commit c31ef5726cd1d2659da9aeb956c22fb834b177ff
author | jay |
---|---|
date | Fri, 23 May 2025 17:57:51 +0000 |
parents | 11046e4b33a9 |
children | 32c40144e766 |
files | gaiac_pm_data_pulling/datapulling.py gaiac_pm_data_pulling/gaiac_data_download.py gaiac_pm_data_pulling/gaiac_pm_data_pulling.py gaiac_time_sync/gaiac_time_sync.xml |
diffstat | 4 files changed, 36 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- a/gaiac_pm_data_pulling/datapulling.py Thu May 15 22:51:32 2025 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -import requests -import sys - -def download_files_from_server(urls): - """ - Function to download files from a FastAPI server. - - Args: - ip (str): The IP address of the FastAPI server. - file_names (list): List of file names to download. - - Returns: - None - """ - for url in urls: - file_name = url.split('/')[len(url.split('/'))-1] - response = requests.get(url) - if response.status_code == 200: - with open(f"{file_name}", "wb") as f: - f.write(response.content) - print(f"File {file_name} downloaded successfully!") - else: - print(f"Failed to download {file_name}. Status code: {response.status_code}") - -if __name__=="__main__": - - if len(sys.argv) > 1: - files = sys.argv[1].split(',') - download_files_from_server( files) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gaiac_pm_data_pulling/gaiac_data_download.py Fri May 23 17:57:51 2025 +0000 @@ -0,0 +1,29 @@ +import requests +import sys + +def download_files_from_server(urls): + """ + Function to download files from a FastAPI server. + + Args: + ip (str): The IP address of the FastAPI server. + file_names (list): List of file names to download. + + Returns: + None + """ + for url in urls: + file_name = url.split('/')[len(url.split('/'))-1] + response = requests.get(url) + if response.status_code == 200: + with open(f"{file_name}", "wb") as f: + f.write(response.content) + print(f"File {file_name} downloaded successfully!") + else: + print(f"Failed to download {file_name}. Status code: {response.status_code}") + +if __name__=="__main__": + + if len(sys.argv) > 1: + files = sys.argv[1].split(',') + download_files_from_server( files) \ No newline at end of file
--- a/gaiac_pm_data_pulling/gaiac_pm_data_pulling.py Thu May 15 22:51:32 2025 +0000 +++ b/gaiac_pm_data_pulling/gaiac_pm_data_pulling.py Fri May 23 17:57:51 2025 +0000 @@ -15,7 +15,7 @@ def get_file_list(ip): - url = "%s/list-files"%(ip) + url = "%s/api/list-files"%(ip) with urllib.request.urlopen(url) as response: data = response.read() @@ -33,9 +33,7 @@ }} for i in get_file_list(ip): - # print("http://"+ip+'/download/'+i) - api_data[ip][i] = ip+'/download/'+i - + api_data[ip][i] = ip+'/api/download/'+i ul = [] for dataset, url in api_data[ip].items(): @@ -47,20 +45,6 @@ 'selected': False }) - # for urlname, genomes in api_data.items(): - # # URL-safe base64 encoding for the URL name - # urlname_64 = urlname - # ul = [] - # for genome, assets in genomes.items(): - # al = [] - - # ul.append({ - # 'name': genome, - # 'value': genome, - # 'options': [], - # 'selected': False - # }) - return ul except Exception as e: # Handle any potential errors @@ -73,26 +57,4 @@ if __name__ == '__main__': - simulate_dynamic_options('http://192.168.1.202:8080') - -# for i in simulate_dynamic_options('192.168.1.202:8080')[0]['options']: -# print(i) - # print(i) - # parser = argparse.ArgumentParser() - # parser.add_argument('-n', '--names', dest='names', action='store', default=None, help='Table names to reload') - # parser.add_argument('-u', '--url', dest='url', action='store', default=None, help='Base url for reload') - # parser.add_argument('-k', '--key', dest='key', action='store', default=None, help='Galaxy API Key') - # parser.add_argument('-g', '--graceful', dest='graceful', action='store_true', help='Fail gracefully') - - # args = parser.parse_args() - # try: - # if not args.names: - # tables = requests.get(urljoin(args.url, "api/tool_data"), params={'key': args.key}).json() - # args.names = [d.get('name') for d in tables] - # for name in args.names: - # print(requests.get(urljoin(args.url, "api/tool_data/%s/reload" % (name)), params={'key': args.key}).json()) - # except Exception as e: - # if args.graceful: - # print("Failed to reload data tables:\n%s" % (e)) - # else: - # raise e + simulate_dynamic_options('http://iotprojects.ddns.net')
--- a/gaiac_time_sync/gaiac_time_sync.xml Thu May 15 22:51:32 2025 +0000 +++ b/gaiac_time_sync/gaiac_time_sync.xml Fri May 23 17:57:51 2025 +0000 @@ -10,23 +10,23 @@ <command detect_errors="exit_code"><![CDATA[ - python3 '$__tool_directory__/time_sync.py' -f '$input1' -t '$column' -o $out + python '$__tool_directory__/gaiac_time_sync.py' -f '$input' -t '$column' -o $out ]]></command> <inputs> - <param type="data" name="input1" label="Input files" format="tabular" multiple="true" help="Input tabular data files"/> + <param type="data" name="input" label="Input files" format="tabular" multiple="true" help="Input tabular data files"/> <param type="text" name="column" label="Date and Time Column" help="Date and Time column name"/> </inputs> <outputs> - <data name='out' format='tabular' label="out.tsv" from_work_dir="out.tsv"/> + <data name='out' format='tabular' label="${tool.name} on $on_string (tabular)" from_work_dir="out.tsv"/> </outputs> <tests> <test> <!-- Input files for time synchronization --> - <param name="input1" value="input1.tsv,input2.tsv,input3.tsv"/> + <param name="input" value="input1.tsv,input2.tsv,input3.tsv"/> <param name="column" value="date_time"/> <!-- Output file to check synchronization -->