https://dagster.io/ logo
#ask-ai
Title
# ask-ai
m

Martin Laurent

02/22/2024, 2:24 PM
Give me an example of an op that returns 2 different outputs at the same time with different types
s

Scout

02/22/2024, 2:24 PM
Certainly! Here's an example from the documentation where an op is defined with multiple outputs of different types:
Copy code
python from dagster import op, Out from typing import Tuple  @op(out={"int_output": Out(), "str_output": Out()}) def my_multiple_output_op() -> Tuple[int, str]:     return (5, "foo")
In this example, the
my_multiple_output_op
op is defined with two outputs:
int_output
and
str_output
. The op returns a tuple with two elements, where the first element is an integer and the second is a string. The outputs are expected to follow the order they are specified in the op's
out
dictionary, so the
int
output corresponds to
int_output
, and the
str
output corresponds to
str_output
.
3 Views