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?

1

1 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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.