Hello, I have a workflow that will request differe...
# ask-the-community
f
Hello, I have a workflow that will request different memory for task depending on the workflow function’s parameter value. e.g. I know below will not work. I just want to illustrate my use case.
Copy code
@workflow
def wf(region: str = 'us') -> None:
       mem = '80Gi' if region == 'us' else '40Gi'
       train(region=region).with_overrides(requests=Resources(mem=mem))  # train() is a task
How can I request dynamic resource values and re-use the same workflow function, so that I don’t have to create separate wf_us() & wf_other_regions(), etc. since I have a lot of tasks in the workflow that will be cut and pasted. (edited)
j
You can use a dynamic task for this to materialize the final DAG with overrides for now. There is also an RFC for config overrides coming.
g
If it only has a few branches, you could also consider using Flytekit conditionals right?
f
@Greg Gydush, conditional works for me. Thanks!
g
Stay tuned for config overrides too like Jeev mentioned!@
159 Views