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 2020/10/08 13:42:25 UTC

[GitHub] [airflow] ashb commented on a change in pull request #11257: Improve code quality of SLA mechanism in SchedulerJob

ashb commented on a change in pull request #11257:
URL: https://github.com/apache/airflow/pull/11257#discussion_r501730450



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -453,21 +453,19 @@ def manage_slas(self, dag: DAG, session: Session = None) -> None:
             notification_sent = False
             if dag.sla_miss_callback:
                 # Execute the alert callback
-                self.log.info(' --------------> ABOUT TO CALL SLA MISS CALL BACK ')
+                self.log.info('Calling SLA miss callback')
                 try:
                     dag.sla_miss_callback(dag, task_list, blocking_task_list, slas,
                                           blocking_tis)
                     notification_sent = True
                 except Exception:  # pylint: disable=broad-except
-                    self.log.exception("Could not call sla_miss_callback for DAG %s",
-                                       dag.dag_id)
-            email_content = """\
+                    self.log.exception("Could not call sla_miss_callback for DAG %s", dag.dag_id)
+            email_content = f"""\
             Here's a list of tasks that missed their SLAs:
             <pre><code>{task_list}\n<code></pre>
             Blocking tasks:
-            <pre><code>{blocking_task_list}\n{bug}<code></pre>
-            """.format(task_list=task_list, blocking_task_list=blocking_task_list,
-                       bug=asciiart.bug)
+            <pre><code>{blocking_task_list}<code></pre>
+            """

Review comment:
       https://docs.python.org/3/library/textwrap.html?highlight=dedent#textwrap.dedent maybe?




----------------------------------------------------------------
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