Eronarn commented on a change in pull request #3584: [AIRFLOW-249] Refactor the
SLA mechanism
URL: https://github.com/apache/incubator-airflow/pull/3584#discussion_r224153774
##########
File path: airflow/models.py
##########
@@ -2440,11 +2515,49 @@ def __init__(
self.retries = retries
self.queue = queue
self.pool = pool
- self.sla = sla
+
+ self.expected_duration = expected_duration
+ self.expected_start = expected_start
+
+ if sla and expected_finish:
+ self.log.warning(
+ "Both sla and expected_finish provided as task "
+ "parameters to %s; using expected_finish and ignoring "
+ "sla.",
+ self
+ )
+ self.expected_finish = expected_finish
+ elif sla:
+ self.log.warning(
+ "sla is deprecated as a task parameter for %s; use "
+ "expected_finish instead.",
+ self
+ )
+ self.expected_finish = sla
+ elif expected_finish:
+ self.expected_finish = expected_finish
+
+ # Warn the user if they've set any non-sensical combinations of SLAs
+ if expected_start and expected_finish \
+ and expected_start >= expected_finish:
+ self.log.warning(
+ "Task %s has an expected start >= expected finish.",
+ self
+ )
+
+ if expected_duration \
+ and (expected_start + expected_duration) >= expected_finish:
Review comment:
Good catch.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services