cuddly-jelly-27016
05/28/2025, 12:10 AMelse().then() statement the condition immediately fails. As an end-user, I expect to have the else statement be optional.
### Expected behavior
See the code snippet below, but ideally Flyte conditionals will function without an else statement.
### Additional context to reproduce
Using this code:
@task
def coin_toss(seed: int) -> bool:
"""
Mimic a condition to verify the successful execution of an operation
"""
r = random.Random(seed)
if r.random() < 0.5:
return True
return False
@task
def failed() -> int:
"""
Mimic a task that handles failure
"""
return -1
@task
def success() -> int:
"""
Mimic a task that handles success
"""
return 0
@workflow
def boolean_wf(seed: int = 5) -> int:
result = coin_toss(seed=seed)
return conditional("coin_toss").if_(result.is_true()).then(success())
### Screenshots
No response
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flytecuddly-jelly-27016
05/28/2025, 12:10 AM