Skip to content

Commit

Permalink
Also validate backfill title for asset backfills (#26767)
Browse files Browse the repository at this point in the history
## Summary & Motivation

Fix a mistaken inconsistency; see
#26731 (comment).

## How I Tested These Changes

BK

## Changelog

Added validation of `title` for asset backfills (not just for job
backfills).
  • Loading branch information
deepyaman authored Dec 31, 2024
1 parent 5a4e2c0 commit 483c888
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import dagster._check as check
from dagster._core.definitions.selector import PartitionsByAssetSelector, RepositorySelector
from dagster._core.definitions.utils import is_valid_title_and_reason
from dagster._core.definitions.utils import check_valid_title
from dagster._core.errors import (
DagsterError,
DagsterInvariantViolationError,
Expand Down Expand Up @@ -125,6 +125,8 @@ def create_and_launch_partition_backfill(

tags = {**tags, **graphene_info.context.get_viewer_tags()}

title = check_valid_title(backfill_params.get("title"))

if backfill_params.get("selector") is not None: # job backfill
partition_set_selector = backfill_params["selector"]
partition_set_name = partition_set_selector.get("partitionSetName")
Expand Down Expand Up @@ -169,10 +171,6 @@ def create_and_launch_partition_backfill(
"arguments"
)

is_valid_title, reason = is_valid_title_and_reason(backfill_params.get("title"))
if not is_valid_title:
raise DagsterInvariantViolationError(reason)

backfill = PartitionBackfill(
backfill_id=backfill_id,
partition_set_origin=remote_partition_set.get_remote_origin(),
Expand All @@ -183,7 +181,7 @@ def create_and_launch_partition_backfill(
tags=tags,
backfill_timestamp=backfill_timestamp,
asset_selection=asset_selection,
title=backfill_params.get("title"),
title=title,
description=backfill_params.get("description"),
)
assert_valid_job_partition_backfill(
Expand Down Expand Up @@ -231,15 +229,15 @@ def create_and_launch_partition_backfill(
)

backfill = PartitionBackfill.from_asset_partitions(
asset_graph=asset_graph,
backfill_id=backfill_id,
tags=tags,
asset_graph=asset_graph,
backfill_timestamp=backfill_timestamp,
tags=tags,
asset_selection=asset_selection,
partition_names=backfill_params.get("partitionNames"),
dynamic_partitions_store=dynamic_partitions_store,
all_partitions=backfill_params.get("allPartitions", False),
title=backfill_params.get("title"),
title=title,
description=backfill_params.get("description"),
)
assert_valid_asset_partition_backfill(
Expand Down Expand Up @@ -276,7 +274,7 @@ def create_and_launch_partition_backfill(
tags=tags,
dynamic_partitions_store=dynamic_partitions_store,
partitions_by_assets=partitions_by_assets,
title=backfill_params.get("title"),
title=title,
description=backfill_params.get("description"),
)
assert_valid_asset_partition_backfill(
Expand Down

0 comments on commit 483c888

Please sign in to comment.