Module leapyear.jobs

Classes for managing asynchronous jobs in LeapYear Core.

Inspecting Job status

class leapyear.jobs.AsyncJob(async_job_id, *, on_success=None)

A helper for polling the result of an asynchronous job.

Represents an accessor for an asynchronous job on the LeapYear server. It contains a unique job_id for a specific job and methods to check the results of or cancel the job at a later time.

class leapyear.jobs.AsyncJobStatus(status, result, start_time, end_time)

Result of checking the status of an asynchronous job.

status

The current status of the job.

Return type

AsyncJobState

result

None if the job is still running, otherwise either the JobResult or a LYCoreException error.

Return type

Optional[ResultOrError]

start_time

The time the job was started.

Return type

datetime

end_time

The time the job finished, or None if the job is still running.

Return type

Optional[datetime]

property elapsed_time

Return a timedelta representing the amount of time taken by the analysis.

Return type

timedelta

class leapyear.jobs.AsyncJobState(value)

The current state of a job.

AsyncJobStateRunning = 'AsyncJobStateRunning'
AsyncJobStateFinished = 'AsyncJobStateFinished'
AsyncJobStateFailed = 'AsyncJobStateFailed'
AsyncJobStateCancelled = 'AsyncJobStateCancelled'