Skip to content

Job class

Bases: _Entity, _Labeled

Execution of a Task.

Task, Sequence, and Scenario entities can be submitted for execution. The submission of a scenario triggers the submission of all the contained tasks. Similarly, the submission of a sequence also triggers the execution of all the ordered tasks.

Every time a task is submitted for execution, a new Job is created. A job represents a single execution of a task. It holds all the information related to the task execution, including the creation date, the execution Status, the timestamp of status changes, and the stacktrace of any exception that may be raised by the user function.

In addition, a job notifies scenario or sequence subscribers on its status change.

Attributes

blocked_duration property

blocked_duration: Optional[float]

The duration of the job in seconds spent in the blocked status.

The duration of the job in seconds spent in the blocked status. If the job has never been blocked, None is returned. If the job is currently blocked, the blocked duration is the duration from the submission to the current time.

creation_date property writable

creation_date: datetime

The date time when the job was created.

execution_duration property

execution_duration: Optional[float]

The duration of the job execution in seconds.

The execution duration is the duration in seconds from the job running time to the job completion time. If the job was not run, the execution duration is None. If the job is not finished yet, the execution duration is the duration from the running time to the current time.

finished_at property

finished_at: Optional[datetime]

The date time when the job was finished.

If the job is not finished, the finished_at time is None.

force property writable

force: bool

Enforce the job's execution whatever the output data nodes are in cache or not.

id instance-attribute

id: JobId = id

The identifier of this job.

owner_id property

owner_id: str

The identifier of the task of this job.

pending_duration property

pending_duration: Optional[float]

The duration of the job in seconds spent in the pending status.

If the job has never been pending, the pending_duration is None. If the job is currently pending, the pending duration is the duration from the submission to the current time.

run_at property

run_at: Optional[datetime]

The date time when the job was run.

If the job has not been run, the run_at time is None.

stacktrace property writable

stacktrace: List[str]

The list of stacktraces of the exceptions raised during the execution.

status property writable

status: Status

The current status of this job.

submit_entity property

submit_entity

The submitted entity that triggered the job creation.

submit_entity_id property

submit_entity_id: str

The identifier of the submitted entity that triggered the job creation.

submit_id property

submit_id: str

The identifier of the submission that triggered the job creation.

submitted_at property

submitted_at: datetime

The date time when the job was submitted.

task property writable

task: Task

The task associated to this job.

version property

version: str

The application version of the job.

If not provided, the latest version is used.

Methods

abandoned()

abandoned() -> None

Set the status to abandoned and notify subscribers.

blocked()

blocked() -> None

Set the status to blocked and notify subscribers.

canceled()

canceled() -> None

Set the status to canceled and notify subscribers.

completed()

completed() -> None

Set the status to completed and notify subscribers.

failed()

failed() -> None

Set the status to failed and notify subscribers.

get_label()

get_label() -> str

Returns the job simple label prefixed by its owner label.

Returns:

Type Description
str

The label of the job as a string.

get_simple_label()

get_simple_label() -> str

Returns the job simple label.

Returns:

Type Description
str

The simple label of the job as a string.

is_abandoned()

is_abandoned() -> bool

Indicate if the job was abandoned.

Returns:

Type Description
bool

True if the job was abandoned.

is_blocked()

is_blocked() -> bool

Indicate if the job is blocked.

Returns:

Type Description
bool

True if the job is blocked.

is_canceled()

is_canceled() -> bool

Indicate if the job was canceled.

Returns:

Type Description
bool

True if the job was canceled.

is_completed()

is_completed() -> bool

Indicate if the job has completed.

Returns:

Type Description
bool

True if the job has completed.

is_deletable()

is_deletable() -> ReasonCollection

Indicate if the job can be deleted.

Returns:

Type Description
ReasonCollection

A ReasonCollection object that can function as a Boolean value, which is True if the job can be deleted. False otherwise.

is_failed()

is_failed() -> bool

Indicate if the job has failed.

Returns:

Type Description
bool

True if the job has failed.

is_finished()

is_finished() -> bool

Indicate if the job is finished.

A job is considered finished if it is completed, failed, canceled, skipped, or abandoned.

Returns:

Type Description
bool

True if the job is finished.

is_pending()

is_pending() -> bool

Indicate if the job is pending.

Returns:

Type Description
bool

True if the job is pending.

is_running()

is_running() -> bool

Indicate if the job is running.

Returns:

Type Description
bool

True if the job is running.

is_skipped()

is_skipped() -> bool

Indicate if the job was skipped.

Returns:

Type Description
bool

True if the job was skipped.

is_submitted()

is_submitted() -> bool

Indicate if the job is submitted.

Returns:

Type Description
bool

True if the job is submitted.

pending()

pending() -> None

Set the status to pending and notify subscribers.

running()

running() -> None

Set the status to running and notify subscribers.

skipped()

skipped() -> None

Set the status to skipped and notify subscribers.