Skip to content

Commit

Permalink
Add support overriding image (#1652)
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Su <pingsutw@apache.org>
  • Loading branch information
pingsutw committed May 24, 2023
1 parent 67b92be commit eafcc82
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flytekit/core/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ def with_overrides(self, *args, **kwargs):
if not isinstance(new_task_config, type(self.flyte_entity._task_config)):
raise ValueError("can't change the type of the task config")
self.flyte_entity._task_config = new_task_config
if "container_image" in kwargs:
self.flyte_entity._container_image = kwargs["container_image"]
return self


Expand Down
13 changes: 13 additions & 0 deletions tests/flytekit/unit/core/test_node_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,3 +452,16 @@ def my_wf(a: str) -> str:
return t1(a=a).with_overrides(task_config=None)

my_wf()


def test_override_image():
@task
def bar():
print("hello")

@workflow
def wf() -> str:
bar().with_overrides(container_image="hello/world")
return "hi"

assert wf.nodes[0].flyte_entity.container_image == "hello/world"

0 comments on commit eafcc82

Please sign in to comment.