Brandon Peebles
03/12/2024, 5:32 AMScout
03/12/2024, 5:32 AMpython from dagster import job, op @op def my_op(): # Your op's logic here pass @job def my_job(): my_op()
In this example, my_op
is defined with the @op
decorator, and my_job
is defined with the @job
decorator, which includes my_op
as part of its execution graph. If you want to execute a specific op within a job, you would directly call that op within the job's definition. If you have multiple ops and want to conditionally execute one of them, you would need to set up the logic within your job definition to determine which op to execute. If you're looking to execute a job from within another job or op, you can use the execute_job
method available on the DagsterInstance
object, which you can access from the context within an op. However, this is not the same as dynamically looking up and executing an op by name. The documentation does not provide an example of dynamically executing an op by name from within a job, as this is not a typical pattern in Dagster. If you need further assistance with a specific use case or pattern, please provide more details, and I'll do my best to help you based on the documentation.