If I run it as a python program, I got: ```in wf()...
# ask-the-community
f
If I run it as a python program, I got:
Copy code
in wf() team: abc
in wf() a: 3
in t1() team: abc_3
in t1() a: 3
result from wf(): ('abc_3', 3)
k
this is odd
why are they promises? cc @Yee just talking
g
Ran into similar behavior when trying to call
.with_overrides
on a task in a workflow using parameters passed to the workflow. Example:
Copy code
@workflow
def test_workflow(mem: str, cpu: float) -> None:
    test_task().with_overrides(
        requests=Resources(cpu=cpu, mem=mem),
        limits=Resources(cpu=cpu, mem=mem),
    )
Wrapping test_task in a dynamic works, but wondering if there’s an alternative
f
@Greg Gydush, I think if you pass cpu as input param to the task it will work.
Copy code
@workflow
def test_workflow(mem: str, cpu: float) -> None:
    test_task(cpu=cpu, mem=mem).with_overrides(
        requests=Resources(cpu=cpu, mem=mem),
g
Copy code
File "/fn/lib/venv/lib/python3.10/site-packages/flytekit/models/task.py", line 56, in to_flyte_idl
    return _core_task.Resources.ResourceEntry(name=self.name, value=self.value)
TypeError: Promise(node:.mem) has type Promise, but expected one of: bytes, unicode
make: *** [flyte-register] Error 1
Still the same issue - it looks like all workflow parameters are Promises, and
with_overrides
is not expecting that
f
Oh, my mistake.
Copy code
.with_overrides() is not inside the task function.
Of course.
101 Views