Changeset View
Changeset View
Standalone View
Standalone View
docs/content/concepts/dagit/graphql-client.mdx
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | |||||
This reloads all repositories in that repository location. This is useful in a variety of contexts, including refreshing Dagit without restarting the server. Example usage is as follows: | This reloads all repositories in that repository location. This is useful in a variety of contexts, including refreshing Dagit without restarting the server. Example usage is as follows: | ||||
```python file=/concepts/dagit/graphql/client_example.py startafter=start_reload_repo_location_marker endbefore=end_reload_repo_location_marker | ```python file=/concepts/dagit/graphql/client_example.py startafter=start_reload_repo_location_marker endbefore=end_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}" | ||||
) | ) | ||||
``` | ``` | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
Example usage: | Example usage: | ||||
```python file=/concepts/dagit/graphql/client_example.py startafter=start_shutdown_repo_location_marker endbefore=end_shutdown_repo_location_marker | ```python file=/concepts/dagit/graphql/client_example.py startafter=start_shutdown_repo_location_marker endbefore=end_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}" | |||||
) | |||||
``` | ``` | ||||
#### Repository Location and Repository Inference | #### Repository Location and Repository Inference | ||||
Note that specifying the repository location name and repository name are not always necessary; the GraphQL client will infer the repository name and repository location name if the pipeline name is unique. | Note that specifying the repository location name and repository name are not always necessary; the GraphQL client will infer the repository name and repository location name if the pipeline name is unique. | ||||
```python file=/concepts/dagit/graphql/client_example.py startafter=start_submit_marker_pipeline_name_only endbefore=end_submit_marker_pipeline_name_only | ```python file=/concepts/dagit/graphql/client_example.py startafter=start_submit_marker_pipeline_name_only endbefore=end_submit_marker_pipeline_name_only | ||||
from dagster_graphql import DagsterGraphQLClientError | from dagster_graphql import DagsterGraphQLClientError | ||||
Show All 12 Lines |