Hi team! I need to write an `op` that will reload ...
# ask-community
Hi team! I need to write an
that will reload all of dagster’s definitions through the API. Does any one have an idea on how to do this? The idea here is to have my definitions reloaded after a dbt manifest changed.
Hmm, so I wouldn't recommend it through an Op, because that means Dagster would be trying to modify itself while it's running. What I'd recommend is triggering the GraphQL API to refresh the workspace when your manifest gets updated (ex. during the CD pipeline). Here's some sample code of how you can trigger it
@Tim Castillo, couldn’t I use
and call the
method? I’m doing something like this:
Copy code
@resource(config_schema={"GRAPHQL_ENDPOINT": StringSource})
def graphql_resource(context):
    Resource used to create a graphql client.

    Required config resource:



    return DagsterGraphQLClient(hostname=context.resource_config["GRAPHQL_ENDPOINT"], use_https=True)

@op(required_resource_keys={"graphql"}, description="Reload repository definitions")
def reload_definitions(context):
    graphql_client = context.resources.graphql
    return graphql_client.reload_repository_location(

    resource_defs={"graphql": graphql_resource},
    description="Reload repository definitions job",
    config={"resources": {"graphql": {"config": {"GRAPHQL_ENDPOINT": {"env": "GRAPHQL_ENDPOINT"}}}}},
def reload_definitions_job():
But I’m getting the following error
Hmm, haven't tried from within an op because I didn't expect it to work. Though I feel like your error is more graphql-specific than Dagster specific. Rationale about why to trigger the reload outside of Dagster is because it's like swapping the engine of a car while driving it. When reloading, Dagster has to stop and rebuild itself, which might not work or cause some really funky behavior if you're triggering it from within Dagster.
What's your process like for building that dbt manifest?
yeah, this is the full error
I’m using
to generate the manifest, but that’s in a different job.
@Tim Castillo, any ideas on why I would be getting this “javascript not supported in your browser” error?
Ah, yeah, I believe the
isn't made to be used within Dagster, but supposed to be a wrapper around common queries that people run outside of Dagster.