Manage execution order
The wait_for argument defines the dependencies of a step within the pipeline.
- If wait_for=None, the step has no dependencies and will start executing immediately.
- If a step does not explicitly set wait_for, it will automatically depend on all preceding steps in the pipeline.
Code
from lightning_sdk.pipeline import Pipeline, JobStep
from lightning_sdk.machine import Machine
pipeline = Pipeline(name='second-pipeline')
pipeline.run(
steps=[
JobStep(
name='job-1',
image="ubuntu:latest",
machine=Machine.CPU,
command="sleep 9 && echo 'Hello, World!'"
),
JobStep(
name='job-2',
image="ubuntu:latest",
machine=Machine.CPU,
command="sleep 9 && echo 'Hello, World!'",
wait_for=None
),
JobStep(
name='job-3',
image="ubuntu:latest",
machine=Machine.CPU,
command="sleep 9 && echo 'Hello, World!'",
),
]
)The resulting Pipeline
===== Generated Pipeline =====
0 - Job['job-1'] wait_for nothing
1 - Job['job-2'] wait_for nothing
2 - Job['job-3'] wait_for ['job-1', 'job-2']
Was this page helpful?
Thanks for the feedback.