From b8416b9284a8fb9c66258aa1567b808e5d0af41e Mon Sep 17 00:00:00 2001 From: Cheng-Kai Wang Date: Tue, 30 Jul 2024 16:11:51 +0200 Subject: [PATCH 1/2] timeout_ms can be wrongly set to None instead of 0 if job_timeout is specified as zero timedelta --- src/omotes_sdk/omotes_interface.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/omotes_sdk/omotes_interface.py b/src/omotes_sdk/omotes_interface.py index e5e9e5c..725cd20 100644 --- a/src/omotes_sdk/omotes_interface.py +++ b/src/omotes_sdk/omotes_interface.py @@ -234,6 +234,7 @@ def submit_job( str, Union[Struct, ListValue, str, float, bool, None, Mapping[str, Any], Sequence] :param workflow_type: Type of the workflow to start. :param job_timeout: How long the job may take before it is considered to be timeout. + If it is specified as None, the job is immune from the periodic timeout job cancellation task. :param callback_on_finished: Callback which is called with the job result once the job is done. :param callback_on_progress_update: Callback which is called with any progress updates. @@ -261,7 +262,10 @@ def submit_job( auto_disconnect_on_result, ) - timeout_ms = round(job_timeout.total_seconds() * 1000) if job_timeout else None + if job_timeout is not None: + timeout_ms = round(job_timeout.total_seconds() * 1000) + else: + timeout_ms = None job_submission_msg = JobSubmission( uuid=str(job.id), From 759e58fdf3769727322c935540eaec0ac2c4418e Mon Sep 17 00:00:00 2001 From: Cheng-Kai Wang Date: Tue, 30 Jul 2024 16:21:57 +0200 Subject: [PATCH 2/2] Fix linting line too long error --- src/omotes_sdk/omotes_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/omotes_sdk/omotes_interface.py b/src/omotes_sdk/omotes_interface.py index 725cd20..8877719 100644 --- a/src/omotes_sdk/omotes_interface.py +++ b/src/omotes_sdk/omotes_interface.py @@ -234,7 +234,7 @@ def submit_job( str, Union[Struct, ListValue, str, float, bool, None, Mapping[str, Any], Sequence] :param workflow_type: Type of the workflow to start. :param job_timeout: How long the job may take before it is considered to be timeout. - If it is specified as None, the job is immune from the periodic timeout job cancellation task. + If None is given, the job is immune from the periodic timeout job cancellation task. :param callback_on_finished: Callback which is called with the job result once the job is done. :param callback_on_progress_update: Callback which is called with any progress updates.