From 13665842b6b75ac265d59f88fadafa0995b0da69 Mon Sep 17 00:00:00 2001 From: dapineyro Date: Wed, 27 Nov 2024 17:07:33 +0100 Subject: [PATCH 01/11] fix AMI --- cloudos/jobs/job.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudos/jobs/job.py b/cloudos/jobs/job.py index 47974dc..5c6dcb2 100644 --- a/cloudos/jobs/job.py +++ b/cloudos/jobs/job.py @@ -243,7 +243,7 @@ def convert_nextflow_to_json(self, nextflow_profile: string A comma separated string with the profiles to be used. instance_type : string - Name of the AMI to choose. + Name of the instance type to be used for the job master node, for example for AWS EC2 c5.xlarge instance_disk : int The disk space of the instance, in GB. storage_mode : string @@ -468,7 +468,7 @@ def send_job(self, nextflow_profile: string A comma separated string with the profiles to be used. instance_type : string - Type of the AMI to choose. + Name of the instance type to be used for the job master node, for example for AWS EC2 c5.xlarge instance_disk : int The disk space of the instance, in GB. storage_mode : string From 020db910471673cdfb45995b482bd44249242eb9 Mon Sep 17 00:00:00 2001 From: dapineyro Date: Wed, 27 Nov 2024 17:39:37 +0100 Subject: [PATCH 02/11] adds nextflow-version --- cloudos/__main__.py | 15 +++++++++++++++ cloudos/jobs/job.py | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/cloudos/__main__.py b/cloudos/__main__.py index 5347317..5f54a9f 100644 --- a/cloudos/__main__.py +++ b/cloudos/__main__.py @@ -122,6 +122,12 @@ def queue(): @click.option('--nextflow-profile', help=('A comma separated string indicating the nextflow profile/s ' + 'to use with your job.')) +@click.option('--nextflow-version', + help=('Nextflow version to use when executing the workflow in CloudOS. ' + + 'Please, note that versions above 22.10.8 are only DSL2 compatible. ' + + 'Default=22.10.8.'), + type=click.Choice(['22.10.8', '24.04.4', 'latest']), + default='22.10.8') @click.option('--git-commit', help=('The exact whole 40 character commit hash to run for ' + 'the selected pipeline. ' + @@ -237,6 +243,7 @@ def run(apikey, ignite, job_queue, nextflow_profile, + nextflow_version, instance_type, instance_disk, storage_mode, @@ -260,6 +267,13 @@ def run(apikey, if spot: print('\n[Message] You have specified spot instances but they are no longer available ' + 'in CloudOS. Option ignored.\n') + if nextflow_version == 'latest': + nextflow_version = '24.04.4' + print('\n[Message] You have specified Nextflow version \'latest\'. The workflow will use the ' + + f'latest version available on CloudOS: {nextflow_version}.\n') + if nextflow_version != '22.10.8': + print(f'\n[Warning] You have specified Nextflow version {nextflow_version}. This version requires the pipeline ' + + 'to be written in DSL2 and does not support DSL1.\n') if do_not_save_logs: save_logs = False else: @@ -365,6 +379,7 @@ def run(apikey, batch=batch, job_queue_id=job_queue_id, nextflow_profile=nextflow_profile, + nextflow_version=nextflow_version, instance_type=instance_type, instance_disk=instance_disk, storage_mode=storage_mode, diff --git a/cloudos/jobs/job.py b/cloudos/jobs/job.py index 5c6dcb2..c6c2aa6 100644 --- a/cloudos/jobs/job.py +++ b/cloudos/jobs/job.py @@ -197,6 +197,7 @@ def convert_nextflow_to_json(self, batch, job_queue_id, nextflow_profile, + nextflow_version, instance_type, instance_disk, storage_mode, @@ -242,6 +243,8 @@ def convert_nextflow_to_json(self, Job queue Id to use in the batch job. nextflow_profile: string A comma separated string with the profiles to be used. + nextflow_version: string + Nextflow version to use when executing the workflow in CloudOS. instance_type : string Name of the instance type to be used for the job master node, for example for AWS EC2 c5.xlarge instance_disk : int @@ -383,6 +386,7 @@ def convert_nextflow_to_json(self, "project": project_id, "workflow": workflow_id, "name": job_name, + "nextflowVersion": nextflow_version, "resumable": resumable, "saveProcessLogs": save_logs, "batch": { @@ -425,6 +429,7 @@ def send_job(self, batch=True, job_queue_id=None, nextflow_profile=None, + nextflow_version='22.10.8', instance_type='c5.xlarge', instance_disk=500, storage_mode='regular', @@ -467,6 +472,8 @@ def send_job(self, Job queue Id to use in the batch job. nextflow_profile: string A comma separated string with the profiles to be used. + nextflow_version: string + Nextflow version to use when executing the workflow in CloudOS. instance_type : string Name of the instance type to be used for the job master node, for example for AWS EC2 c5.xlarge instance_disk : int @@ -520,6 +527,7 @@ def send_job(self, batch, job_queue_id, nextflow_profile, + nextflow_version, instance_type, instance_disk, storage_mode, From db00e5bab24f1fa48514fd919737ef89c9f08e99 Mon Sep 17 00:00:00 2001 From: dapineyro Date: Wed, 27 Nov 2024 17:58:48 +0100 Subject: [PATCH 03/11] system tools check --- cloudos/__main__.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/cloudos/__main__.py b/cloudos/__main__.py index 5f54a9f..c4fc5c7 100644 --- a/cloudos/__main__.py +++ b/cloudos/__main__.py @@ -262,18 +262,10 @@ def run(apikey, disable_ssl_verification, ssl_cert): """Submit a job to CloudOS.""" - print('Executing run...') verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert) if spot: - print('\n[Message] You have specified spot instances but they are no longer available ' + - 'in CloudOS. Option ignored.\n') - if nextflow_version == 'latest': - nextflow_version = '24.04.4' - print('\n[Message] You have specified Nextflow version \'latest\'. The workflow will use the ' + - f'latest version available on CloudOS: {nextflow_version}.\n') - if nextflow_version != '22.10.8': - print(f'\n[Warning] You have specified Nextflow version {nextflow_version}. This version requires the pipeline ' + - 'to be written in DSL2 and does not support DSL1.\n') + print('[Message] You have specified spot instances but they are no longer available ' + + 'in CloudOS. Option ignored.') if do_not_save_logs: save_logs = False else: @@ -289,13 +281,13 @@ def run(apikey, batch = None elif ignite: batch = None - print('\n[Warning] You have specified ignite executor. Please, note that ignite is being ' + + print('[Warning] You have specified ignite executor. Please, note that ignite is being ' + 'removed from CloudOS, so the command may fail. Check ignite availability in your ' + - 'CloudOS\n') + 'CloudOS') else: batch = True if execution_platform == 'hpc': - print('\nHPC execution platform selected') + print('\n[Message] HPC execution platform selected') if hpc_id is None: raise ValueError('Please, specify your HPC ID using --hpc parameter') print('[Message] Please, take into account that HPC execution do not support ' + @@ -318,7 +310,7 @@ def run(apikey, raise ValueError(f'The workflow {workflow_name} is a WDL workflow. ' + 'WDL is not supported on HPC execution platform.') if workflow_type == 'wdl': - print('\tWDL workflow detected\n') + print('[Message] WDL workflow detected') if wdl_mainfile is None: raise ValueError('Please, specify WDL mainFile using --wdl-mainfile .') c_status = cl.get_cromwell_status(workspace_id, verify_ssl) @@ -360,15 +352,29 @@ def run(apikey, print('\t...Sending job to CloudOS\n') if is_module: if job_queue is not None: - print(f'\tIgnoring job queue "{job_queue}" for ' + + print(f'[Message] Ignoring job queue "{job_queue}" for ' + f'Platform Workflow "{workflow_name}". Platform Workflows ' + 'use their own predetermined queues.') job_queue_id = None + if nextflow_version != '22.10.8': + print(f'[Message] The selected worflow \'{workflow_name}\' ' + + 'is a CloudOS module. CloudOS modules only work with ' + + 'Nextflow version 22.10.8. Switching to use 22.10.8') + nextflow_version = '22.10.8' else: queue = Queue(cloudos_url=cloudos_url, apikey=apikey, cromwell_token=cromwell_token, workspace_id=workspace_id, verify=verify_ssl) job_queue_id = queue.fetch_job_queue_id(workflow_type=workflow_type, batch=batch, job_queue=job_queue) + if nextflow_version == 'latest': + nextflow_version = '24.04.4' + print('[Message] You have specified Nextflow version \'latest\'. The workflow will use the ' + + f'latest version available on CloudOS: {nextflow_version}.') + if nextflow_version != '22.10.8': + print(f'[Warning] You have specified Nextflow version {nextflow_version}. This version requires the pipeline ' + + 'to be written in DSL2 and does not support DSL1.') + print('Executing run...') + print(f'\tNextflow version: {nextflow_version}') j_id = j.send_job(job_config=job_config, parameter=parameter, git_commit=git_commit, From 57445319497ccf4f32efd356203c0af10333e266 Mon Sep 17 00:00:00 2001 From: dapineyro Date: Wed, 27 Nov 2024 18:04:27 +0100 Subject: [PATCH 04/11] changelog --- CHANGELOG.md | 6 ++++++ cloudos/_version.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eddac8b..7b485d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## lifebit-ai/cloudos-cli: changelog +## v2.12.0 (2024-11-27) + +### Feature + +- Adds the new parameter `--nextflow-version` to select the Nextflow version for job submissions. + ## v2.11.2 (2024-11-6) ### Fix diff --git a/cloudos/_version.py b/cloudos/_version.py index ded7bd3..0b288f8 100644 --- a/cloudos/_version.py +++ b/cloudos/_version.py @@ -1 +1 @@ -__version__ = '2.11.2' +__version__ = '2.12.0' From 4860a64a8188a298102412e75dbfbe424e93f404 Mon Sep 17 00:00:00 2001 From: dapineyro Date: Wed, 27 Nov 2024 18:47:21 +0100 Subject: [PATCH 05/11] trailing / --- CHANGELOG.md | 1 + cloudos/__main__.py | 6 ++++-- cloudos/clos.py | 8 ++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b485d7..7170dec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Feature - Adds the new parameter `--nextflow-version` to select the Nextflow version for job submissions. +- Now `--cloudos-url` can also take URLs with a trailing `/` ## v2.11.2 (2024-11-6) diff --git a/cloudos/__main__.py b/cloudos/__main__.py index c4fc5c7..4e28b15 100644 --- a/cloudos/__main__.py +++ b/cloudos/__main__.py @@ -397,7 +397,8 @@ def run(apikey, cost_limit=cost_limit, verify=verify_ssl) print(f'\tYour assigned job id is: {j_id}\n') - j_url = f'{cloudos_url}/app/jobs/{j_id}' + cloudos_url_rstrip = cloudos_url.rstrip('/') + j_url = f'{cloudos_url_rstrip}/app/jobs/{j_id}' if wait_completion: print('\tPlease, wait until job completion (max wait time of ' + f'{wait_time} seconds).\n') @@ -661,7 +662,8 @@ def job_status(apikey, j_status = cl.get_job_status(job_id, verify_ssl) j_status_h = json.loads(j_status.content)["status"] print(f'\tYour current job status is: {j_status_h}\n') - j_url = f'{cloudos_url}/app/jobs/{job_id}' + cloudos_url_rstrip = cloudos_url.rstrip('/') + j_url = f'{cloudos_url_rstrip}/app/jobs/{job_id}' print(f'\tTo further check your job status you can either go to {j_url} ' + 'or repeat the command you just used.') diff --git a/cloudos/clos.py b/cloudos/clos.py index ae2aa4b..b2b9830 100644 --- a/cloudos/clos.py +++ b/cloudos/clos.py @@ -33,6 +33,14 @@ class Cloudos: apikey: str cromwell_token: str + @property + def cloudos_url(self) -> str: + return self._cloudos_url + + @cloudos_url.setter + def cloudos_url(self, v) -> None: + self._cloudos_url = v.rstrip('/') + def get_job_status(self, j_id, verify=True): """Get job status from CloudOS. From 0add0ff5d3d96a7cb9f722fe939c38097921ca56 Mon Sep 17 00:00:00 2001 From: dapineyro Date: Wed, 27 Nov 2024 18:55:30 +0100 Subject: [PATCH 06/11] fix url --- cloudos/clos.py | 8 -------- cloudos/utils/requests.py | 2 ++ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/cloudos/clos.py b/cloudos/clos.py index b2b9830..ae2aa4b 100644 --- a/cloudos/clos.py +++ b/cloudos/clos.py @@ -33,14 +33,6 @@ class Cloudos: apikey: str cromwell_token: str - @property - def cloudos_url(self) -> str: - return self._cloudos_url - - @cloudos_url.setter - def cloudos_url(self, v) -> None: - self._cloudos_url = v.rstrip('/') - def get_job_status(self, j_id, verify=True): """Get job status from CloudOS. diff --git a/cloudos/utils/requests.py b/cloudos/utils/requests.py index 767e4f8..642c8ae 100644 --- a/cloudos/utils/requests.py +++ b/cloudos/utils/requests.py @@ -24,6 +24,7 @@ def retry_requests_get(url, total=5, status_forcelist=[429, 500, 502, 503, 504], response : requests.Response The Response object returned by the API server """ + url = url.rstrip('/') retry_strategy = Retry( total=total, status_forcelist=status_forcelist @@ -58,6 +59,7 @@ def retry_requests_post(url, total=5, status_forcelist=[429, 500, 502, 503, 504] response : requests.Response The Response object returned by the API server """ + url = url.rstrip('/') retry_strategy = Retry( total=total, status_forcelist=status_forcelist From 1d8ebd3197b113ad44003fc16f4a0d1e1d1aa556 Mon Sep 17 00:00:00 2001 From: dapineyro Date: Wed, 27 Nov 2024 18:59:26 +0100 Subject: [PATCH 07/11] fix pytests --- tests/test_data/convert_nextflow_to_json_params.json | 2 +- tests/test_jobs/test_convert_nextflow_to_json.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_data/convert_nextflow_to_json_params.json b/tests/test_data/convert_nextflow_to_json_params.json index 398263e..7c9b97d 100644 --- a/tests/test_data/convert_nextflow_to_json_params.json +++ b/tests/test_data/convert_nextflow_to_json_params.json @@ -1 +1 @@ -{"parameters": [{"prefix": "--", "name": "reads", "parameterKind": "textValue", "textValue": "s3://lifebit-featured-datasets/pipelines/rnatoy-data"}, {"prefix": "--", "name": "genome", "parameterKind": "textValue", "textValue": "s3://lifebit-featured-datasets/pipelines/rnatoy-data/ggal_1_48850000_49020000.Ggal71.500bpflank.fa"}, {"prefix": "--", "name": "annot", "parameterKind": "textValue", "textValue": "s3://lifebit-featured-datasets/pipelines/rnatoy-data/ggal_1_48850000_49020000.bed.gff"}], "project": "6054754029b82f0112762b9c", "workflow": "60b0ca54303ee601a69b42d1", "name": "new_job", "resumable": true, "saveProcessLogs": true, "batch": {"dockerLogin": false, "enabled": false, "jobQueue": null}, "cromwellCloudResources": null, "executionPlatform": "aws", "hpc": null ,"storageSizeInGb": 500, "execution": {"computeCostLimit": -1, "optim": "test"}, "lusterFsxStorageSizeInGb": 1200, "storageMode": "regular", "revision": "", "profile": null, "instanceType": "c5.xlarge", "masterInstance": {"requestedInstance": {"type": "c5.xlarge", "asSpot": false}}} +{"parameters": [{"prefix": "--", "name": "reads", "parameterKind": "textValue", "textValue": "s3://lifebit-featured-datasets/pipelines/rnatoy-data"}, {"prefix": "--", "name": "genome", "parameterKind": "textValue", "textValue": "s3://lifebit-featured-datasets/pipelines/rnatoy-data/ggal_1_48850000_49020000.Ggal71.500bpflank.fa"}, {"prefix": "--", "name": "annot", "parameterKind": "textValue", "textValue": "s3://lifebit-featured-datasets/pipelines/rnatoy-data/ggal_1_48850000_49020000.bed.gff"}], "project": "6054754029b82f0112762b9c", "workflow": "60b0ca54303ee601a69b42d1", "name": "new_job","nextflowVersion": "22.10.8", "resumable": true, "saveProcessLogs": true, "batch": {"dockerLogin": false, "enabled": false, "jobQueue": null}, "cromwellCloudResources": null, "executionPlatform": "aws", "hpc": null ,"storageSizeInGb": 500, "execution": {"computeCostLimit": -1, "optim": "test"}, "lusterFsxStorageSizeInGb": 1200, "storageMode": "regular", "revision": "", "profile": null, "instanceType": "c5.xlarge", "masterInstance": {"requestedInstance": {"type": "c5.xlarge", "asSpot": false}}} diff --git a/tests/test_jobs/test_convert_nextflow_to_json.py b/tests/test_jobs/test_convert_nextflow_to_json.py index 6dcf74a..89fc5cb 100644 --- a/tests/test_jobs/test_convert_nextflow_to_json.py +++ b/tests/test_jobs/test_convert_nextflow_to_json.py @@ -19,6 +19,7 @@ "batch": False, "job_queue_id": None, "nextflow_profile": None, + "nextflow_version": '22.10.8', "instance_type": "c5.xlarge", "instance_disk": 500, "storage_mode": 'regular', @@ -46,6 +47,7 @@ def test_convert_nextflow_to_json_output_correct(): batch=param_dict["batch"], job_queue_id=param_dict["job_queue_id"], nextflow_profile=param_dict["nextflow_profile"], + nextflow_version=param_dict["nextflow_version"], instance_type=param_dict["instance_type"], instance_disk=param_dict["instance_disk"], storage_mode=param_dict["storage_mode"], @@ -78,6 +80,7 @@ def test_convert_nextflow_to_json_badly_formed_config(): batch=param_dict["batch"], job_queue_id=param_dict["job_queue_id"], nextflow_profile=param_dict["nextflow_profile"], + nextflow_version=param_dict["nextflow_version"], instance_type=param_dict["instance_type"], instance_disk=param_dict["instance_disk"], storage_mode=param_dict["storage_mode"], From 4362665d2865cec6f2eadeadcc77ff4805ae0019 Mon Sep 17 00:00:00 2001 From: dapineyro Date: Wed, 27 Nov 2024 19:01:33 +0100 Subject: [PATCH 08/11] readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index ed26b80..c1d3487 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,11 @@ Options: to include. --nextflow-profile TEXT A comma separated string indicating the nextflow profile/s to use with your job. + --nextflow-version [22.10.8|24.04.4|latest] + Nextflow version to use when executing the + workflow in CloudOS. Please, note that + versions above 22.10.8 are only DSL2 + compatible. Default=22.10.8. --git-commit TEXT The exact whole 40 character commit hash to run for the selected pipeline. If not specified it defaults to the last commit of From 44c9f6c82fbade9fbd56952de8bb15ed6a4fa735 Mon Sep 17 00:00:00 2001 From: dapineyro Date: Wed, 27 Nov 2024 19:35:55 +0100 Subject: [PATCH 09/11] fix url --- cloudos/__main__.py | 17 +++++++++++++---- cloudos/utils/requests.py | 2 -- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cloudos/__main__.py b/cloudos/__main__.py index 4e28b15..0c087c6 100644 --- a/cloudos/__main__.py +++ b/cloudos/__main__.py @@ -262,6 +262,7 @@ def run(apikey, disable_ssl_verification, ssl_cert): """Submit a job to CloudOS.""" + cloudos_url = cloudos_url.rstrip('/') verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert) if spot: print('[Message] You have specified spot instances but they are no longer available ' + @@ -397,8 +398,7 @@ def run(apikey, cost_limit=cost_limit, verify=verify_ssl) print(f'\tYour assigned job id is: {j_id}\n') - cloudos_url_rstrip = cloudos_url.rstrip('/') - j_url = f'{cloudos_url_rstrip}/app/jobs/{j_id}' + j_url = f'{cloudos_url}/app/jobs/{j_id}' if wait_completion: print('\tPlease, wait until job completion (max wait time of ' + f'{wait_time} seconds).\n') @@ -537,6 +537,7 @@ def run_curated_examples(apikey, NOTE that currently, only Nextflow workflows are supported. """ + cloudos_url = cloudos_url.rstrip('/') verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert) cl = Cloudos(cloudos_url, apikey, None) curated_workflows = cl.get_curated_workflow_list(workspace_id, verify=verify_ssl) @@ -650,6 +651,7 @@ def job_status(apikey, disable_ssl_verification, ssl_cert): """Check job status in CloudOS.""" + cloudos_url = cloudos_url.rstrip('/') print('Executing status...') verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert) if verbose: @@ -662,8 +664,7 @@ def job_status(apikey, j_status = cl.get_job_status(job_id, verify_ssl) j_status_h = json.loads(j_status.content)["status"] print(f'\tYour current job status is: {j_status_h}\n') - cloudos_url_rstrip = cloudos_url.rstrip('/') - j_url = f'{cloudos_url_rstrip}/app/jobs/{job_id}' + j_url = f'{cloudos_url}/app/jobs/{job_id}' print(f'\tTo further check your job status you can either go to {j_url} ' + 'or repeat the command you just used.') @@ -725,6 +726,7 @@ def list_jobs(apikey, disable_ssl_verification, ssl_cert): """Collect all your jobs from a CloudOS workspace in CSV format.""" + cloudos_url = cloudos_url.rstrip('/') verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert) outfile = output_basename + '.' + output_format print('Executing list...') @@ -806,6 +808,7 @@ def list_workflows(apikey, disable_ssl_verification, ssl_cert): """Collect all workflows from a CloudOS workspace in CSV format.""" + cloudos_url = cloudos_url.rstrip('/') verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert) outfile = output_basename + '.' + output_format print('Executing list...') @@ -882,6 +885,7 @@ def import_workflows(apikey, disable_ssl_verification, ssl_cert): """Imports workflows to CloudOS.""" + cloudos_url = cloudos_url.rstrip('/') verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert) print('Executing workflow import...\n') print('\t[Message] Only Nextflow workflows are currently supported.\n') @@ -943,6 +947,7 @@ def list_projects(apikey, disable_ssl_verification, ssl_cert): """Collect all projects from a CloudOS workspace in CSV format.""" + cloudos_url = cloudos_url.rstrip('/') verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert) outfile = output_basename + '.' + output_format print('Executing list...') @@ -1008,6 +1013,7 @@ def cromwell_status(apikey, disable_ssl_verification, ssl_cert): """Check Cromwell server status in CloudOS.""" + cloudos_url = cloudos_url.rstrip('/') if apikey is None and cromwell_token is None: raise ValueError("Please, use one of the following tokens: '--apikey', '--cromwell_token'") print('Executing status...') @@ -1063,6 +1069,7 @@ def cromwell_restart(apikey, disable_ssl_verification, ssl_cert): """Restart Cromwell server in CloudOS.""" + cloudos_url = cloudos_url.rstrip('/') if apikey is None and cromwell_token is None: raise ValueError("Please, use one of the following tokens: '--apikey', '--cromwell_token'") verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert) @@ -1135,6 +1142,7 @@ def cromwell_stop(apikey, disable_ssl_verification, ssl_cert): """Stop Cromwell server in CloudOS.""" + cloudos_url = cloudos_url.rstrip('/') if apikey is None and cromwell_token is None: raise ValueError("Please, use one of the following tokens: '--apikey', '--cromwell_token'") verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert) @@ -1195,6 +1203,7 @@ def list_queues(apikey, disable_ssl_verification, ssl_cert): """Collect all available job queues from a CloudOS workspace.""" + cloudos_url = cloudos_url.rstrip('/') verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert) outfile = output_basename + '.' + output_format print('Executing list...') diff --git a/cloudos/utils/requests.py b/cloudos/utils/requests.py index 642c8ae..767e4f8 100644 --- a/cloudos/utils/requests.py +++ b/cloudos/utils/requests.py @@ -24,7 +24,6 @@ def retry_requests_get(url, total=5, status_forcelist=[429, 500, 502, 503, 504], response : requests.Response The Response object returned by the API server """ - url = url.rstrip('/') retry_strategy = Retry( total=total, status_forcelist=status_forcelist @@ -59,7 +58,6 @@ def retry_requests_post(url, total=5, status_forcelist=[429, 500, 502, 503, 504] response : requests.Response The Response object returned by the API server """ - url = url.rstrip('/') retry_strategy = Retry( total=total, status_forcelist=status_forcelist From 1857ee0a36d5dd66a19701b92cc18812d9ce4bc9 Mon Sep 17 00:00:00 2001 From: dapineyro Date: Wed, 27 Nov 2024 19:40:05 +0100 Subject: [PATCH 10/11] messages --- cloudos/queue/queue.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cloudos/queue/queue.py b/cloudos/queue/queue.py index ad7a9dc..2763072 100644 --- a/cloudos/queue/queue.py +++ b/cloudos/queue/queue.py @@ -128,12 +128,12 @@ def fetch_job_queue_id(self, workflow_type, batch=True, job_queue=None): default_queue_name = available_queues[-1]['label'] queue_as_default = 'most recent suitable' if job_queue is None: - print(f'\tNo job_queue was specified, using the {queue_as_default} queue: ' + - f'{default_queue_name}.') + print(f'\t[Message] No job_queue was specified, using the {queue_as_default} queue: ' + + f'{default_queue_name}.\n') return default_queue_id selected_queue = [q for q in available_queues if q['label'] == job_queue] if len(selected_queue) == 0: - print(f'\tQueue \'{job_queue}\' you specified was not found, using the {queue_as_default} ' + - f'queue instead: {default_queue_name}.') + print(f'\t[Message] Queue \'{job_queue}\' you specified was not found, using the {queue_as_default} ' + + f'queue instead: {default_queue_name}.\n') return default_queue_id return selected_queue[0]['id'] From 08ef93f0dfa61ba1810fbe4a12cac4381d1c6013 Mon Sep 17 00:00:00 2001 From: dapineyro Date: Wed, 27 Nov 2024 19:47:24 +0100 Subject: [PATCH 11/11] messages --- cloudos/__main__.py | 2 +- cloudos/queue/queue.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cloudos/__main__.py b/cloudos/__main__.py index 0c087c6..36e9a05 100644 --- a/cloudos/__main__.py +++ b/cloudos/__main__.py @@ -374,7 +374,7 @@ def run(apikey, if nextflow_version != '22.10.8': print(f'[Warning] You have specified Nextflow version {nextflow_version}. This version requires the pipeline ' + 'to be written in DSL2 and does not support DSL1.') - print('Executing run...') + print('\nExecuting run...') print(f'\tNextflow version: {nextflow_version}') j_id = j.send_job(job_config=job_config, parameter=parameter, diff --git a/cloudos/queue/queue.py b/cloudos/queue/queue.py index 2763072..fd180e0 100644 --- a/cloudos/queue/queue.py +++ b/cloudos/queue/queue.py @@ -128,12 +128,12 @@ def fetch_job_queue_id(self, workflow_type, batch=True, job_queue=None): default_queue_name = available_queues[-1]['label'] queue_as_default = 'most recent suitable' if job_queue is None: - print(f'\t[Message] No job_queue was specified, using the {queue_as_default} queue: ' + - f'{default_queue_name}.\n') + print(f'[Message] No job_queue was specified, using the {queue_as_default} queue: ' + + f'{default_queue_name}.') return default_queue_id selected_queue = [q for q in available_queues if q['label'] == job_queue] if len(selected_queue) == 0: - print(f'\t[Message] Queue \'{job_queue}\' you specified was not found, using the {queue_as_default} ' + - f'queue instead: {default_queue_name}.\n') + print(f'[Message] Queue \'{job_queue}\' you specified was not found, using the {queue_as_default} ' + + f'queue instead: {default_queue_name}.') return default_queue_id return selected_queue[0]['id']