https://prefect.io logo
Title
b

Bob Colner

05/22/2022, 7:23 PM
question about
shell_run_command
in orion. I’m not able to pass a
retries
parameter to the task.
TypeError: got an unexpected keyword argument 'retries'
any ideas?
config_ssh_rsync_f = shell_run_command(
        retries = 3, 
        retry_delay_seconds = 10, 
        command = "ls", 
        return_all = True, 
        wait_for = [spinup_databox_f], 
    )
the above is inside my @flow function of course
a

Anna Geller

05/22/2022, 7:31 PM
try this syntax:
from prefect import flow
from prefect_shell import shell_run_command


@flow
def example_shell_run_command_flow():
    return shell_run_command.with_options(retries=5)(command="ls .", return_all=True)


if __name__ == "__main__":
    example_shell_run_command_flow()
or with more task-args like delay:
from prefect import flow
from prefect_shell import shell_run_command


@flow
def example_shell_run_command_flow():
    return shell_run_command.with_options(retries=5, retry_delay_seconds=30)(
        command="ls .", return_all=True
    )


if __name__ == "__main__":
    example_shell_run_command_flow()
b

Bob Colner

05/22/2022, 7:48 PM
thanks for the magic syntax -that worked
👍 1