JobManagerClient

class scenebox.clients.JobManagerClient(asset_manager_url, auth_token, job_id=None, asset_type=None, asset_id=None, username=None, job_type=None, notes=None, description=None, stage=None, tags=None, user_facing=False, task_sync=False, resubmittable=False)

Client for interacting with the Job Manager.

asset_manager_url: URL to asset manager auth_token: Auth token to use job_id: unique identifier of a job asset_type: Type of asset ( used for updating job metadata) asset_id: Asset ID (used for updating job metadata) username: Username (used for updating job metadata) job_type: Type of the job (used for updating job metadata) notes: time-history of the events in the job (started at what time, queued at what time) (used for updating job metadata) description: the description of the job (used for updating job metadata) stage: Job stage (used for updating job metadata) ttl: job’s time to live in seconds sync_interval: Time interval to wait before checking if timeout > TTL or job failure,

Methods

get_job

Get the job_manager_client.Job object associated with the provided job ID.

resubmit

Resubmit a job.

update_progress

Args:

wait_for_completion

Wait for a job to complete.

Attributes

STATUS_ABORTED

STATUS_FINISHED

STATUS_INITIALIZED

STATUS_QUEUED

STATUS_RUNNING

update_progress(progress, raise_on_abort_canceled=False, message=None, force_update=False)
Args:

progress (float): percentage of job progress raise_on_abort_canceled (bool): raise JobError if job is canceled or aborted when this is True message: status update string force_update: should force update regardless of the last_progress status

resubmit()

Resubmit a job.

get_job()

Get the job_manager_client.Job object associated with the provided job ID.

Can be a currently executing or finished Job.

Parameters

job_id – The job ID associated with the Job of interest.

Returns

Job object with the job id job_id.

Return type

Job

wait_for_completion(increments_sec=10, enable_max_wait=False, max_wait_sec=300, progress_callback=None)

Wait for a job to complete.

Input a max waiting time before an unfinished job throws an Exception. Choose to either poll while a job is in progress, or enact a callable function progress_callback() with every increment set by increments_sec.

Parameters
  • job_id – The ID of the job in progress.

  • increments_sec – The amount of time to poll in between checking job status and calling progress_callback().

  • enable_max_wait – If True, immediately throws an Exception. Intended for use when there is an external timing constraint. Otherwise, does nothing.

  • max_wait_sec – The maximum amount of time to wait for a job to finish before throwing an exception. Measured in seconds.

  • progress_callback – Callback function to log the progress of the inference job. The callback should accept a parameter of type float for progress and str for progress message.

Raises

JobError – If job encounters an error, and could not complete. If job does not finish after max_wait_sec seconds.