https://dagster.io/ logo
Title
u

马钰鹏

01/29/2023, 9:40 AM
In dagster, I have defined two operations, op1 and op2. In op1, I have computed a certain piece of data and I want to save it to the context. Then, in op2, I want to retrieve that data from the context. How can I do this?
c

Casper Weiss Bang

01/29/2023, 7:59 PM
I think you are looking for #dagster-support
u

马钰鹏

01/30/2023, 2:25 AM
Sorry, I will seek help in the dagster-support channel.
j

jamie

01/30/2023, 3:30 PM
Hi, you don’t need to save the output to the context. Dagster works a lot like python in that you can return values from ops and pass them to other ops
from dagster import job, op


@op
def return_five():
    return 5


@op
def add_one(arg):
    return arg + 1


@job
def do_stuff():
    add_one(return_five())