Is there a way to name a `shell_op`?
# ask-community
s
Is there a way to name a
shell_op
?
🤖 1
s
@Shriram Holla What is a
shell_op
? I haven't come across that before.
s
s
Right. I notice that there is some documentation for
dagster_shell.create_shell_command_op
which takes a
name
parameter. https://docs.dagster.io/_apidocs/libraries/dagster-shell Is that what you're after?
s
I was going to do that initially but my shell command is created dynamically and I want the name to be dynamic too.
create_shell_command_op
doesn’t allow me to set it dynamically
s
I use a factory pattern to generate some of my ops, which allows the
name
and
description
to be dynamic.
Copy code
def some_op(type: str):
    @op(name=f"some_op_{type}")
    def _some_op(context):
        # do some stuff here
    return _some_op
Copy code
@job
def some_job():
    some_op("special_type")()
Maybe you could use a similar pattern to get the flixibility you need when generating your shell ops.
s
oh wow this is very useful. Thanks!
👍 1