cleanX.image_work package

Submodules

Module contents

cleanX.image_work.create_pipeline(steps, batch_size=None, journal=None, keep_journal=False)

Create a pipeline that will execute the steps. If journal is not false, create a journaling pipeline, that can be pick up from the failed step.

Parameters:
  • steps (Sequence[Step]) – A sequence of Step to be executed in this pipeline.

  • batch_size (int) – Controls how many steps are processed concurrently.

  • journal (Union[bool, str]) – If True is passed, the pipeline code will use a preconfigured directory to store the journal. Otherwise, this must be the path to the directory to store the journal database.

  • keep_journal (bool) – Controls whether the journal is kept after successful completion of the pipeline.

Returns:

a Pipeline object or one of its descendants.

Return type:

Pipeline

cleanX.image_work.restore_pipeline(journal_dir, skip=0, **overrides)

Restores previously interrupted pipeline. The pipeline should have been created with journal set. If the creating code didn’t specify the directory to keep the journal, it may be obtained in this way:

p = create_pipeline(steps=(...), journal=True)
journal_dir = p.journal_dir
# After pipeline failed
p = restore_pipeline(journal_dir)
Parameters:
  • journal_dir (Suitable for os.path.join()) – The directory containing journal database to restore from.

  • skip – Skip this many steps before attempting to resume the pipeline. This is useful if you know that the step that failed will fail again, but you want to execute the rest of the steps in the pipeline.

  • **overrides – Arguments to pass to the created pipeline instance that will override those restored from the journal.

Returns:

Fresh JournalingPipeline object fast-forwarded to the last executed step + skip.

Return type:

JournalingPipeline