apache-airflow-providers-elasticsearch 6.2.0rc1__py3-none-any.whl → 6.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "6.2.0"
32
+ __version__ = "6.2.1"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "2.9.0"
@@ -27,8 +27,9 @@ def get_provider_info():
27
27
  "name": "Elasticsearch",
28
28
  "description": "`Elasticsearch <https://www.elastic.co/elasticsearch>`__\n",
29
29
  "state": "ready",
30
- "source-date-epoch": 1739959618,
30
+ "source-date-epoch": 1741508781,
31
31
  "versions": [
32
+ "6.2.1",
32
33
  "6.2.0",
33
34
  "6.0.0",
34
35
  "5.5.3",
@@ -219,4 +220,5 @@ def get_provider_info():
219
220
  "apache-airflow-providers-common-sql>=1.20.0",
220
221
  "elasticsearch>=8.10,<9",
221
222
  ],
223
+ "devel-dependencies": [],
222
224
  }
@@ -22,9 +22,10 @@ from functools import cached_property
22
22
  from typing import TYPE_CHECKING, Any
23
23
  from urllib import parse
24
24
 
25
+ from elasticsearch import Elasticsearch
26
+
25
27
  from airflow.hooks.base import BaseHook
26
28
  from airflow.providers.common.sql.hooks.sql import DbApiHook
27
- from elasticsearch import Elasticsearch
28
29
 
29
30
  if TYPE_CHECKING:
30
31
  from elastic_transport import ObjectApiResponse
@@ -31,14 +31,18 @@ from operator import attrgetter
31
31
  from typing import TYPE_CHECKING, Any, Callable, Literal
32
32
  from urllib.parse import quote, urlparse
33
33
 
34
- import pendulum
35
-
36
34
  # Using `from elasticsearch import *` would break elasticsearch mocking used in unit test.
37
35
  import elasticsearch
36
+ import pendulum
37
+ from elasticsearch import helpers
38
+ from elasticsearch.exceptions import NotFoundError
39
+
38
40
  from airflow.configuration import conf
39
41
  from airflow.exceptions import AirflowException
40
42
  from airflow.models.dagrun import DagRun
41
- from airflow.providers.elasticsearch.log.es_json_formatter import ElasticsearchJSONFormatter
43
+ from airflow.providers.elasticsearch.log.es_json_formatter import (
44
+ ElasticsearchJSONFormatter,
45
+ )
42
46
  from airflow.providers.elasticsearch.log.es_response import ElasticSearchResponse, Hit
43
47
  from airflow.providers.elasticsearch.version_compat import AIRFLOW_V_3_0_PLUS
44
48
  from airflow.utils import timezone
@@ -46,18 +50,24 @@ from airflow.utils.log.file_task_handler import FileTaskHandler
46
50
  from airflow.utils.log.logging_mixin import ExternalLoggingMixin, LoggingMixin
47
51
  from airflow.utils.module_loading import import_string
48
52
  from airflow.utils.session import create_session
49
- from elasticsearch import helpers
50
- from elasticsearch.exceptions import NotFoundError
51
53
 
52
54
  if TYPE_CHECKING:
53
55
  from datetime import datetime
54
56
 
55
57
  from airflow.models.taskinstance import TaskInstance, TaskInstanceKey
56
58
 
59
+ if AIRFLOW_V_3_0_PLUS:
60
+ from typing import Union
61
+
62
+ from airflow.utils.log.file_task_handler import StructuredLogMessage
63
+
64
+ EsLogMsgType = Union[list[StructuredLogMessage], str]
65
+ else:
66
+ EsLogMsgType = list[tuple[str, str]] # type: ignore[misc]
67
+
57
68
 
58
69
  LOG_LINE_DEFAULTS = {"exc_text": "", "stack_info": ""}
59
70
  # Elasticsearch hosted log type
60
- EsLogMsgType = list[tuple[str, str]]
61
71
 
62
72
  # Compatibility: Airflow 2.3.3 and up uses this method, which accesses the
63
73
  # LogTemplate model to record the log ID template used. If this function does
@@ -344,7 +354,10 @@ class ElasticsearchTaskHandler(FileTaskHandler, ExternalLoggingMixin, LoggingMix
344
354
  "If your task started recently, please wait a moment and reload this page. "
345
355
  "Otherwise, the logs for this task instance may have been removed."
346
356
  )
