Trigger a pipeline from Python Client

Trigger a pipeline using the ZenML Client.

This is a ZenML Pro only feature. Please sign up here get access. OSS users can only trigger a pipeline by calling the pipeline function inside their runner script.

Triggering a pipeline from the Python client only works with pipelines that are configured with a remote stack (i.e. at least a remote orchestrator, artifact store, and container registry)

from zenml.client import Client
from zenml.config.pipeline_run_configuration import PipelineRunConfiguration

if __name__ == "__main__":
    run_config = PipelineRunConfiguration(steps={"trainer": {"parameters": {"data_artifact_id": data_artifact_id}}})
    Client().trigger_pipeline("training_pipeline", run_configuration=run_config)

The pipeline that you're triggering (i.e. training_pipeline in the above example) has to have been run previously on a remote stack. In other words, the functionality to trigger a pipeline from another only works when a Docker image has previously been built for that pipeline. In most cases this will be because you ran the pipeline already, but in some cases you might have built the image separately.

Read more about the PipelineRunConfiguration and trigger_pipeline in the SDK Docs.

Last updated