Would it be a good practice to build the ops in a ...
# ask-community
i
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
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
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
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.
Copy code
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