Harmen van Rossum
03/19/2023, 6:23 PM.with_overrides(container_image='image:version')
and using a decorator for the task, but both approaches don’t seem to do anything (just the default image is used). What’s the appropriate way to do this? Thanks!Ketan (kumare3)
Samhita Alla
Samhita Alla
with_overrides
, however, is showing the default flytekit image, not the custom one.Samhita Alla
with_overrides
isn't working?Samhita Alla
Slackbot
03/20/2023, 4:25 AMHarmen van Rossum
03/20/2023, 12:13 PMHarmen van Rossum
03/20/2023, 12:54 PM@task(container_image='{{.image.cowsay.fqn}}:{{.image.cowsay.version}}')
def say_hello(name: str):
result = subprocess.run(['cowsay', f'Hello {name}!'], check=True)
print(result.stdout)
@workflow
def wf():
map_task(say_hello, metadata=TaskMetadata(retries=1), concurrency=10)(
name=['a', 'b', 'c']
)
This doesn’t (No such file or directory: ‘cowsay’):
@task(container_image='{{.image.cowsay.fqn}}:{{.image.cowsay.version}}')
def say_hello(name: str):
result = subprocess.run(['cowsay', f'Hello {name}!'], check=True)
print(result.stdout)
@task
def go_say_hello(values: list[str]):
map_task(say_hello, metadata=TaskMetadata(retries=1), concurrency=10)(
name=values
)
@workflow
def wf():
go_say_hello(values=['a', 'b', 'c'])
(This mimics my original problem, it wasn’t clear to me that map_task
should be called from a workflow
.)
Then I tried changing go_say_hello to a workflow (that did work):
@task(container_image='{{.image.cowsay.fqn}}:{{.image.cowsay.version}}')
def say_hello(name: str):
result = subprocess.run(['cowsay', f'Hello {name}!'], check=True)
print(result.stdout)
@workflow
def go_say_hello(values: list[str]):
map_task(say_hello, metadata=TaskMetadata(retries=1), concurrency=10)(
name=values
)
@workflow
def wf():
go_say_hello(values=['a', 'b', 'c'])
Using with_overrides
doesn’t work (No such file or directory: ‘cowsay’):
@task
def say_hello(name: str):
result = subprocess.run(['cowsay', f'Hello {name}!'], check=True)
print(result.stdout)
@workflow
def go_say_hello(values: list[str]):
map_task(say_hello, metadata=TaskMetadata(retries=1), concurrency=10)(
name=values
).with_overrides(container_image='{{.image.cowsay.fqn}}:{{.image.cowsay.version}}')
@workflow
def wf():
go_say_hello(values=['a', 'b', 'c'])
Harmen van Rossum
03/20/2023, 12:56 PMwith_overrides
.
With regards to where map_task should be called from (workflow
vs task
) is that something that should be mentioned in the documentation?Ketan (kumare3)