[Core feature] Add support native python type in the condition task
Motivation: Why do you think this is important?
For now, The variable in the _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?
- [X] Yes
Have you read the Code of Conduct?
- [X] Yes
Hello 👋, This issue has been inactive for over 9 months. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will close the issue if we detect no activity in the next 7 days. Thank you for your contribution and understanding! 🙏
Hello 👋, This issue has been inactive for over 9 months and hasn't received any updates since it was marked as stale. We'll be closing this issue for now, but if you believe this issue is still relevant, please feel free to reopen it. Thank you for your contribution and understanding! 🙏
In dynamic you do not need to use a conditional. It's not a promise so simply use a regular python if else block
Hello 👋, this issue has been inactive for over 9 months. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will engage on it to decide if it is still applicable. Thank you for your contribution and understanding! 🙏
Hello 👋, This issue has been inactive for over 9 months and hasn't received any updates since it was marked as stale. We'll be closing this issue for now, but if you believe this issue is still relevant, please feel free to reopen it. Thank you for your contribution and understanding! 🙏