Hi, I am having trouble trying to supply config to...
# ask-community
d
Hi, I am having trouble trying to supply config to a graph-backed asset. Here's my contrived example again, but with config on the 2nd op ("op2"):
Copy code
@op
def op1():
    return "Some string"


@op(
    config_schema={
        "name": str
    }
)
def op2(context, dummy_str: str):
    print(dummy_str)
    return f"Hello {context.op_config['name']}"


@graph(
    out={
        "asset_from_op2": GraphOut()
    }
)
def test_graph():
    asset_from_op2 = op2(op1())

    return {"asset_from_op2": asset_from_op2}

test_asset = AssetsDefinition.from_graph(test_graph, group_name="test_asset")


@repository
def test_repo():
    return [
        [
            test_asset,
            define_asset_job(
                name="test_asset_job",
                config={
                    "ops": {
                        "test_graph": {
                            "ops": {
                                "op2": {
                                    "config": {
                                        "name": "Daniel"
                                    }
                                }
                            }
                        }
                    }
                }
            ),
        ],
    ]
I run dagit and dagit launches fine. But when I try to materialize this, I get this error:
Copy code
test_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': {'test_graph': {'ops': {'op2': {'config': {'name': '...'}}}}}}
Been struggling trying to nail down what I'm doing wrong with the config entry. Any help appreciated!
j
you don't need to nest into the graph to enter config, you should be good using this:
Copy code
{
  "ops": {
    "op2": {
      "config": {
        "name": "Daniel"
      }
    }
  }
}
if you completely remove the config from
define_asset_job
and then open the launchpad in dagit, there will be a
scaffold missing config
button in the bottom left. You can also click that and it should fill out a valid config for you. then you can copy that back into the
define_asset_job
if you want
d
@jamie That's what I actually had originally and back then it gave me this error message:
Copy code
test_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': {'test_graph': {'ops': {'op2': {'config': {'name': '...'}}}}}}
That's a good tip about removing the config entry! But I'll have to unmaterialize or delete the pickle object to force the scaffolding. It isn't scaffolding anymore I'm guessing because it was materialized earlier.
j
that's odd that it isn't scaffolding. not the behavior i would expect. I'll see if i can replicate. I'll also try replicating the config error. i would expect the config i gave to work for a normal job, but maybe there's something going on when it turns into an asset. I'll get back to you
d
Hmm, strange, so the scaffolding is showing me that I had to double nest:
j
does that config work when you materialize?
d
Yup! So not sure why my code example above is throwing that error.
j
yeah i'm pretty confused now too. working on a replication now
hmmm i think this might be a UI bug. Can you try the following for me? • add the config dict back to
define_asset_job
• open up dagit and reload your repository • go to the job and shift + click on "materialize all" • the launchpad should be empty and the scaffold missing config button should be greyed out • then click "materialize" does that work for you?
d
@jamie Yup, that worked.
j
ok, pretty sure it's a UI bug. I'll raise an issue
🙏 1
d
Sorry, one more quick question. So is the double nested ops entries the "right" or expected config?
j
i agree that double nested "ops" is a bit strange. It is correct though. I'm asking some folks more familiar with graph backed assets if this is intentional or a possible bug
👍 1
d
@jamie Well thank you so much for helping me and for being patient with my wacky contrived examples! I currently don't have access to heavy-weight infra so I am basically learning SDA features via these simple contrived examples that I can come up with.
j
no worries! happy to help out!
❤️ 1