cuddly-jelly-27016
05/14/2025, 12:13 AM_if
in the condition
must be a promise, and can't use a native python type in the if statement.
@dynamic
def d1() -> bool:
a = t1()
return (
conditional("train_estimator")
.if_(a==True)
.then(t2())
.else_()
.then(t2()))
@dynamic
def d1(a: bool) -> bool:
return (
conditional("train_estimator")
.if_(a==True) # <- failed because the a isn't a promise
.then(t2())
.else_()
.then(t2()))
### Goal: What should the final outcome look like, ideally?
Both promise and native python types should be supported in the conditions
### Describe alternatives you've considered
Users must create a task to convert it to a promise and use it in the conditions.
@task
def convert_to_promise(a: bool) -> bool:
return a
### Propose: Link/Inline OR Additional context
https://flyte-org.slack.com/archives/CREL4QVAQ/p1666110935856779
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flytecuddly-jelly-27016
05/14/2025, 12:13 AM