Skip to content

Commit

Permalink
Merge pull request #62 from Project-OMOTES/85-job-timeout-none-is-wro…
Browse files Browse the repository at this point in the history
…ngly-interpreted-as-timeout-0

Fix timeout_ms being wrongly assigned as None when job_timeout is given as a zero timedelta
  • Loading branch information
cwang39403 authored Aug 1, 2024
2 parents 1d3a948 + 759e58f commit d733f5b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/omotes_sdk/omotes_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 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.
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit d733f5b

Please sign in to comment.