From d14e0948cc23ecdbc59e4b93dd6cb097716c030f Mon Sep 17 00:00:00 2001 From: JamieDeMaria Date: Tue, 20 Aug 2024 16:34:42 -0400 Subject: [PATCH] gql --- .../packages/ui-core/src/graphql/schema.graphql | 2 +- .../dagster-ui/packages/ui-core/src/graphql/types.ts | 7 ++----- .../dagster-graphql/dagster_graphql/schema/inputs.py | 10 +++++++--- .../graphql/test_asset_backfill.py | 2 +- .../dagster/_core/storage/runs/sql_run_storage.py | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) 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 2736a25369d45..8754ddc3bb656 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 @@ -2397,7 +2397,7 @@ enum AssetEventType { } input BulkActionsFilter { - status: BulkActionStatus + statuses: [BulkActionStatus!] createdBefore: Float createdAfter: Float } 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 f0c9c97d8b034..ebe6962b23b98 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 @@ -733,7 +733,7 @@ export enum BulkActionStatus { export type BulkActionsFilter = { createdAfter?: InputMaybe; createdBefore?: InputMaybe; - status?: InputMaybe; + statuses?: InputMaybe>; }; export type CancelBackfillResult = CancelBackfillSuccess | PythonError | UnauthorizedError; @@ -6984,10 +6984,7 @@ export const buildBulkActionsFilter = ( overrides && overrides.hasOwnProperty('createdAfter') ? overrides.createdAfter! : 6.09, createdBefore: overrides && overrides.hasOwnProperty('createdBefore') ? overrides.createdBefore! : 1.5, - status: - overrides && overrides.hasOwnProperty('status') - ? overrides.status! - : BulkActionStatus.CANCELED, + statuses: overrides && overrides.hasOwnProperty('statuses') ? overrides.statuses! : [], }; }; diff --git a/python_modules/dagster-graphql/dagster_graphql/schema/inputs.py b/python_modules/dagster-graphql/dagster_graphql/schema/inputs.py index eb3834f91c9d2..420dfadf4167f 100644 --- a/python_modules/dagster-graphql/dagster_graphql/schema/inputs.py +++ b/python_modules/dagster-graphql/dagster_graphql/schema/inputs.py @@ -379,7 +379,9 @@ class Meta: class GrapheneBulkActionsFilter(graphene.InputObjectType): - status = graphene.InputField("dagster_graphql.schema.backfill.GrapheneBulkActionStatus") + statuses = graphene.List( + graphene.NonNull("dagster_graphql.schema.backfill.GrapheneBulkActionStatus") + ) createdBefore = graphene.InputField(graphene.Float) createdAfter = graphene.InputField(graphene.Float) @@ -388,12 +390,14 @@ class Meta: name = "BulkActionsFilter" def to_selector(self): - status = BulkActionStatus[self.status.value] if self.status else None + statuses = ( + [BulkActionStatus[status.value] for status in self.statuses] if self.statuses else None + ) created_before = datetime_from_timestamp(self.createdBefore) if self.createdBefore else None created_after = datetime_from_timestamp(self.createdAfter) if self.createdAfter else None return BulkActionsFilter( - status=status, + statuses=statuses, created_before=created_before, created_after=created_after, ) diff --git a/python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_asset_backfill.py b/python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_asset_backfill.py index ad6591dc4361a..d42122844cbe0 100644 --- a/python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_asset_backfill.py +++ b/python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_asset_backfill.py @@ -1203,5 +1203,5 @@ def test_get_backfills_with_filters(): get_backfills_result = execute_dagster_graphql( context, BACKFILLS_WITH_FILTERS_QUERY, - variables={"filters": {"status": "REQUESTED"}}, + variables={"filters": {"statuses": ["REQUESTED"]}}, ) diff --git a/python_modules/dagster/dagster/_core/storage/runs/sql_run_storage.py b/python_modules/dagster/dagster/_core/storage/runs/sql_run_storage.py index 4e0da3fcb0864..266d941dbedcb 100644 --- a/python_modules/dagster/dagster/_core/storage/runs/sql_run_storage.py +++ b/python_modules/dagster/dagster/_core/storage/runs/sql_run_storage.py @@ -846,7 +846,7 @@ def get_backfills( raise DagsterInvariantViolationError( "Conflicting status filters provided to get_backfills. Choose one of status or BulkActionsFilter.statuses." ) - statuses = [status] or (filters.statuses if filters else None) + statuses = [status] if status else (filters.statuses if filters else None) assert statuses query = query.where( BulkActionsTable.c.status.in_([status.value for status in statuses])