Skip to content

Commit

Permalink
Add a test for ErrorAction.RETRY on execution nodes
Browse files Browse the repository at this point in the history
Follows up on #154
  • Loading branch information
akx committed Oct 7, 2024
1 parent d87f9bb commit 69dc3e9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
13 changes: 13 additions & 0 deletions examples/pipeline-execution-retry-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- step:
name: process
image: python:3.12
command:
- python ./preprocess.py
- pipeline:
name: pipe
nodes:
- name: process
step: process
type: execution
on-error: retry
edges: []
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
timeouts_config = config_fixture("timeouts-example.yaml")
edge_merge_mode_config = config_fixture("edge-merge-mode.yaml")
keep_order_config = config_fixture("keep-order.yaml")
pipeline_with_retried_execution_config = config_fixture("pipeline-execution-retry-example.yaml")
6 changes: 6 additions & 0 deletions tests/test_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from tests.utils import get_warning_example_path
from valohai_yaml.lint import lint_file
from valohai_yaml.objs import Config, DeploymentNode, ExecutionNode
from valohai_yaml.objs.pipelines.node import ErrorAction


def test_pipeline_valid(pipeline_config: Config):
Expand Down Expand Up @@ -112,3 +113,8 @@ def test_pipeline_allow_reuse(pipeline_config: Config):
pl2 = pipeline_config.pipelines["My medium pipeline"]
assert pl.reuse_executions is True
assert pl2.reuse_executions is False


def test_pipeline_execution_retry(pipeline_with_retried_execution_config: Config):
assert pipeline_with_retried_execution_config.lint().is_valid()
assert pipeline_with_retried_execution_config.pipelines["pipe"].nodes[0].on_error == ErrorAction.RETRY
2 changes: 1 addition & 1 deletion valohai_yaml/schema/execution-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ properties:
type: string
on-error:
type: string
enum: ["stop-all", "stop-next", "continue"]
enum: ["stop-all", "stop-next", "continue", "retry"]
actions:
type: array
items:
Expand Down

0 comments on commit 69dc3e9

Please sign in to comment.