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 2019/07/01 14:23:24 UTC

[GitHub] [airflow] pgagnon commented on a change in pull request #5407: [AIRFLOW-4741] Include Sentry into core Airflow

pgagnon commented on a change in pull request #5407: [AIRFLOW-4741] Include Sentry into core Airflow
URL: https://github.com/apache/airflow/pull/5407#discussion_r299067398
 
 

 ##########
 File path: airflow/sentry.py
 ##########
 @@ -0,0 +1,158 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from typing import Any
+
+from airflow import configuration as conf
+from airflow.utils.db import provide_session
+from airflow.utils.log.logging_mixin import LoggingMixin
+
+
+log = LoggingMixin().log
+
+
+class DummySentry:
+    """
+    Blank class for Sentry.
+    """
+
+    @classmethod
+    def add_tagging(cls, task_instance):
+        pass
+
+    @classmethod
+    def add_breadcrumbs(cls, session=None):
+        pass
+
+
+@provide_session
+def get_task_instance(task, execution_date, session=None):
 
 Review comment:
   Ah, I see what you are doing with it.
   
   I have a couple of loosely related comments:
   
   - At a very high level, what information are you attempting to report to sentry with this breadcrumb? At first glance it seems that this is attempting to report the status of this task instance's dependencies, but I am not sure that this is particularly informative as a TI will not be run if its dependencies are unmet.
   - How are these breadcrumbs reconciled with specific task instances? I can't seem to find any kind of scope or context linking them together. (this is basically the same question as https://github.com/apache/airflow/pull/5407#discussion_r297693203)
   - Do you think it could be helpful to pass more TI data to sentry by using the breadcrumbs `data` field?
   - I could see some value in reporting data about *all* TIs in a DagRun (not just this specific TI's direct parents), for instance this could help users investigate race conditions between parallel tasks. WDYT?
   - I think you may be able to refactor `get_task_instance` into `get_task_instances`; if you make the function accept a list of tasks and return a list of TIs you could move it outside the loop in `sentry.py:132` which would reduce the number of calls to the database.

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


With regards,
Apache Git Services