airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joy Gao (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRFLOW-2231) DAG with a relativedelta schedule_interval fails
Date Thu, 22 Mar 2018 00:39:00 GMT

    [ https://issues.apache.org/jira/browse/AIRFLOW-2231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16408835#comment-16408835
] 

Joy Gao commented on AIRFLOW-2231:
----------------------------------

Got a chance to look at code and turns out the doc is not accurate, dateutil.relativedelta.relativedelta
is not supported, but datetime.timedelta is. In the case where you need monthly cadence, you
can use either @monthly or cron syntax instead.

Alternatively, if you'd like to add relativedelta, you can  submit a PR and modify [this
section|https://github.com/apache/incubator-airflow/blob/master/airflow/models.py#L3168-L3196]
to support relativedelta.

> DAG with a relativedelta schedule_interval fails
> ------------------------------------------------
>
>                 Key: AIRFLOW-2231
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2231
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: DAG
>            Reporter: Kyle Brooks
>            Priority: Major
>         Attachments: test_reldel.py
>
>
> The documentation for the DAG class says using dateutil.relativedelta.relativedelta as
a schedule_interval is supported but it fails:
>  
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.6/site-packages/airflow/models.py", line 285, in process_file
>     m = imp.load_source(mod_name, filepath)
>   File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py",
line 172, in load_source
>     module = _load(spec)
>   File "<frozen importlib._bootstrap>", line 675, in _load
>   File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
>   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
>   File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
>   File "/Users/k398995/airflow/dags/test_reldel.py", line 33, in <module>
>     dagrun_timeout=timedelta(minutes=60))
>   File "/usr/local/lib/python3.6/site-packages/airflow/models.py", line 2914, in __init__
>     if schedule_interval in cron_presets:
> TypeError: unhashable type: 'relativedelta'
>  
> It looks like the __init__ function for class DAG assumes the schedule_interval is hashable.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message