You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Sajjad Hussain (JIRA)" <ji...@apache.org> on 2016/10/07 21:43:20 UTC

[jira] [Updated] (AIRFLOW-557) SLA notification does not work for manually triggered DAGs

     [ https://issues.apache.org/jira/browse/AIRFLOW-557?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sajjad Hussain updated AIRFLOW-557:
-----------------------------------
    Description: 
No SLA notifcation emails are sent for manually triggered DAGs.

For example, if you have ...
{code}
dag = DAG(
    'my_dag',
    start_date=datetime(2015, 1, 1),
    schedule_interval=None,
    default_args=args)

t = PythonOperator(
        task_id='t2',
        python_callable=<callable>,
        sla=timedelta(seconds=60),
        dag=dag)
{code}

There is no email sent if the task takes more than the SLA time.

The code for DAG.following_schedule does not seem to handle the case of scheduler_interval=None ...
{code}
   def following_schedule(self, dttm):
        if isinstance(self._schedule_interval, six.string_types):
            cron = croniter(self._schedule_interval, dttm)
            return cron.get_next(datetime)
        elif isinstance(self._schedule_interval, timedelta):
            return dttm + self._schedule_interval
{code}

When the DAG has schedule_interval=None, the following exception is raised ...
{code}
File "<...>/lib/python2.7/site-packages/airflow/jobs.py", line 284, in manage_slas
     while dttm < datetime.now():
TypeError: can't compare datetime.datetime to NoneType
{code}



  was:
No SLA notifcation emails are sent for manually triggered DAGs.

For example, if you have ...
dag = DAG(
    'my_dag',
    start_date=datetime(2015, 1, 1),
    schedule_interval=None,
    default_args=args)

t = PythonOperator(
        task_id='t2',
        python_callable=<callable>,
        sla=timedelta(seconds=60),
        dag=dag)
There is no email sent if the task takes more than the SLA time.

The code for DAG.following_schedule does not seem to handle the case of scheduler_interval=None ...
{code}
   def following_schedule(self, dttm):
        if isinstance(self._schedule_interval, six.string_types):
            cron = croniter(self._schedule_interval, dttm)
            return cron.get_next(datetime)
        elif isinstance(self._schedule_interval, timedelta):
            return dttm + self._schedule_interval
{code}

When the DAG has schedule_interval=None, the following exception is raised ...

File "<...>/lib/python2.7/site-packages/airflow/jobs.py", line 284, in manage_slas
     while dttm < datetime.now():
TypeError: can't compare datetime.datetime to NoneType





> SLA notification does not work for manually triggered DAGs 
> -----------------------------------------------------------
>
>                 Key: AIRFLOW-557
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-557
>             Project: Apache Airflow
>          Issue Type: Bug
>            Reporter: Sajjad Hussain
>
> No SLA notifcation emails are sent for manually triggered DAGs.
> For example, if you have ...
> {code}
> dag = DAG(
>     'my_dag',
>     start_date=datetime(2015, 1, 1),
>     schedule_interval=None,
>     default_args=args)
> t = PythonOperator(
>         task_id='t2',
>         python_callable=<callable>,
>         sla=timedelta(seconds=60),
>         dag=dag)
> {code}
> There is no email sent if the task takes more than the SLA time.
> The code for DAG.following_schedule does not seem to handle the case of scheduler_interval=None ...
> {code}
>    def following_schedule(self, dttm):
>         if isinstance(self._schedule_interval, six.string_types):
>             cron = croniter(self._schedule_interval, dttm)
>             return cron.get_next(datetime)
>         elif isinstance(self._schedule_interval, timedelta):
>             return dttm + self._schedule_interval
> {code}
> When the DAG has schedule_interval=None, the following exception is raised ...
> {code}
> File "<...>/lib/python2.7/site-packages/airflow/jobs.py", line 284, in manage_slas
>      while dttm < datetime.now():
> TypeError: can't compare datetime.datetime to NoneType
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)