run a pipeline from the api permalink

main entrypoint api permalink

The main entrypoint for running your own pipeline is main in the pypyr.pipelinerunner module.

import pypyr.pipelinerunner

pypyr.pipelinerunner.main(pipeline_name='arb pipe',
                          pipeline_context_input='arb context input',

Call this once per pypyr pipeline. Call me if you want to run a pypyr pipeline from your own code. This function does some one-off 1st time initialization before running the actual pipeline.

If you’re invoking pypyr from your own application via the API, it’s your responsibility to set up and configure logging. If you just want to replicate the log handlers & formatters that the pypyr cli uses, you can call pypyr.log.logger.set_root_logger() before invoking pipelinerunner.main().

Be aware that if you invoke this method, pypyr adds a NOTIFY - 25 custom log-level and notify() function to logging.

{pipeline_name}.yaml is relative to the the working_dir directory.

input args permalink

  • pipeline_name: string.
    • Name of pipeline, sans .yaml at end.
  • pipeline_context_input: string.
    • Initialize the pypyr context with this string.
  • working_dir: path-like.
    • Look for pipelines and modules in this directory.
  • groups: list of string. Optional.
    • Step-group names to run in pipeline.
    • Default to steps if not specified.
  • success_group: string. Optional.
    • Step-group name to run on success completion.
    • Default to on_success if not specified.
  • failure_group: string. Optional.
    • Step-group name to run on pipeline failure.
    • Default to on_failure if not specified.

returns permalink


invoke pipeline from api example permalink

from pathlib import Path
import pypyr.pipelinerunner

# as API consumer, it is your responsibility to configure logging.
# if you just want to use pypyr's default logging, do this:

# run pipeline exactly like the cli would do
pypyr.pipelinerunner.main(pipeline_name='arb pipe',
                          pipeline_context_input='arb context input',

see also

last updated on .