Differential D8684 Diff 40807 examples/docs_snippets/docs_snippets/concepts/dagit/graphql/client_example.py
Changeset View
Changeset View
Standalone View
Standalone View
examples/docs_snippets/docs_snippets/concepts/dagit/graphql/client_example.py
Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | |||||
# start_reload_repo_location_marker | # start_reload_repo_location_marker | ||||
from dagster_graphql import ( | from dagster_graphql import ( | ||||
ReloadRepositoryLocationInfo, | ReloadRepositoryLocationInfo, | ||||
ReloadRepositoryLocationStatus, | ReloadRepositoryLocationStatus, | ||||
) | ) | ||||
reload_info: ReloadRepositoryLocationInfo = client.reload_repository_location(REPO_NAME) | reload_info: ReloadRepositoryLocationInfo = client.reload_repository_location( | ||||
REPO_NAME | |||||
) | |||||
if reload_info.status == ReloadRepositoryLocationStatus.SUCCESS: | if reload_info.status == ReloadRepositoryLocationStatus.SUCCESS: | ||||
do_something_on_success() | do_something_on_success() | ||||
else: | else: | ||||
raise Exception( | raise Exception( | ||||
"Repository location reload failed because of a " | "Repository location reload failed because of a " | ||||
f"{reload_info.failure_type} error: {reload_info.message}" | f"{reload_info.failure_type} error: {reload_info.message}" | ||||
) | ) | ||||
# end_reload_repo_location_marker | # end_reload_repo_location_marker | ||||
# start_shutdown_repo_location_marker | # start_shutdown_repo_location_marker | ||||
from dagster_graphql import ( | from dagster_graphql import ( | ||||
ShutdownRepositoryLocationInfo, | ShutdownRepositoryLocationInfo, | ||||
ShutdownRepositoryLocationStatus, | ShutdownRepositoryLocationStatus, | ||||
) | ) | ||||
shutdown_info: ShutdownRepositoryLocationInfo = client.shutdown_repository_location(REPO_NAME) | shutdown_info: ShutdownRepositoryLocationInfo = ( | ||||
client.shutdown_repository_location(REPO_NAME) | |||||
) | |||||
if shutdown_info.status == ShutdownRepositoryLocationStatus.SUCCESS: | if shutdown_info.status == ShutdownRepositoryLocationStatus.SUCCESS: | ||||
do_something_on_success() | do_something_on_success() | ||||
else: | else: | ||||
raise Exception(f"Repository location shutdown failed: {shutdown_info.message}") | raise Exception( | ||||
f"Repository location shutdown failed: {shutdown_info.message}" | |||||
) | |||||
# end_shutdown_repo_location_marker | # end_shutdown_repo_location_marker |