flowbber.scheduler

Pipeline scheduler.

Classes

  • Scheduler: Schedule the execution of a pipeline.
class flowbber.scheduler.Scheduler(pipeline, frequency, samples=None, start=None, stop_on_failure=False)

Schedule the execution of a pipeline.

The scheduler will try to run the pipeline on schedule. If the pipeline takes too long, longer that the programmed frequency, the scheduler will increment the runs_missed counter for each execution that failed to run at the expected schedule because the previous run was still running and will start the missed pipeline execution right away.

Parameters
  • pipeline (flowbber.pipeline.Pipeline.) – The pipeline to execute.
  • frequency (float) – Sampling frequency in seconds.
  • samples (int) – Number of samples (successful executions of the pipeline) to take before stopping the scheduler. If missing or None, the scheduler will continue taking samples forever.
  • start (int) – An absolute timestamp in seconds since the epoch that mark when the scheduler should start executing the pipeline. This timestamp must be in the future. If missing or None, the scheduler will start immediately.
  • stop_on_failure (bool) – Stop the the scheduler if the pipeline fails one execution. Else keep scheduling run even on failure.

Inheritance

Inheritance diagram of Scheduler

last_run

Timestamp in seconds since the epoch of the last run of the pipeline.

run()

Start the scheduler.

runs

Read-only dictionary with the numbers of categorized runs of the pipeline:

{
    'passed': 10,
    'failed': 2,
    'missed': 0,
}