This is an automated email from the ASF dual-hosted git repository.
taragolis pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new ec6d945aa3 Fix usage of cron-descriptor since BC in v1.3.0 (#34836)
ec6d945aa3 is described below
commit ec6d945aa31af30726d8affaa8b30af330da1085
Author: Quentin Bray <[email protected]>
AuthorDate: Thu Oct 19 19:07:50 2023 +0200
Fix usage of cron-descriptor since BC in v1.3.0 (#34836)
When using a custom TimeTable that doesn't provide a CRON expression
summary (e.g. : 'Custom TimeTable Plugin'),
and if the web UI has not yet load the TimeTable when deserializing the DAG,
accessing the grid view will try to parse the custom description as a CRON
expression and then cron-descriptor, that introduce a breaking change in v1.3.0
that now calls 'parse' in the ctor of ExpressionDescriptor raise the
FormatException outside of the try block
(working great in Airflow v2.4.2 that uses cron-descriptor v1.2.x)
C.f. :
https://github.com/Salamek/cron-descriptor/commit/ec9ea4de2533ebacb0b527cb88973992858910f4
---
airflow/timetables/_cron.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/airflow/timetables/_cron.py b/airflow/timetables/_cron.py
index 6787628888..f9b8efa465 100644
--- a/airflow/timetables/_cron.py
+++ b/airflow/timetables/_cron.py
@@ -59,10 +59,10 @@ class CronMixin:
timezone = Timezone(timezone)
self._timezone = timezone
- descriptor = ExpressionDescriptor(
- expression=self._expression, casing_type=CasingTypeEnum.Sentence,
use_24hour_time_format=True
- )
try:
+ descriptor = ExpressionDescriptor(
+ expression=self._expression,
casing_type=CasingTypeEnum.Sentence, use_24hour_time_format=True
+ )
# checking for more than 5 parameters in Cron and avoiding
evaluation for now,
# as Croniter has inconsistent evaluation with other libraries
if len(croniter(self._expression).expanded) > 5: