From 809032599c5e7086e575cc150aca1af57f2a6276 Mon Sep 17 00:00:00 2001 From: prha Date: Wed, 8 Jan 2025 09:30:50 -0800 Subject: [PATCH] run graphql --- .../packages/ui-core/src/graphql/schema.graphql | 1 + .../dagster-ui/packages/ui-core/src/graphql/types.ts | 2 ++ .../dagster_graphql/schema/pipelines/pipeline.py | 11 +++++++++++ .../dagster_graphql_tests/graphql/test_runs.py | 3 +++ 4 files changed, 17 insertions(+) diff --git a/js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql b/js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql index 26c03cca33827..b48f0456881d9 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql +++ b/js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql @@ -1447,6 +1447,7 @@ type Run implements PipelineRun & RunsFeedEntry { hasDeletePermission: Boolean! hasConcurrencyKeySlots: Boolean! rootConcurrencyKeys: [String!] + allPools: [String!] hasUnconstrainedRootNodes: Boolean! hasRunMetricsEnabled: Boolean! } diff --git a/js_modules/dagster-ui/packages/ui-core/src/graphql/types.ts b/js_modules/dagster-ui/packages/ui-core/src/graphql/types.ts index 1f6f601abbe2c..9f0dabb028e1d 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/graphql/types.ts +++ b/js_modules/dagster-ui/packages/ui-core/src/graphql/types.ts @@ -4485,6 +4485,7 @@ export type ResumeBackfillSuccess = { export type Run = PipelineRun & RunsFeedEntry & { __typename: 'Run'; + allPools: Maybe>; assetCheckSelection: Maybe>; assetChecks: Maybe>; assetMaterializations: Array; @@ -13147,6 +13148,7 @@ export const buildRun = ( relationshipsToOmit.add('Run'); return { __typename: 'Run', + allPools: overrides && overrides.hasOwnProperty('allPools') ? overrides.allPools! : [], assetCheckSelection: overrides && overrides.hasOwnProperty('assetCheckSelection') ? overrides.assetCheckSelection! diff --git a/python_modules/dagster-graphql/dagster_graphql/schema/pipelines/pipeline.py b/python_modules/dagster-graphql/dagster_graphql/schema/pipelines/pipeline.py index aba66781f27f4..b26f6c784a5b1 100644 --- a/python_modules/dagster-graphql/dagster_graphql/schema/pipelines/pipeline.py +++ b/python_modules/dagster-graphql/dagster_graphql/schema/pipelines/pipeline.py @@ -389,6 +389,7 @@ class GrapheneRun(graphene.ObjectType): hasDeletePermission = graphene.NonNull(graphene.Boolean) hasConcurrencyKeySlots = graphene.NonNull(graphene.Boolean) rootConcurrencyKeys = graphene.List(graphene.NonNull(graphene.String)) + allPools = graphene.List(graphene.NonNull(graphene.String)) hasUnconstrainedRootNodes = graphene.NonNull(graphene.Boolean) hasRunMetricsEnabled = graphene.NonNull(graphene.Boolean) @@ -622,6 +623,16 @@ def resolve_hasUnconstrainedRootNodes(self, graphene_info: ResolveInfo): return False + def resolve_allPools(self, graphene_info: ResolveInfo): + if not self.dagster_run.run_op_concurrency: + return None + + return ( + list(self.dagster_run.run_op_concurrency.all_pools) + if self.dagster_run.run_op_concurrency.all_pools + else [] + ) + def resolve_rootConcurrencyKeys(self, graphene_info: ResolveInfo): if not self.dagster_run.run_op_concurrency: return None diff --git a/python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_runs.py b/python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_runs.py index 65acddadb2272..7341ffb68ea97 100644 --- a/python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_runs.py +++ b/python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_runs.py @@ -261,6 +261,7 @@ status hasConcurrencyKeySlots rootConcurrencyKeys + allPools } } } @@ -1005,6 +1006,7 @@ def test_run_has_concurrency_slots(): "hasConcurrencyKeySlots" ] assert result.data["pipelineRunsOrError"]["results"][0]["rootConcurrencyKeys"] + assert result.data["pipelineRunsOrError"]["results"][0]["allPools"] claim = instance.event_log_storage.claim_concurrency_slot( "foo", run_id, "fake_step_key" @@ -1018,6 +1020,7 @@ def test_run_has_concurrency_slots(): assert result.data["pipelineRunsOrError"]["results"][0]["runId"] == run_id assert result.data["pipelineRunsOrError"]["results"][0]["hasConcurrencyKeySlots"] assert result.data["pipelineRunsOrError"]["results"][0]["rootConcurrencyKeys"] + assert result.data["pipelineRunsOrError"]["results"][0]["allPools"] @pytest.mark.parametrize(