Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")

@wild-endeavor wild-endeavor May 22, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because people are used to

@task(container="{{ blah.fqn }}:{{ default.version }}")
   ...

can we make

bar().with_overrides(container_image="{{ blah.fqn }}:{{ default.version }}")

work?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both imageSpec and that work for me.

return "hi"

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