How to add a name to shell_run_command

Hi all,
I’m using shell tasks a lot in my flows and in Prefect 1 I was able to use:

ShellTask(name="List dir", command="ls -l", helper_script=f"cd {work_dir}", stream_output=True, return_all=True)

In Prefect 2, I use:

shell_run_command(command="ls -l", helper_command=f"cd {work_dir}", return_all=True)

I do not now how to assign a name to the shell task though. It would make reading in logs and graphs easier for me, because without it I get just generic:

Executing 'shell_run_command-7398b6ba-0' immediately...

Thanks in advance.

1 Like

try .with_options():

shell_run_command.with_options(name="custom_name")(command="ls -l", helper_command=f"cd {work_dir}", return_all=True)
1 Like