diff --git a/examples/pipeline-execution-retry-example.yaml b/examples/pipeline-execution-retry-example.yaml new file mode 100644 index 0000000..60e99b4 --- /dev/null +++ b/examples/pipeline-execution-retry-example.yaml @@ -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: [] diff --git a/tests/conftest.py b/tests/conftest.py index 70c82fd..923f3ba 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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") diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index ab34389..283654d 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -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): @@ -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 diff --git a/valohai_yaml/schema/execution-node.yaml b/valohai_yaml/schema/execution-node.yaml index aad42fa..f397e40 100644 --- a/valohai_yaml/schema/execution-node.yaml +++ b/valohai_yaml/schema/execution-node.yaml @@ -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: