Dennis Gera
04/28/2023, 3:14 PMop
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.Tim Castillo
04/28/2023, 3:49 PMDennis Gera
04/28/2023, 4:43 PMdagster_graphql.DagsterGraphQLClient
and call the reload_repository_location
method? I’m doing something like this:
@resource(config_schema={"GRAPHQL_ENDPOINT": StringSource})
def graphql_resource(context):
"""
Resource used to create a graphql client.
Required config resource:
"graphql":{
"config":{
"GRAPHQL_ENDPOINT":{
"env":"GRAPHQL_ENDPOINT"
}
}
}
"""
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(
repository_location_name="my-repo-name",
)
@job(
resource_defs={"graphql": graphql_resource},
description="Reload repository definitions job",
config={"resources": {"graphql": {"config": {"GRAPHQL_ENDPOINT": {"env": "GRAPHQL_ENDPOINT"}}}}},
)
def reload_definitions_job():
reload_definitions()
Dennis Gera
04/28/2023, 4:44 PMTim Castillo
04/28/2023, 6:27 PMTim Castillo
04/28/2023, 6:27 PMDennis Gera
04/28/2023, 8:04 PMDennis Gera
04/28/2023, 8:05 PMdbt_docs_generate_op
to generate the manifest, but that’s in a different job.Dennis Gera
04/28/2023, 8:56 PMTim Castillo
04/28/2023, 9:03 PMDagsterGraphQLClient
isn't made to be used within Dagster, but supposed to be a wrapper around common queries that people run outside of Dagster.