https://dagster.io/ logo
#random
Title
i

Isy

02/14/2022, 8:20 AM
Hi! I'm really new to dagster and I'm trying to use dagster-shell. could anyone point me to an example on how to use the shell_op? Thanks!!
m

Mike

02/14/2022, 11:15 AM
Did you see the examples in the API docs? https://docs.dagster.io/_apidocs/libraries/dagster-shell#apis
i

Isy

02/14/2022, 12:43 PM
Yes and this is working fine, but this is using the create_shell_command_op. In the explenation it is written that in case one wants to generate commands dynamically one should use the shell_op, but there is no example for that.
m

Mike

02/14/2022, 3:41 PM
Copy code
from dagster import job, op
from dagster_shell import shell_op

@op
def shell_greeting():
    return 'echo "this is a test message"'

@op
def show_output(msg):
    print("The output was: " + msg)

@job()
def shell_hello_job():
    show_output(shell_op(shell_greeting()))

if __name__ == "__main__":
    result = shell_hello_job.execute_in_process()
i

Isy

02/14/2022, 3:43 PM
Thanks a lot!!!
m

Mike

02/14/2022, 3:45 PM
i

Isy

02/15/2022, 9:46 AM
Thanks for your replay, it was really helpful!