You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/02/04 07:36:39 UTC

[GitHub] [airflow] turbaszek opened a new pull request #14064: Skip SLA check only if SLA is None

turbaszek opened a new pull request #14064:
URL: https://github.com/apache/airflow/pull/14064


   Users have to provide SLA as timedelta. If not provided it should
   be a default None value.
   
   This change will result in run time errors if other type than
   timedelta is passed as SLA. With this change spotting #14056
   would be easier.
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on a change in pull request #14064: Skip SLA check only if SLA is None

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #14064:
URL: https://github.com/apache/airflow/pull/14064#discussion_r570153673



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -419,7 +419,7 @@ def manage_slas(self, dag: DAG, session: Session = None) -> None:
         ts = timezone.utcnow()
         for ti in max_tis:
             task = dag.get_task(ti.task_id)
-            if not isinstance(task.sla, timedelta):
+            if not task.sla:

Review comment:
       Yes, but in my opinion this is better than not knowing why SLA was not send. To avoid run time errors I think about adding a check to task constructor to fail as soon as possible - WDYT?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on a change in pull request #14064: Skip SLA check only if SLA is None

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #14064:
URL: https://github.com/apache/airflow/pull/14064#discussion_r570153673



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -419,7 +419,7 @@ def manage_slas(self, dag: DAG, session: Session = None) -> None:
         ts = timezone.utcnow()
         for ti in max_tis:
             task = dag.get_task(ti.task_id)
-            if not isinstance(task.sla, timedelta):
+            if not task.sla:

Review comment:
       Yes, but in my opinion this is better than not knowing why SLA was not send. To avoid run time errors I think about adding a check to task constructor to fail as soon as possible - WDYT?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #14064: Skip SLA check only if SLA is None

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #14064:
URL: https://github.com/apache/airflow/pull/14064#issuecomment-774515457


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest master at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #14064: Skip SLA check only if SLA is None

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #14064:
URL: https://github.com/apache/airflow/pull/14064#discussion_r570183997



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -419,7 +419,7 @@ def manage_slas(self, dag: DAG, session: Session = None) -> None:
         ts = timezone.utcnow()
         for ti in max_tis:
             task = dag.get_task(ti.task_id)
-            if not isinstance(task.sla, timedelta):
+            if not task.sla:

Review comment:
       I think a better fix would be something like:
   
   ```python
   if task.sla and not isinstance(task.sla, timedelta):
        raise("Expected timedelta object, got %s instead: %s", type(task.sla), task.sla)
   ```
   
   This would help users understand what's the problem 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on pull request #14064: Skip SLA check only if SLA is None

Posted by GitBox <gi...@apache.org>.
turbaszek commented on pull request #14064:
URL: https://github.com/apache/airflow/pull/14064#issuecomment-774651918


   @kaxil are we ok with merging this one? 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #14064: Skip SLA check only if SLA is None

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #14064:
URL: https://github.com/apache/airflow/pull/14064#discussion_r570144364



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -419,7 +419,7 @@ def manage_slas(self, dag: DAG, session: Session = None) -> None:
         ts = timezone.utcnow()
         for ti in max_tis:
             task = dag.get_task(ti.task_id)
-            if not isinstance(task.sla, timedelta):
+            if not task.sla:

Review comment:
       The problem with this approach is it will fail the entire DagfileProcessorProcess that is running SlaCallback.
   
   So imagine if there are 5 tasks, only 1 of them has `task.sla=3` and others have `task.sla=timedelta(seconds=3)`, then with the current change it will raise type error and will not run or check sla for Tasks that have correct task.sla set.
   
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil merged pull request #14064: Skip SLA check only if SLA is None

Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #14064:
URL: https://github.com/apache/airflow/pull/14064


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #14064: Skip SLA check only if SLA is None

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #14064:
URL: https://github.com/apache/airflow/pull/14064#discussion_r570144364



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -419,7 +419,7 @@ def manage_slas(self, dag: DAG, session: Session = None) -> None:
         ts = timezone.utcnow()
         for ti in max_tis:
             task = dag.get_task(ti.task_id)
-            if not isinstance(task.sla, timedelta):
+            if not task.sla:

Review comment:
       The problem with this approach is it will fail the entire DagfileProcessorProcess that is running SlaCallback.
   
   So imagine if there are 5 tasks, only 1 of them has `task.sla=3` and others have `task.sla=timedelta(seconds=3)`, then with the current change it will raise type error and will not run or check sla for Tasks that have correct task.sla set.
   
   

##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -419,7 +419,7 @@ def manage_slas(self, dag: DAG, session: Session = None) -> None:
         ts = timezone.utcnow()
         for ti in max_tis:
             task = dag.get_task(ti.task_id)
-            if not isinstance(task.sla, timedelta):
+            if not task.sla:

Review comment:
       I think a better fix would be something like:
   
   ```python
   if task.sla and not isinstance(task.sla, timedelta):
        raise("Expected timedelta object, got %s instead: %s", type(task.sla), task.sla)
   ```
   
   This would help users understand what's the problem 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org