https://dagster.io/ logo
#ask-ai
Title
# ask-ai
s

Steven Schmatz

02/23/2024, 1:05 AM
@Scout Write a GraphQL query where I can fetch the assets of a run by run ID, and see the progress of the materializations of each asset
s

Scout

02/23/2024, 1:05 AM
To fetch the assets of a run by run ID and see the progress of the materializations of each asset, you would typically use the GraphQL API provided by Dagster. However, the documentation does not provide a direct example of a GraphQL query that fetches the assets of a run by run ID along with the progress of their materializations. The closest example in the documentation is related to terminating an in-progress run, which demonstrates how to use a run ID in a GraphQL mutation. Here is the example mutation for terminating a run:
Copy code
graphql mutation TerminateRun($runId: String!) {   terminateRun(runId: $runId){     __typename     ... on TerminateRunSuccess{       run {         runId       }     }     ... on TerminateRunFailure {       message     }     ... on RunNotFoundError {       runId     }     ... on PythonError {       message       stack     }   } }
This example shows the structure of a GraphQL operation using a run ID, but it does not cover fetching assets or their materialization progress. For your specific use case, you would need to construct a query that retrieves asset materialization events for a given run ID. The documentation does not provide a direct query for this, but based on the general structure of GraphQL and the available operations in the Dagster GraphQL schema, a hypothetical query might look something like this:
Copy code
graphql query GetAssetsForRun($runId: String!) {   runOrError(runId: $runId) {     __typename     ... on Run {       runId       assetMaterializations {         assetKey {           path         }         materializationEvent {           eventTime           stepKey           ... on Materialization {             label             description             metadataEntries {               ... on EventTextMetadataEntry {                 text               }               ... on EventJsonMetadataEntry {                 jsonString               }               ... on EventUrlMetadataEntry {                 url               }               # Include other metadata entry types as needed             }           }         }       }     }     ... on RunNotFoundError {       runId     }   } }
Please note that the above query is hypothetical and may not match the exact schema provided by Dagster. You would need to refer to the actual GraphQL schema documentation or use a GraphQL playground to explore the schema and construct a valid query based on the available types and fields. If you need to find the exact query that matches your requirements, I recommend exploring the GraphQL schema documentation or using a GraphQL playground associated with your Dagster instance to discover the available queries and their fields.
4 Views