1
1
import datetime
2
- from collections .abc import Iterator , Sequence
3
- from typing import Optional , Union , cast
2
+ from collections .abc import Iterator , Mapping , Sequence
3
+ from typing import Any , Optional , Union , cast
4
4
5
5
from dagster import _check as check
6
6
from dagster ._annotations import beta
@@ -41,6 +41,7 @@ def build_sensor_for_freshness_checks(
41
41
minimum_interval_seconds : Optional [int ] = None ,
42
42
name : str = DEFAULT_FRESHNESS_SENSOR_NAME ,
43
43
default_status : DefaultSensorStatus = DefaultSensorStatus .STOPPED ,
44
+ tags : Optional [Mapping [str , Any ]] = None ,
44
45
) -> SensorDefinition :
45
46
"""Builds a sensor which kicks off evaluation of freshness checks.
46
47
@@ -67,6 +68,8 @@ def build_sensor_for_freshness_checks(
67
68
name may need to be provided in case of multiple calls of this function.
68
69
default_status (Optional[DefaultSensorStatus]): The default status of the sensor. Defaults
69
70
to stopped.
71
+ tags (Optional[Dict[str, Any]]): A dictionary of tags (string key-value pairs) to attach
72
+ to the launched run.
70
73
71
74
Returns:
72
75
SensorDefinition: The sensor that kicks off freshness evaluations.
@@ -112,7 +115,7 @@ def the_sensor(context: SensorEvaluationContext) -> Optional[Union[RunRequest, S
112
115
new_cursor = check_key .to_user_string () if check_key else None
113
116
context .update_cursor (new_cursor )
114
117
if checks_to_evaluate :
115
- return RunRequest (asset_check_keys = checks_to_evaluate )
118
+ return RunRequest (asset_check_keys = checks_to_evaluate , tags = tags )
116
119
else :
117
120
return SkipReason (
118
121
"No freshness checks need to be evaluated at this time, since all checks are either currently evaluating, have failed, or are not yet overdue."
0 commit comments