apache-airflow-providers-openlineage 1.9.0rc1__py3-none-any.whl → 1.9.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.

Potentially problematic release.


This version of apache-airflow-providers-openlineage might be problematic. Click here for more details.

@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "1.9.0"
32
+ __version__ = "1.9.1"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "2.7.0"
@@ -41,7 +41,8 @@ class OperatorLineage:
41
41
 
42
42
 
43
43
  class BaseExtractor(ABC, LoggingMixin):
44
- """Abstract base extractor class.
44
+ """
45
+ Abstract base extractor class.
45
46
 
46
47
  This is used mostly to maintain support for custom extractors.
47
48
  """
@@ -55,7 +56,8 @@ class BaseExtractor(ABC, LoggingMixin):
55
56
  @classmethod
56
57
  @abstractmethod
57
58
  def get_operator_classnames(cls) -> list[str]:
58
- """Get a list of operators that extractor works for.
59
+ """
60
+ Get a list of operators that extractor works for.
59
61
 
60
62
  This is an abstract method that subclasses should implement. There are
61
63
  operators that work very similarly and one extractor can cover.
@@ -77,7 +79,8 @@ class DefaultExtractor(BaseExtractor):
77
79
 
78
80
  @classmethod
79
81
  def get_operator_classnames(cls) -> list[str]:
80
- """Assign this extractor to *no* operators.
82
+ """
83
+ Assign this extractor to *no* operators.
81
84
 
82
85
  Default extractor is chosen not on the classname basis, but
83
86
  by existence of get_openlineage_facets method on operator.
@@ -28,8 +28,9 @@ def get_provider_info():
28
28
  "name": "OpenLineage Airflow",
29
29
  "description": "`OpenLineage <https://openlineage.io/>`__\n",
30
30
  "state": "ready",
31
- "source-date-epoch": 1718605195,
31
+ "source-date-epoch": 1720423723,
32
32
  "versions": [
33
+ "1.9.1",
33
34
  "1.9.0",
34
35
  "1.8.0",
35
36
  "1.7.1",
@@ -139,7 +139,8 @@ class OpenLineageAdapter(LoggingMixin):
139
139
  )
140
140
 
141
141
  def emit(self, event: RunEvent):
142
- """Emit OpenLineage event.
142
+ """
143
+ Emit OpenLineage event.
143
144
 
144
145
  :param event: Event to be emitted.
145
146
  :return: Redacted Event.
@@ -295,11 +296,17 @@ class OpenLineageAdapter(LoggingMixin):
295
296
  """
296
297
  error_facet = {}
297
298
  if error:
298
- if isinstance(error, BaseException):
299
+ stack_trace = None
300
+ if isinstance(error, BaseException) and error.__traceback__:
299
301
  import traceback
300
302
 
301
- error = "\\n".join(traceback.format_exception(type(error), error, error.__traceback__))
302
- error_facet = {"errorMessage": ErrorMessageRunFacet(message=error, programmingLanguage="python")}
303
+ stack_trace = "\\n".join(traceback.format_exception(type(error), error, error.__traceback__))
304
+
305
+ error_facet = {
306
+ "errorMessage": ErrorMessageRunFacet(
307
+ message=str(error), programmingLanguage="python", stackTrace=stack_trace
308
+ )
309
+ }
303
310
 
