https://dagster.io/ logo
#ask-community
Title
# ask-community
a

Alexander Whillas

07/20/2022, 10:39 PM
Can `@op`s be generators?
o

owen

07/20/2022, 11:53 PM
hi @Alexander Whillas! ops can be generators, although anything yielded from the op will need to be a valid Dagster event type (listed here). For example, if you have multiple outputs you want to yield from the body of your op, that would look like:
Copy code
from dagster import Output, op


@op(out={"out1": Out(str), "out2": Out(int)})
def my_op_yields():
    yield Output(5, output_name="out2")
    yield Output("foo", output_name="out1")
(example taken from here)
👍 1
a

Alexander Whillas

07/21/2022, 1:02 AM
thanks mate