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 2022/04/25 20:13:58 UTC

[GitHub] [airflow] potiuk commented on a diff in pull request #23136: Add special exception for "host field is not hashable"

potiuk commented on code in PR #23136:
URL: https://github.com/apache/airflow/pull/23136#discussion_r857991677


##########
airflow/providers/elasticsearch/log/es_task_handler.py:
##########
@@ -153,7 +153,17 @@ def _group_logs_by_host(self, logs):
         grouped_logs = defaultdict(list)
         for log in logs:
             key = getattr(log, self.host_field, 'default_host')
-            grouped_logs[key].append(log)
+            
+            try:
+                grouped_logs[key].append(log) 
+            except TypeError as e:
+                if not isinstance(key, Hashable): 
+                    raise ValueError("The host field in all log records needs to be hashable. "
+                    "If you are using filebeat, read here: "
+                    "https://github.com/apache/airflow/issues/15613#issuecomment-1104487752") from e

Review Comment:
   Actually better solution will be to copy the explanation to our ElasticSearch documentation (at airflow.apache.org) and link from it to there. The error message should explain the reason and link to the detailed discussion/explanation why - but linking to an issue is only fine only in a source comment, rather than in a user message. Theree we should only link to a documentation we control.



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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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