Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support image overriding #1652

Merged
merged 1 commit into from
May 24, 2023
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")
Copy link
Contributor

@wild-endeavor wild-endeavor May 22, 2023

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
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"