I am using GitHub - PrefectHQ/prefect-shell: Prefect tasks and subflows for interacting with shell commands.
For old shell_run_command
, it has return_all
which can return all lines of stdout as a list.
from prefect_shell import shell_run_command
@flow
def run():
return shell_run_command(command="xxx", return_all=True)
I am wondering what is corresponding one in ShellOperation
?
from prefect_shell import ShellOperation
@task
async def run():
return await ShellOperation(commands=["xxx"]).run()
I am hoping to get all result during streaming like return_all
from shell_run_command
.
The reason I am asking is that this shell command xxx
will return error code 1
(it does not mean fail in this case actually), and shell_run_command
itself is a Prefect task which will always fail. While ShellOperation
has more freedom, I can add try/except
to add my logic to handle so that the task can continue running.
Thanks!