From 4161273ff8675a2ba7ac55ee1ae9f5d8fbd9cc72 Mon Sep 17 00:00:00 2001 From: Nick Schrock Date: Sun, 9 Jun 2024 15:56:03 -0400 Subject: [PATCH] hack for output name --- .../decorators/decorator_assets_definition_builder.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py b/python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py index ce6e715399b35..2f3d96a2365d0 100644 --- a/python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py +++ b/python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py @@ -44,7 +44,7 @@ from dagster._core.types.dagster_type import DagsterType, Nothing from ..asset_check_spec import AssetCheckSpec -from ..utils import NoValueSentinel +from ..utils import DEFAULT_OUTPUT, NoValueSentinel from .op_decorator import _Op @@ -465,7 +465,12 @@ def asset_keys(self) -> Set[AssetKey]: @cached_property def check_specs_by_output_name(self) -> Mapping[str, AssetCheckSpec]: - return create_check_specs_by_output_name(self.args.check_specs) + cs_by_name = create_check_specs_by_output_name(self.args.check_specs) + if self.args.decorator_name == "@asset_check": + check.invariant(len(cs_by_name) == 1, "Must have exactly one check spec") + return {DEFAULT_OUTPUT: next(iter(cs_by_name.values()))} + + return cs_by_name @cached_property def check_outs_by_output_name(self) -> Mapping[str, Out]: