Roel Hogervorst
01/07/2022, 12:40 PMproduction_job = graphname.to_job(
config= {"ops": {"op1":{"inputs":{"arg1":"bla", "ar2":"bla"}},
{"op2":{"inputs":{"arg1: "something"}
})
But that doesn't work. It does work for 1 op, but I get unexpected config entry
. I tried a list in stead of 2 dictionaries. But that is also not allowed.
What is the best way to pass the arguments to the ops from the job?Alex Service
01/07/2022, 1:45 PMarg1
and arg2
?ar2
😛Roel Hogervorst
01/07/2022, 1:46 PMconfig = {'ops':{'op1':{'config':{'arg1':'arg'}},{'op2':{'config':{'arg2':'arg'}}
I am able to supply these things with a yaml config in dagit. So something is wrongAlex Service
01/07/2022, 1:47 PMRoel Hogervorst
01/07/2022, 1:47 PMAlex Service
01/07/2022, 1:49 PM@repository
functionRoel Hogervorst
01/07/2022, 1:50 PMAlex Service
01/07/2022, 1:52 PMops:
load_data:
inputs:
file_paths:
- "source/path/example"
save_to_lake:
inputs:
project: myproject
table: example_table
Roel Hogervorst
01/07/2022, 1:53 PMAlex Service
01/07/2022, 1:56 PMfrom dagster.utils.yaml_utils import load_yaml_from_path
and then just point the job definition to the loaded yaml, seems to work reasonably enoughmy_job = graph_func.to_job(name='My Cool Job',
resource_defs={'a_resource': make_values_resource()},
config=configs['my_job_config'])
where my_job_config
has the example I gave aboveRoel Hogervorst
01/07/2022, 2:10 PMAlex Service
01/07/2022, 2:14 PMRoel Hogervorst
01/07/2022, 2:17 PMAlex Service
01/07/2022, 2:19 PMyaml.safe_load
under the hood:
def load_yaml_from_path(path):
check.str_param(path, "path")
with open(path, "r") as ff:
return yaml.safe_load(ff)
Roel Hogervorst
01/07/2022, 2:34 PMops:
ops1:
config:
filename: file1.csv
filepath: dagster-test/file1.csv
ops2:
config:
filepath: dagster-test/output/file2.csv
However that yaml transformed (with load yaml from path) into a dictionary is invalid and dagit refuses to load it.
{'ops' {'ops1': {'config': {'filename': 'file1.csv', 'filepath':'filepath'}}, 'ops2':{'config':{'filepath':'filepath2'}} }}
Alex Service
01/07/2022, 3:40 PM