Skip to content

Commit

Permalink
Merge pull request #139 from valohai/tokkoro/feat/error-pipeline
Browse files Browse the repository at this point in the history
Add error-pipeline as then-action for node actions
  • Loading branch information
tokkoro committed Nov 22, 2023
2 parents dd5167e + 554d5c6 commit 0b7318f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/pipeline-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@
- node-complete
if: [a, b, c]
then: noop
- name: accuracy-error
type: execution
step: Test model
actions:
- when: node-complete
if: "metadata.accuracy <= .8"
then: error-pipeline
edges:
- [train.output.model, validate.input.model]

Expand Down
7 changes: 7 additions & 0 deletions tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ def test_action_pipeline(pipeline_config: Config):
"then": ["noop"],
"when": ["node-complete", "node-starting"],
}
error_node = pl.get_node_by(name="accuracy-error")
assert error_node
assert error_node.actions[0].get_data() == {
"if": ["metadata.accuracy <= .8"],
"then": ["error-pipeline"],
"when": ["node-complete"],
}


def test_empty_actions_not_serialized(pipeline_config: Config):
Expand Down
1 change: 1 addition & 0 deletions valohai_yaml/objs/pipelines/node_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
WELL_KNOWN_THENS = {
"noop", # For testing
"stop-pipeline",
"error-pipeline",
}


Expand Down

0 comments on commit 0b7318f

Please sign in to comment.