https://dagster.io/ logo
Title
i

Ignas Kizelevičius

04/18/2023, 10:11 AM
Would it be a good practice to build the ops in a job? E.g. I have a yaml file which represents job graph structure, so I would read the yaml file in a @job and build the ops and their dependencies.
o

owen

04/18/2023, 5:05 PM
hi @Ignas Kizelevičius! this pattern is definitely supported, and I'd consider it good practice as long as yaml remains an ergonomic source of truth for your dependencies -- here's an example showing how to translate from yaml to dagster graphs: https://docs.dagster.io/concepts/ops-jobs-graphs/graphs#using-yaml-graphdsl
i

Ignas Kizelevičius

04/18/2023, 6:22 PM
thanks owen
Hi @owen, continuing the same question, what would be the best way to build multiple jobs of same structure but using a different yaml file? I tried accomplishing this using graph but I can't find a way to pass a static parameter (e.g. yaml file name) to the graph.
o

owen

04/21/2023, 6:19 PM
you can't directly pass a parameter like that to a graph, but it sounds like you could create a function that returns a graph, i.e.
def make_graph(yaml_filename):
    # construct graph based on yaml...
    my_graph = ...
    return my_graph
from there, you can call make_graph with multiple different yaml files