orca_sdk.job#
Status
#
Bases: Enum
Status of a cloud job in the task queue
Job
#
Bases: Generic[TResult]
Handle to a job that is run in the OrcaCloud
Attributes:
-
id
(str
) –Unique identifier for the job
-
type
(str
) –Type of the job
-
status
(Status
) –Current status of the job
-
steps_total
(int | None
) –Total number of steps in the job, present if the job started processing
-
steps_completed
(int | None
) –Number of steps completed in the job, present if the job started processing
-
completion
(float
) –Percentage of the job that has been completed, present if the job started processing
-
exception
(str | None
) –Exception that occurred during the job, present if the status is
FAILED
-
value
(TResult | None
) –Value of the result of the job, present if the status is
COMPLETED
-
created_at
(datetime
) –When the job was queued for processing
-
updated_at
(datetime
) –When the job was last updated
-
refreshed_at
(datetime
) –When the job status was last refreshed
Note
Accessing status and related attributes will refresh the job status in the background.
completion
property
#
Percentage of the job that has been completed, present if the job started processing
set_config
classmethod
#
Set global configuration for running jobs
Parameters:
-
refresh_interval
(int | None
, default:None
) –Time to wait between polling the job status in seconds, default is 3
-
show_progress
(bool | None
, default:None
) –Whether to show a progress bar when calling the wait method, default is True
-
max_wait
(int | None
, default:None
) –Maximum time to wait for the job to complete in seconds, default is 1 hour
query
classmethod
#
Query the job queue for jobs matching the given filters
Parameters:
-
status
(Status | list[Status] | None
, default:None
) –Optional status or list of statuses to filter by
-
type
(str | list[str] | None
, default:None
) –Optional type or list of types to filter by
-
limit
(int | None
, default:None
) –Maximum number of jobs to return
-
offset
(int
, default:0
) –Offset into the list of jobs to return
-
start
(datetime | None
, default:None
) –Optional minimum creation time of the jobs to query for
-
end
(datetime | None
, default:None
) –Optional maximum creation time of the jobs to query for
Returns:
__init__
#
refresh
#
Refresh the status and progress of the job
Parameters:
-
throttle
(float
, default:0
) –Minimum time in seconds between refreshes
wait
#
Block until the job is complete
Parameters:
-
show_progress
(bool | None
, default:None
) –Show a progress bar while waiting for the job to complete
-
refresh_interval
(int | None
, default:None
) –Polling interval in seconds while waiting for the job to complete
-
max_wait
(int | None
, default:None
) –Maximum time to wait for the job to complete in seconds
Note
The defaults for the config parameters can be set globally using the
set_config
method.
This method will not return the result or raise an exception if the job fails. Call
result
instead if you want to get the result.
Raises:
-
RuntimeError
–If the job times out
result
#
Block until the job is complete and return the result value
Parameters:
-
show_progress
(bool | None
, default:None
) –Show a progress bar while waiting for the job to complete
-
refresh_interval
(int | None
, default:None
) –Polling interval in seconds while waiting for the job to complete
-
max_wait
(int | None
, default:None
) –Maximum time to wait for the job to complete in seconds
Note
The defaults for the config parameters can be set globally using the
set_config
method.
This method will raise an exception if the job fails. Use wait
if you just want to wait for the job to complete without raising errors on failure.
Returns:
-
TResult
–The result value of the job
Raises:
-
RuntimeError
–If the job fails or times out
abort
#
Abort the job
Parameters: