https://dagster.io/ logo
Title
d

Dusty Shapiro

11/10/2022, 8:46 PM
Simple Q: How do I define the relationship between two ops, especially if I am only defining one op (other is imported from dagster_dbt). For example:
@op
def upload_docs_to_s3():
    foo

@job
def dbt_cli_docs():
    dbt_docs_generate_op()
    upload_docs_to_s3()
In this case, both ops try to run at the same time. In any case, is there a simple way to set relationship of ops in general? Like:
op1 >> op2 >> op3
n

nickvazz

11/10/2022, 8:53 PM
Maybe with a graph?
from the docs here
from dagster import graph, op


@op
def return_one(context) -> int:
    return 1


@op
def add_one(context, number: int):
    return number + 1


@op
def adder(context, a: int, b: int) -> int:
    return a + b


@graph
def inputs_and_outputs():
    value = return_one()
    a = add_one(value)
    b = add_one(value)
    adder(a, b)
y

yuhan

11/10/2022, 9:06 PM
If you’re explicitly looking for defining task dependencies (there’s no data flowing between two ops and you just want to specify the order to run the ops), you can find it as Nothing Dependency: https://docs.dagster.io/concepts/ops-jobs-graphs/graphs#defining-nothing-dependencies
d

Dusty Shapiro

11/10/2022, 9:09 PM
Thanks @yuhan. There are not sharing data, so I’ll give that a shot
Can a graph be passed into a
ScheduleDefinition
like a job?
also, it seems that I can’t pass a resource definition to a graph?
y

yuhan

11/10/2022, 9:25 PM
you don’t necessarily need it to be a graph. jobs work exactly the same way. I.e. it can be a
@job
👍 1