Nizar Hattab
05/20/2024, 12:14 PMunsupported operand type(s) for >>: 'Condition' and 'Condition'
is it supported? am I not completing the conditional statement?
code:
@workflow
def wf(
run_task_1: bool,
run_task_2: bool
):
task1_output = (
conditional("task_one_condition")
.if_(run_task_1.is_true())
.then(
run_task_one()
)
)
task2_output = (
conditional("task_two_condition")
.if_(run_task_2.is_true())
.then(
run_task_two()
)
)
task1_output >> task2_output
Garret Cook
05/20/2024, 5:20 PMGarret Cook
05/20/2024, 5:20 PMGarret Cook
05/20/2024, 5:20 PMconditional
statement in Flyte is expected to be complete, meaning that all possible branches must be accounted for."Ketan (kumare3)
.fail
no need of throwaway task.
The idea is the conditional's have to be complete and always returnGarret Cook
05/20/2024, 10:44 PMKetan (kumare3)
Nizar Hattab
05/21/2024, 1:32 AMKetan (kumare3)
Ketan (kumare3)
Nizar Hattab
05/21/2024, 1:41 AMNizar Hattab
05/21/2024, 1:49 AMKetan (kumare3)
Ketan (kumare3)
Ketan (kumare3)
Ketan (kumare3)
Nizar Hattab
05/21/2024, 2:44 AMtask1_output = (
conditional("task_one_condition")
.if_(run_task_1.is_true())
.then(
run_task_one()
)
.end() #
)
Nizar Hattab
05/21/2024, 2:44 AMKetan (kumare3)
Ketan (kumare3)
Ketan (kumare3)
Ketan (kumare3)
Ketan (kumare3)
Nizar Hattab
05/21/2024, 2:47 AMKetan (kumare3)
Nizar Hattab
05/21/2024, 2:48 AMKetan (kumare3)
Nizar Hattab
05/21/2024, 2:52 AMKetan (kumare3)
value
return. Can you open an issue to support None or echo tasks as defaults in flyte backend. This is some work, but pretty simpleKetan (kumare3)
Samhita Alla
Ketan (kumare3)
Ketan (kumare3)
Ketan (kumare3)
Yubo Wang
05/24/2024, 8:54 PMKetan (kumare3)
Ketan (kumare3)
Yubo Wang
06/04/2024, 8:03 PMfrom typing import Dict, Type, Optional
from flytekit.core.base_task import PythonTask
from flytekit.core.interface import Interface
class EchoTask(PythonTask):
"""
This is the simplest form of an Echo Task, that can be used even for tasks that do not produce any output.
Requires task name, inputs is optional and defaulted to None
"""
_TASK_TYPE = "echo"
def __init__(
self,
name: str,
inputs: Optional[Dict[str, Type]] = None,
**kwargs,
):
"""
To be used to run echo job. In order to skip the node, set given inputs as the inputs and
given inputs as the outputs.
"""
super().__init__(
name=name,
task_config=None,
inputs=inputs,
interface=Interface(inputs=inputs, outputs=inputs),
task_type=self._TASK_TYPE,
**kwargs
)
then, you use it as, basically your inputs and outputs will share the same signature
@workflow
def wf(isRunning: bool):
task = EchoTask(name="skip",inputs={"a": str})
return(
conditional("skip")
.if_(isRunning.is_true())
.then(task(a="1"))
.else_().then(task(a="2"))
)
Not sure if this is something oss wanted.