Matt Delacour
09/26/2022, 3:38 PMshell_task = ShellTask(
log_stdout=True,
log_stderr=True,
stream_output=True,
)
with Flow(
"model_on_demand",
) as flow:
select = Parameter("select", required=True)
shell_task(command=f"echo '{select}'")
Bianca Hoch
09/26/2022, 4:21 PMMatt Delacour
09/26/2022, 4:44 PMrun()
the Parameter (which is a Task)
But it's not recognized as an "input" so I cannot trigger the flow with different values of the Parameter in the Web UI
So I don't believe that this is a good solution. Maybe I don't understand itBianca Hoch
09/26/2022, 9:11 PMshell_task = ShellTask(
log_stdout=True,
log_stderr=True,
stream_output=True,
)
@task
def generate_command(select):
return f"echo '{select}'"
with Flow(
"model_on_demand",
) as flow:
select = Parameter("select", required=True)
shell_task(command=generate_command(select))
The string for the command needs to be set within a task. It can't be set within the with Flow(…)
block because nothing has values at that point.Matt Delacour
09/27/2022, 4:54 PMShellTask
but not for DbtShellTask
which is a child of it ...
class DbtShellTask(ShellTask):
pass
🤔@task
def generate_command(select: str) -> str:
return f"--select {select}"
with Flow(
"model_on_demand",
) as dbt_flow:
# Models to run on demand
select = Parameter("select", required=True)
shell_task(command=f"echo 'HELLO {generate_command(select=select)}'")