304
311
  event = RunEvent(
305
312
  eventType=RunState.FAIL,
@@ -102,7 +102,8 @@ class AirflowRunFacet(BaseFacet):
102
102
 
103
103
  @define(slots=False)
104
104
  class UnknownOperatorInstance(RedactMixin):
105
- """Describes an unknown operator.
105
+ """
106
+ Describes an unknown operator.
106
107
 
107
108
  This specifies the (class) name of the operator and its properties.
108
109
  """
@@ -367,7 +367,7 @@ class OpenLineageListener:
367
367
  except BaseException:
368
368
  # Kill the process directly.
369
369
  self._terminate_with_wait(process)
370
- self.log.warning("Process with pid %s finished - parent", pid)
370
+ self.log.debug("Process with pid %s finished - parent", pid)
371
371
  else:
372
372
  setproctitle(getproctitle() + " - OpenLineage - " + callable_name)
373
373
  configure_orm(disable_connection_pool=True)
@@ -381,7 +381,7 @@ class OpenLineageListener:
381
381
  if not self._executor:
382
382
  self._executor = ProcessPoolExecutor(
383
383
  max_workers=conf.dag_state_change_process_pool_size(),
384
- initializer=_executor_initializer(),
384
+ initializer=_executor_initializer,
385
385
  )
386
386
  return self._executor
387
387
 
@@ -118,7 +118,8 @@ def from_table_meta(
118
118
 
119
119
 
120
120
  class SQLParser(LoggingMixin):
121
- """Interface for openlineage-sql.
121
+ """
122
+ Interface for openlineage-sql.
122
123
 
123
124
  :param dialect: dialect specific to the database
124
125
  :param default_schema: schema applied to each table with no schema parsed
@@ -244,7 +245,8 @@ class SQLParser(LoggingMixin):
244
245
  sqlalchemy_engine: Engine | None = None,
245
246
  use_connection: bool = True,
246
247
  ) -> OperatorLineage:
247
- """Parse SQL statement(s) and generate OpenLineage metadata.
248
+ """
249
+ Parse SQL statement(s) and generate OpenLineage metadata.
248
250
 
249
251
  Generated OpenLineage metadata contains:
250
252
 
@@ -32,7 +32,8 @@ log = logging.getLogger(__name__)
32
32
 
33
33
 
34
34
  def enable_lineage(obj: T) -> T:
35
- """Set selective enable OpenLineage parameter to True.
35
+ """
36
+ Set selective enable OpenLineage parameter to True.
36
37
 
37
38
  The method also propagates param to tasks if the object is DAG.
38
39
  """
@@ -48,7 +49,8 @@ def enable_lineage(obj: T) -> T:
48
49
 
49
50
 
50
51
  def disable_lineage(obj: T) -> T:
51
- """Set selective enable OpenLineage parameter to False.
52
+ """
53
+ Set selective enable OpenLineage parameter to False.
52
54
 
53
55
  The method also propagates param to tasks if the object is DAG.
54
56
  """
@@ -73,7 +75,8 @@ def is_task_lineage_enabled(task: Operator) -> bool:
73
75
 
74
76
 
75
77
  def is_dag_lineage_enabled(dag: DAG) -> bool:
76
- """Check if DAG is selectively enabled to emit OpenLineage events.
78
+ """
79
+ Check if DAG is selectively enabled to emit OpenLineage events.
77
80
 
78
81
  The method also checks if selective enable parameter is set to True
79
82
  or if any of the tasks in DAG is selectively enabled.
@@ -85,7 +85,8 @@ def get_table_schemas(
85
85
  in_query: str | None,
86
86
  out_query: str | None,
87
87
  ) -> tuple[list[Dataset], list[Dataset]]:
88
- """Query database for table schemas.
88
+ """
89
+ Query database for table schemas.
89
90
 
90
91
  Uses provided hook. Responsibility to provide queries for this function is on particular extractors.
91
92
  If query for input or output table isn't provided, the query is skipped.
@@ -111,7 +112,8 @@ def get_table_schemas(
111
112
 
112
113
 
113
114
  def parse_query_result(cursor) -> list[TableSchema]:
114
- """Fetch results from DB-API 2.0 cursor and creates list of table schemas.
115
+ """
116
+ Fetch results from DB-API 2.0 cursor and creates list of table schemas.
115
117
 
116
118
  For each row it creates :class:`TableSchema`.
117
119
  """
@@ -150,7 +150,7 @@ class InfoJsonEncodable(dict):
150
150
  return value.isoformat()
151
151
  if isinstance(value, datetime.timedelta):
152
152
  return f"{value.total_seconds()} seconds"
153
- if isinstance(value, (set, list, tuple)):
153
+ if isinstance(value, (set, tuple)):
154
154
  return str(list(value))
155
155
  return value
156
156
 
@@ -214,6 +214,12 @@ class TaskInstanceInfo(InfoJsonEncodable):
214
214
  }
