gaps.status.StatusUpdates#

class StatusUpdates(directory, pipeline_step, job_name, job_attrs)[source]#

Bases: object

Context manager to track run function progress.

When this context is entered, a status file is written for the given pipeline step/job combination, with the given job attributes. The job status is set to “running”, and the start time is recorded. When the context is exited, another status file is written with the end time and total runtime values added. The status is also set to “successful”, unless an uncaught exception was raised during the function runtime, in which case the status is set to “failed”. If the out_file attribute of this context manager is set before the context is exited, that value is also written to the status file.

Initialize StatusUpdates.

Parameters:
  • directory (path-like) – Directory to write status files to.

  • pipeline_step (str) – Name of the pipeline step being run.

  • job_name (str) – Name of the job being run.

  • job_attrs (dict) – A dictionary containing job attributes that should be written to the status file.

Methods