JobResult#
- class rapidtools.jobs.JobResult(job_id: str, job_name: str = '', job_file: Path | None = None, result_file: Path | None = None, status: str = 'running', message: str = '', started_at: str = <factory>, updated_at: str = '', finished_at: str | None = None, duration_s: float | None = None, steps: list[StepResult] = <factory>, exception: BaseException | None = None)[source]#
Bases:
objectThe outcome of a job, mirrored in its result file.
- Variables:
job_id (str) –
idof the job.job_name (str) – Its name.
job_file (Path | None) – The job file, if the job came from one.
result_file (Path | None) – Where this result is written.
status (str) – One of
JOB_STATUSES.message (str) – The latest progress line, or the final outcome.
started_at (str) – UTC start time.
updated_at (str) – UTC time of the last change.
finished_at (str | None) – UTC end time, once the job has ended.
duration_s (float | None) – Wall-clock seconds, once the job has ended.
steps (list[StepResult]) – One entry per step, in order.
exception (BaseException | None) – The exception that ended the job, for callers in the same process. Not written to the result file.
Example
>>> result = JobResult(job_id='j1', job_name='Demo') >>> result.ok, result.to_dict()['schema'] (False, 'rapidtools.job_result')
Methods
Re-raise the exception that ended the job, if it did not succeed.
Return the result of the step with the given
id.Return the result-file document.
- step(step_id: str) StepResult[source]#
Return the result of the step with the given
id.- Raises:
KeyError – If the job has no such step.
- raise_for_status() JobResult[source]#
Re-raise the exception that ended the job, if it did not succeed.
- Returns:
JobResult –
selfwhen the job is done, for chaining.- Raises:
BaseException – The original exception of the failed or canceled step (
OperationCanceledfor a cancellation,JobErrorfor an invalid job).