347
- return [("", missing_log_message)], metadata
357
+ if AIRFLOW_V_3_0_PLUS:
358
+ return missing_log_message, metadata
359
+ else:
360
+ return [("", missing_log_message)], metadata # type: ignore[list-item]
348
361
  if (
349
362
  # Assume end of log after not receiving new log for N min,
350
363
  cur_ts.diff(last_log_ts).in_minutes() >= 5
@@ -358,12 +371,30 @@ class ElasticsearchTaskHandler(FileTaskHandler, ExternalLoggingMixin, LoggingMix
358
371
 
359
372
  # If we hit the end of the log, remove the actual end_of_log message
360
373
  # to prevent it from showing in the UI.
361
- def concat_logs(hits: list[Hit]):
374
+ def concat_logs(hits: list[Hit]) -> str:
362
375
  log_range = (len(hits) - 1) if hits[-1].message == self.end_of_log_mark else len(hits)
363
376
  return "\n".join(self._format_msg(hits[i]) for i in range(log_range))
364
377
 
365
378
  if logs_by_host:
366
- message = [(host, concat_logs(hits)) for host, hits in logs_by_host.items()]
379
+ if AIRFLOW_V_3_0_PLUS:
380
+ from airflow.utils.log.file_task_handler import StructuredLogMessage
381
+
382
+ header = [
383
+ StructuredLogMessage(
384
+ event="::group::Log message source details",
385
+ sources=[host for host in logs_by_host.keys()],
386
+ ), # type: ignore[call-arg]
387
+ StructuredLogMessage(event="::endgroup::"),
388
+ ] # type: ignore[misc]
389
+
390
+ message = header + [
391
+ StructuredLogMessage(event=concat_logs(hits)) for hits in logs_by_host.values()
392
+ ] # type: ignore[misc]
393
+ else:
394
+ message = [
395
+ (host, concat_logs(hits)) # type: ignore[misc]
396
+ for host, hits in logs_by_host.items()
397
+ ]
367
398
  else:
368
399
  message = []
369
400
  return message, metadata
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: apache-airflow-providers-elasticsearch
3
- Version: 6.2.0rc1
3
+ Version: 6.2.1
4
4
  Summary: Provider package apache-airflow-providers-elasticsearch for Apache Airflow
5
5
  Keywords: airflow-provider,elasticsearch,airflow,integration
6
6
  Author-email: Apache Software Foundation <dev@airflow.apache.org>
@@ -20,44 +20,43 @@ Classifier: Programming Language :: Python :: 3.10
20
20
  Classifier: Programming Language :: Python :: 3.11
21
21
  Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Topic :: System :: Monitoring
23
- Requires-Dist: apache-airflow>=2.9.0rc0
24
- Requires-Dist: apache-airflow-providers-common-sql>=1.20.0rc0
23
+ Requires-Dist: apache-airflow>=2.9.0
24
+ Requires-Dist: apache-airflow-providers-common-sql>=1.20.0
25
25
  Requires-Dist: elasticsearch>=8.10,<9
26
26
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
27
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-elasticsearch/6.2.0/changelog.html
28
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-elasticsearch/6.2.0
27
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-elasticsearch/6.2.1/changelog.html
28
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-elasticsearch/6.2.1
29
29
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
30
30
  Project-URL: Source Code, https://github.com/apache/airflow
31
31
  Project-URL: Twitter, https://x.com/ApacheAirflow
32
32
  Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
33
33
 
34
34
 
35
- .. Licensed to the Apache Software Foundation (ASF) under one
36
- or more contributor license agreements. See the NOTICE file
37
- distributed with this work for additional information
38
- regarding copyright ownership. The ASF licenses this file
39
- to you under the Apache License, Version 2.0 (the
40
- "License"); you may not use this file except in compliance
41
- with the License. You may obtain a copy of the License at
35
+ .. Licensed to the Apache Software Foundation (ASF) under one
36
+ or more contributor license agreements. See the NOTICE file
37
+ distributed with this work for additional information
38
+ regarding copyright ownership. The ASF licenses this file
39
+ to you under the Apache License, Version 2.0 (the
40
+ "License"); you may not use this file except in compliance
41
+ with the License. You may obtain a copy of the License at
42
42
 
43
- .. http://www.apache.org/licenses/LICENSE-2.0
43
+ .. http://www.apache.org/licenses/LICENSE-2.0
44
44
 
45
- .. Unless required by applicable law or agreed to in writing,
46
- software distributed under the License is distributed on an
47
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
48
- KIND, either express or implied. See the License for the
49
- specific language governing permissions and limitations
50
- under the License.
45
+ .. Unless required by applicable law or agreed to in writing,
46
+ software distributed under the License is distributed on an
47
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
48
+ KIND, either express or implied. See the License for the
49
+ specific language governing permissions and limitations
50
+ under the License.
51
51
 
52
- .. NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN!
53
-
54
- .. IF YOU WANT TO MODIFY TEMPLATE FOR THIS FILE, YOU SHOULD MODIFY THE TEMPLATE
55
- `PROVIDER_README_TEMPLATE.rst.jinja2` IN the `dev/breeze/src/airflow_breeze/templates` DIRECTORY
52
+ .. NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN!
56
53
 
54
+ .. IF YOU WANT TO MODIFY TEMPLATE FOR THIS FILE, YOU SHOULD MODIFY THE TEMPLATE
55
+ ``PROVIDER_README_TEMPLATE.rst.jinja2`` IN the ``dev/breeze/src/airflow_breeze/templates`` DIRECTORY
57
56
 
58
57
  Package ``apache-airflow-providers-elasticsearch``
59
58
 
60
- Release: ``6.2.0``
59
+ Release: ``6.2.1``
61
60
 
62
61
 
63
62
  `Elasticsearch <https://www.elastic.co/elasticsearch>`__
@@ -70,7 +69,7 @@ This is a provider package for ``elasticsearch`` provider. All classes for this
70
69
  are in ``airflow.providers.elasticsearch`` python package.
71
70
 
72
71
  You can find package information and changelog for the provider
73
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-elasticsearch/6.2.0/>`_.
72
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-elasticsearch/6.2.1/>`_.
74
73
 
75
74
  Installation
76
75
  ------------
@@ -112,5 +111,5 @@ Dependent package
112
111
  ============================================================================================================ ==============
113
112
 
114
113
  The changelog for the provider package can be found in the
115
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-elasticsearch/6.2.0/changelog.html>`_.
114
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-elasticsearch/6.2.1/changelog.html>`_.
116
115
 
@@ -0,0 +1,14 @@
1
+ airflow/providers/elasticsearch/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
2
+ airflow/providers/elasticsearch/__init__.py,sha256=HyArUyu1P6WMSwpluQDdf9gsNrY6xr2FabMVJGjr8YY,1500
3
+ airflow/providers/elasticsearch/get_provider_info.py,sha256=h9Gv7fXlZvAa3QJRuzMOdArtb1lAIOhdYS2Y7Kz3qzM,9377
4
+ airflow/providers/elasticsearch/version_compat.py,sha256=aHg90_DtgoSnQvILFICexMyNlHlALBdaeWqkX3dFDug,1605
5
+ airflow/providers/elasticsearch/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
6
+ airflow/providers/elasticsearch/hooks/elasticsearch.py,sha256=dEwb5-5RyRdCJEzp1T9AHrCwKvhXEg434lMsNziIosI,7871
7
+ airflow/providers/elasticsearch/log/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
8
+ airflow/providers/elasticsearch/log/es_json_formatter.py,sha256=DwWPDJtZLr_6Mdae1-XVEgmE1XErFIanSzxWovs50ig,1796
9
+ airflow/providers/elasticsearch/log/es_response.py,sha256=LdMBuVBTydaC42HooYSttAjTK-CpPA4r_KHl38msMnk,6046
10
+ airflow/providers/elasticsearch/log/es_task_handler.py,sha256=5FEsuEgIPOOYCmjXT6hqrbtw0L9nmANNk7ZoaWzmGSE,28553
11
+ apache_airflow_providers_elasticsearch-6.2.1.dist-info/entry_points.txt,sha256=jpgAUVmTsdtWQ4nru2FJQKP9JBN4OPHK-ybfYc3_BOs,109
12
+ apache_airflow_providers_elasticsearch-6.2.1.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
13
+ apache_airflow_providers_elasticsearch-6.2.1.dist-info/METADATA,sha256=HPScEPo21xupiml6nhryC7Hzr3YafIrGTbraDxSCBVg,5218
14
+ apache_airflow_providers_elasticsearch-6.2.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: flit 3.10.1
2
+ Generator: flit 3.11.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,14 +0,0 @@
1
- airflow/providers/elasticsearch/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
2
- airflow/providers/elasticsearch/__init__.py,sha256=RnkccShr3S8a2f33ZCOyZZCA3pvEAeNC6rJoztFYOLc,1500
3
- airflow/providers/elasticsearch/get_provider_info.py,sha256=cMezQyO1pJFq0ekd6E9Sj0a9AwQoCRHZ_HYQazO9C7Y,9322
4
- airflow/providers/elasticsearch/version_compat.py,sha256=aHg90_DtgoSnQvILFICexMyNlHlALBdaeWqkX3dFDug,1605
5
- airflow/providers/elasticsearch/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
6
- airflow/providers/elasticsearch/hooks/elasticsearch.py,sha256=ac_IfhPVccHPhUWzGs9sWRqZC1hnYs-JTauQLdv-mYQ,7870
7
- airflow/providers/elasticsearch/log/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
8
- airflow/providers/elasticsearch/log/es_json_formatter.py,sha256=DwWPDJtZLr_6Mdae1-XVEgmE1XErFIanSzxWovs50ig,1796
9
- airflow/providers/elasticsearch/log/es_response.py,sha256=LdMBuVBTydaC42HooYSttAjTK-CpPA4r_KHl38msMnk,6046
10
- airflow/providers/elasticsearch/log/es_task_handler.py,sha256=JpYm8GGKUVaXKBgeQKdF7z09W_gicrRGzJG7j3KcmZ8,27406
11
- apache_airflow_providers_elasticsearch-6.2.0rc1.dist-info/entry_points.txt,sha256=jpgAUVmTsdtWQ4nru2FJQKP9JBN4OPHK-ybfYc3_BOs,109
12
- apache_airflow_providers_elasticsearch-6.2.0rc1.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
13
- apache_airflow_providers_elasticsearch-6.2.0rc1.dist-info/METADATA,sha256=Jg15uSw2FNJrjBA6V4ugFunymJvbKUFZjYjw2J55MXA,5241
14
- apache_airflow_providers_elasticsearch-6.2.0rc1.dist-info/RECORD,,