gifted-house-14547
10/31/2022, 4:25 AMPromise object
of task's return values.
from flytekit import workflow, task, dynamic, conditional
from flytekit.core.promise import Promise
@task
def t1() -> bool:
return True
@task
def t2() -> bool:
return False
@workflow
def wf() -> bool:
test = t1()
print(test)
return t2()
if __name__ == "__main__":
print(wf())
when I run this sample codes through pyflyte
, a task returns Promise object
, and literal or objects I expect are wrapped in Promise
.
So, here is my question, how I unwrap this promise object? I would like to use the expected value from the function.
Thank you!tall-lock-23197
gifted-house-14547
10/31/2022, 4:29 AMPromise(node:n0.o0)
Resolved(o0=scalar {
primitive {
boolean: true
}
}
)
freezing-airport-6809
freezing-airport-6809
gifted-house-14547
10/31/2022, 4:54 AMfrom flytekit import workflow, task, dynamic, conditional
from flytekit.core.promise import Promise
@task
def t1() -> bool:
validation(return_value)
return True
@task
def t2(a:bool) -> bool:
print(a)
return False
@workflow
def wf() -> bool:
test = t1()
# print(test)
return t2(a=test)
if __name__ == "__main__":
print(wf())
tall-lock-23197
gifted-house-14547
10/31/2022, 5:05 AMtall-lock-23197
freezing-airport-6809
@dynamic
, but it is still limited to the inputs to a dynamic task.