Shane Keller
03/05/2024, 11:28 PMScout
03/05/2024, 11:28 PM@op
decorator to define your op function. Inside the function, you can access the input value which could be provided by an upstream op or by the config. 3. When defining the job that includes this op, you can either connect it to an upstream op that provides the necessary input or provide a config value for the input. Here's an example based on the documentation: python from dagster import op, In, job # Define an op with an input that has a default value @op(ins={"input_param": In(default_value="default")}) def my_op(input_param): # The op can use the input_param which could be from an upstream op or config pass # Define a job that includes the op @job def my_job(): # You can connect my_op to an upstream op that provides input_param # or provide a config value for input_param when executing the job my_op()
When executing the job, you can provide a config for input_param
if there is no upstream op connected to `my_op`: python my_job.execute_in_process( run_config={ "ops": { "my_op": { "inputs": { "input_param": "configured value" } } } } )
If there is an upstream op that provides the input_param
, you would connect it in the job definition, and the value from the upstream op would be used instead of the config. This approach allows you to design flexible ops that can receive parameters from different sources, making your data pipelines more adaptable to various scenarios.