215
215
 
216
216
 
217
+ class DatasetInfo(InfoJsonEncodable):
218
+ """Defines encoding Airflow Dataset object to JSON."""
219
+
220
+ includes = ["uri", "extra"]
221
+
222
+
217
223
  class TaskInfo(InfoJsonEncodable):
218
224
  """Defines encoding BaseOperator/AbstractOperator object to JSON."""
219
225
 
@@ -242,6 +248,9 @@ class TaskInfo(InfoJsonEncodable):
242
248
  "run_as_user",
243
249
  "sla",
244
250
  "task_id",
251
+ "trigger_dag_id",
252
+ "external_dag_id",
253
+ "external_task_id",
245
254
  "trigger_rule",
246
255
  "upstream_task_ids",
247
256
  "wait_for_downstream",
@@ -255,6 +264,8 @@ class TaskInfo(InfoJsonEncodable):
255
264
  if hasattr(task, "task_group") and getattr(task.task_group, "_group_id", None)
256
265
  else None
257
266
  ),
267
+ "inlets": lambda task: [DatasetInfo(inlet) for inlet in task.inlets],
268
+ "outlets": lambda task: [DatasetInfo(outlet) for outlet in task.outlets],
258
269
  }
259
270
 
260
271
 
@@ -360,12 +371,13 @@ def _get_parsed_dag_tree(dag: DAG) -> dict:
360
371
  # Determine the level by counting the leading spaces, assuming 4 spaces per level
361
372
  # as defined in airflow.models.dag.DAG._generate_tree_view()
362
373
  level = (len(line) - len(stripped_line)) // 4
363
- # airflow.models.baseoperator.BaseOperator.__repr__ is used in DAG tree
364
- # <Task({op_class}): {task_id}>
365
- match = re.match(r"^<Task\((.+)\): (.*?)>$", stripped_line)
374
+ # airflow.models.baseoperator.BaseOperator.__repr__ or
375
+ # airflow.models.mappedoperator.MappedOperator.__repr__ is used in DAG tree
376
+ # <Task({op_class}): {task_id}> or <Mapped({op_class}): {task_id}>
377
+ match = re.match(r"^<(?:Task|Mapped)\(.+\): (.+)>$", stripped_line)
366
378
  if not match:
367
379
  return {}
368
- current_task_id = match[2]
380
+ current_task_id = match[1]
369
381
 
370
382
  if level == 0: # It's a root task
