Skip to content

Commit

Permalink
[Projects] Fix collecting cleanup_ttl/ttl when running workflow f…
Browse files Browse the repository at this point in the history
…rom path (#3669)
  • Loading branch information
yonishelach committed May 30, 2023
1 parent 0123ed7 commit 78f89fa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mlrun/projects/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -2047,9 +2047,9 @@ def run(
else:
workflow_spec = self.spec._workflows[name].copy()
workflow_spec.merge_args(arguments)
workflow_spec.cleanup_ttl = (
cleanup_ttl or ttl or workflow_spec.cleanup_ttl or workflow_spec.ttl
)
workflow_spec.cleanup_ttl = (
cleanup_ttl or ttl or workflow_spec.cleanup_ttl or workflow_spec.ttl
)
workflow_spec.run_local = local

name = f"{self.metadata.name}-{name}" if name else self.metadata.name
Expand Down
27 changes: 27 additions & 0 deletions tests/projects/test_local_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,30 @@ def test_run_pipeline_artifact_path(self):
mlrun.projects.pipeline_context._artifact_path
== f"{generic_path}/{run_status.run_id}"
)

def test_run_pipeline_with_ttl(self):
mlrun.projects.pipeline_context.clear(with_project=True)
self._create_project("localpipettl")
self._set_functions()
workflow_path = str(f"{self.assets_path / self.pipeline_path}")
cleanup_ttl = 1234
run = self.project.run(
"p4",
workflow_path=workflow_path,
workflow_handler="my_pipe",
arguments={"param1": 7},
local=True,
cleanup_ttl=cleanup_ttl,
)
assert run.workflow.cleanup_ttl == cleanup_ttl

self.project.set_workflow("my-workflow", workflow_path=workflow_path)

run = self.project.run(
"my-workflow",
workflow_handler="my_pipe",
arguments={"param1": 7},
local=True,
cleanup_ttl=cleanup_ttl,
)
assert run.workflow.cleanup_ttl == cleanup_ttl

0 comments on commit 78f89fa

Please sign in to comment.