I am trying to programmatically kick off a Dagster job from my Python code. So far I am all set with using the python client to kick off a job with either the default or fully specified config.
The issue I am running into is not having the ability to ask Dagster what the config schema is. Is there a way to import the schema over API so that I don't need to hardcode it in?
11 Answer
If you're trying to retrieve the config values you can use the following within the op/asset/resource definitions:
For an op or asset: context.op_config["<config_name>"]
Example for an @op:
@op(config_schema={"person_name": str}) def op_using_config(context): return f'hello {context.op_config["person_name"]}' For a resources: context.resource_config["<config_name>"]
If you're looking to define the config values, you can do it in 3 ways; via Python code or via a YAML file. You can check the official docs on it.