Somewhat new to Dagster, new to software defined a...
# ask-community
o
Somewhat new to Dagster, new to software defined assets. I’m trying to define a simple asset with a parameter and add it to a repository:
Copy code
@asset(config_schema={"some_param": str})
def asset_with_config(context):
    some_param = context.op_config["some_param"]
    return some_param


@repository
def dagster_dags():
    return [
        asset_with_config,
    ]
Dagit starts just fine. As expected, I’m getting an error I try to materialize the asset:
Copy code
__ASSET_JOB cannot be executed with the provided config. Please fix the following errors:

Missing required config entry "ops" at the root. Sample config for missing entry: {'ops': {'asset_with_config': {'config': {'some_param': '...'}}}}
What’s the right way to provide configuration for the asset?
o
hi @Oren Lederman, that code looks correct, so I'm guessing that this is bug in the UI (when an asset requries configuration, a pop-up should show up, prompting you to supply that configuration before the run initiates). What page are you attempting to rematerialize the asset from?
o
workspace -> default (default assets group) -> Materialize all (note - running Dagster 0.15.7)
If I want to automate assets materialization and provide these parameters as configuration, do I need to create an asset job?
o
yeah
define_asset_job
would be the way to do that
o
Something like this?
Copy code
@repository
def dagster_dags():
    return [
        asset_with_config,
        define_asset_job(
            "asset_with_config_job",
            selection=["asset_with_config"],
            description="Job to materialize asset_with_config",
            config={"ops": {"asset_with_config": {"config": {"some_param": "..."}}}},
        ),
    ]
When I try to materialize it from the job window, I’m getting the following error:
o
got it, thanks! ok for your original issue, I still believe this to be a bug that the popup didn't automatically prompt you for config (cc @sean), but if you press shift while clicking the materialize button, then you will get the option to add config.
for the second thing (the config not being used when defining your job), this is a more subtle issue, which I'll make an issue for in a sec.
basically, the "materialize all" button is not a "run job" button. It basically just means "do the same materialization process that you would do for these assets if you saw them on any other page". so the config on the job itself is not used (at least this is my guess, it'll require a bit more digging)
however, I believe if you went to the launchpad and hit the launch execution button, then the config would be correctly supplied
similarly, if you ran this job on a schedule, the config would be used in those invocations
this is very confusing behavior though, so I'll make an issue to track it
o
Thanks @owen! I’m still trying to wrap my mind around the different parts of Dagster. In the past, I’ve used
dagster run
and provided the configuration in the cli. In my new project, I’m planning to use Dagit/Dagster Cloud so I’m trying to understand how scheduler, assets, and environment-specific configuration work together. It’s slowly starting to make sense
o
no problem -- let me know if I can help with anything else 🙂. I created an issue for that job thing here: https://github.com/dagster-io/dagster/issues/9109