Rahul Mehta10/18/2022, 4:35 PM
step or should normal python control flow work there? We're seeing a number of issues w/ failing to bind variables in a dynamic workflow using normal `if`/`else` blocks
supported within dynamic workflows?
Kevin Su10/18/2022, 4:47 PM
Rahul Mehta10/18/2022, 4:51 PM
is a boolean)
Logical (and/or/is/not) operations are not supported. Expressions Comparison (<,<=,>,>=,==,!=) or Conjunction (&/|) are supported.Received an evaluated expression with val False in train_estimator.if_
flytekit.conditional("train_estimator") .if_(regress) .then( estimator.train_regressor() ) .else_() .then( estimator.train_classifier() )
? (I also tried
as well and that resulted in the same error)
regress == True
Kevin Su10/18/2022, 8:41 PM
from flytekit import workflow, task, dynamic, conditional @task def t1() -> bool: return True @task def t2() -> bool: return False @dynamic def d1() -> bool: a = t1() return ( conditional("train_estimator") .if_(a==True) .then(t2()) .else_() .then(t2())) @workflow def wf() -> bool: return d1() if __name__ == "__main__": print(wf())
Rahul Mehta10/18/2022, 8:41 PM
is an arg to
vs the result of a task?
Kevin Su10/18/2022, 8:42 PM
regress == True
. Otherwise, it will fail
does this work iflet me try it.is an arg to
avs the result of a task?
is bool instead of promise.
in the if statement must be a promise
Rahul Mehta10/18/2022, 8:49 PM
Kevin Su10/18/2022, 9:15 PM
@task def convert_to_promise(a: bool) -> bool: return a
Or maybe another way, is there a reason preventing this from working w/ both promises and literalsI think we can support pure python type in
as well. we can try to update it in the next release. For now, to work around this issue, just create a @task to convert it to a promise, sorry.
? currently, we can only use promise in condition.
Rahul Mehta10/18/2022, 10:05 PM