You can add conditions to your pipeline for example to stop a pipeline if certain metrics are below an expected range, or pause a pipeline before a human has reviewed the results.
This is just a short recap
We strongly recommend completing the Mastering Valohai learning path on Valohai Academy.
This guide will provide you with a overview and a “cheatsheet” for migrating projects. It won’t explain the concepts and all the options in detail.
Automatic stop
The below pipeline will automatically stop, if the training job´s last reported value for the metrics accuracy
is under 0.92.
- pipeline:
name: train-inference-pipeline
nodes:
- name: preprocess-node
type: execution
step: preprocess
- name: train-model-node
type: execution
step: train-model
actions:
- when: node-complete
if: metadata.accuracy >= 0.92
then: stop-pipeline
- name: batch-inference-node
type: execution
step: batch-inference
edges:
- [preprocess-node.outputs.*, train-model-node.inputs.data]
- [train-model-node.outputs.*.pkl, batch-inference-node.inputs.model]
Human approval
The below pipeline will pause for human approval before it starts running the batch-inference
job.
- pipeline:
name: train-inference-pipeline
nodes:
- name: preprocess-node
type: execution
step: preprocess
- name: train-model-node
type: execution
step: train-model
- name: batch-inference-node
type: execution
step: batch-inference
actions:
- when: node-starting
then: require-approval
edges:
- [preprocess-node.outputs.*, train-model-node.inputs.data]
- [train-model-node.outputs.*.pkl, batch-inference-node.inputs.model]