371
383
  task_dict[current_task_id] = {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-openlineage
3
- Version: 1.9.0rc1
3
+ Version: 1.9.1
4
4
  Summary: Provider package apache-airflow-providers-openlineage for Apache Airflow
5
5
  Keywords: airflow-provider,openlineage,airflow,integration
6
6
  Author-email: Apache Software Foundation <dev@airflow.apache.org>
@@ -21,15 +21,15 @@ Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
22
  Classifier: Programming Language :: Python :: 3.12
23
23
  Classifier: Topic :: System :: Monitoring
24
- Requires-Dist: apache-airflow-providers-common-sql>=1.6.0rc0
25
- Requires-Dist: apache-airflow>=2.7.0rc0
24
+ Requires-Dist: apache-airflow-providers-common-sql>=1.6.0
25
+ Requires-Dist: apache-airflow>=2.7.0
26
26
  Requires-Dist: attrs>=22.2
27
27
  Requires-Dist: openlineage-integration-common>=1.16.0
28
28
  Requires-Dist: openlineage-python>=1.16.0
29
29
  Requires-Dist: apache-airflow-providers-common-sql ; extra == "common.sql"
30
30
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
31
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.9.0/changelog.html
32
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.9.0
31
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.9.1/changelog.html
32
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.9.1
33
33
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
34
34
  Project-URL: Source Code, https://github.com/apache/airflow
35
35
  Project-URL: Twitter, https://twitter.com/ApacheAirflow
@@ -80,7 +80,7 @@ Provides-Extra: common.sql
80
80
 
81
81
  Package ``apache-airflow-providers-openlineage``
82
82
 
83
- Release: ``1.9.0.rc1``
83
+ Release: ``1.9.1``
84
84
 
85
85
 
86
86
  `OpenLineage <https://openlineage.io/>`__
@@ -93,7 +93,7 @@ This is a provider package for ``openlineage`` provider. All classes for this pr
93
93
  are in ``airflow.providers.openlineage`` python package.
94
94
 
95
95
  You can find package information and changelog for the provider
96
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.9.0/>`_.
96
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.9.1/>`_.
97
97
 
98
98
  Installation
99
99
  ------------
@@ -137,4 +137,4 @@ Dependent package
137
137
  ============================================================================================================ ==============
138
138
 
139
139
  The changelog for the provider package can be found in the
140
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.9.0/changelog.html>`_.
140
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.9.1/changelog.html>`_.
@@ -1,10 +1,10 @@
1
1
  airflow/providers/openlineage/LICENSE,sha256=FFb4jd2AXnOOf7XLP04pQW6jbdhG49TxlGY6fFpCV1Y,13609
2
- airflow/providers/openlineage/__init__.py,sha256=wyNzY61gCpS2r6Wx-q-JiM8TbOKgTbDVngFZmcVmqOc,1498
2
+ airflow/providers/openlineage/__init__.py,sha256=bDqRpjqfCE-UNXjjy8Ph6IFG8z5fdRrKJ9pOcX_nVuU,1498
3
3
  airflow/providers/openlineage/conf.py,sha256=ZHUZF3wjFGupfFa40F1DjZSkOQJCUtWFyQM3nvz6Bq4,5099
4
- airflow/providers/openlineage/get_provider_info.py,sha256=v-KK3oIOhEr-LE1WE8J6MaduGde709qiUmbkOklREn4,7472
5
- airflow/providers/openlineage/sqlparser.py,sha256=nMUA7Ak2HNfnGZ1PybWbNPENZfQIcJ1eE8AMh9UD-O8,15653
4
+ airflow/providers/openlineage/get_provider_info.py,sha256=diZ2iRGa-47G5qbtylQ6gIXnN8rHXhTFmSK_mnJoaeE,7493
5
+ airflow/providers/openlineage/sqlparser.py,sha256=qX2ID75PH11-youFvRdRHqZbYzLdbm95H3STvbBzGb8,15667
6
6
  airflow/providers/openlineage/extractors/__init__.py,sha256=I0X4f6zUniclyD9zT0DFHRImpCpJVP4MkPJT3cd7X5I,1081
7
- airflow/providers/openlineage/extractors/base.py,sha256=o6z8bXwNor1hwcUzezJ8LIPynR_BqXkP-qtwEgLtD2Q,5476
7
+ airflow/providers/openlineage/extractors/base.py,sha256=D-ll2cz_WWv1XYh2_UfzmpCl8S5iC2aptFTy2sWZeHY,5499
8
8
  airflow/providers/openlineage/extractors/bash.py,sha256=m4hLvDV4-zX4gp8apRuhpAR3Uakr8UOUxf-thTWmOxw,2563
9
9
  airflow/providers/openlineage/extractors/manager.py,sha256=9TyszMLAsgPS9NETWq7fPJjxcbTFk47x4kd1NRGCvsw,10315
10
10
  airflow/providers/openlineage/extractors/python.py,sha256=EQXCj2aHr2XXw0pNxeX-ii8UQFCoqkdf40ozqmA5d58,3151
@@ -13,16 +13,16 @@ airflow/providers/openlineage/facets/AirflowRunFacet.json,sha256=Mk85_KKwBOEcn_p
13
13
  airflow/providers/openlineage/facets/AirflowStateRunFacet.json,sha256=xhHQEKD9Jopw-oqbkCCrrwFjfXnxvuJAritsmegKjuQ,937
14
14
  airflow/providers/openlineage/facets/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
15
15
  airflow/providers/openlineage/plugins/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
16
- airflow/providers/openlineage/plugins/adapter.py,sha256=nm8muyX-CwBaCNy_YDYbz-iFNL4msVZX6gFb4EaI-YE,18552
17
- airflow/providers/openlineage/plugins/facets.py,sha256=t60uCyp-FZKAeO7PSom5eAbn0cilN_Mfciip4FWG22M,4445
18
- airflow/providers/openlineage/plugins/listener.py,sha256=dk7omQItGSLcVw6bK56ScxLTnYQyQa1bXz2Fw402cjA,17956
16
+ airflow/providers/openlineage/plugins/adapter.py,sha256=s0-eQw7cqzlUbznHdnLWihmdLKczHjuDj1TYYmJSK04,18720
17
+ airflow/providers/openlineage/plugins/facets.py,sha256=kNxxnibLurcv8SV0qXPkwXxpKWhByo745vcqzWGNMIs,4450
18
+ airflow/providers/openlineage/plugins/listener.py,sha256=q6r63SS3ZKdZKyTlEhw8c12onHh7kQCQ-_G1kA67btw,17952
19
19
  airflow/providers/openlineage/plugins/macros.py,sha256=hgFA3ZdQibyn4KXIOsKYBm4WRKDLA5q6Asscx5rvNfM,3076
20
20
  airflow/providers/openlineage/plugins/openlineage.py,sha256=rsRUW_zpXVAglzsgQRv5T9VWYY7CMQl0qRWm8-3oqDA,1678
21
21
  airflow/providers/openlineage/utils/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
22
- airflow/providers/openlineage/utils/selective_enable.py,sha256=JVTmXdQknBL-9N0drFDkVMf1HCf8C6nbITVaP4-5ba4,3072
23
- airflow/providers/openlineage/utils/sql.py,sha256=yNBGMnWMECHtbpTh5nlaQh01O__LWkeQaSqrOVRWz6Y,9524
24
- airflow/providers/openlineage/utils/utils.py,sha256=QBg4B-isDrizb53cQFOflFx8LVKiabwE08I70I0AxOY,19485
25
- apache_airflow_providers_openlineage-1.9.0rc1.dist-info/entry_points.txt,sha256=GAx0_i2OeZzqaiiiYuA-xchICDXiCT5kVqpKSxsOjt4,214
26
- apache_airflow_providers_openlineage-1.9.0rc1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
27
- apache_airflow_providers_openlineage-1.9.0rc1.dist-info/METADATA,sha256=kamPdoPzxHZpb788jJ_RhWSQUgR1U76rKpRnraIm5Qg,6381
28
- apache_airflow_providers_openlineage-1.9.0rc1.dist-info/RECORD,,
22
+ airflow/providers/openlineage/utils/selective_enable.py,sha256=dFJ7wK7J_-BFwcOKp9tqFOSrASV3lmLv7HtRkEuMk3Q,3087
23
+ airflow/providers/openlineage/utils/sql.py,sha256=5K3qFhevq-R4CDUZbq-XfFKPLWixIOtaypRem3jiHvw,9534
24
+ airflow/providers/openlineage/utils/utils.py,sha256=cmPynb5QqZRV6Wzya-6cEcJUrCZjYm-4r4Z6NxwMzCc,19962
25
+ apache_airflow_providers_openlineage-1.9.1.dist-info/entry_points.txt,sha256=GAx0_i2OeZzqaiiiYuA-xchICDXiCT5kVqpKSxsOjt4,214
26
+ apache_airflow_providers_openlineage-1.9.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
27
+ apache_airflow_providers_openlineage-1.9.1.dist-info/METADATA,sha256=naW8pSs4fWp5BmV8wo5dbJa3buwt3uWWObAVfB0NMMg,6368
28
+ apache_airflow_providers_openlineage-1.9.1.dist-info/RECORD,,