openlineage-python 1.29.0__tar.gz → 1.30.1__tar.gz
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.
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/PKG-INFO +1 -1
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/client.py +10 -4
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/constants.py +1 -1
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/pyproject.toml +1 -1
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/test_client.py +127 -79
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/.gitignore +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/README.md +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/docs/Makefile +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/docs/conf.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/docs/convert.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/docs/index.rst +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/docs/make.bat +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/docs/source/openlineage.client.rst +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/__init__.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/event_v2.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/facet.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/facet_v2.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/facets.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/filter.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/base.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/column_lineage_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/data_quality_assertions_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/data_quality_metrics_input_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/dataset_type_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/dataset_version_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/datasource_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/documentation_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/documentation_job.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/environment_variables_run.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/error_message_run.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/external_query_run.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/extraction_error_run.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/input_statistics_input_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/job_type_job.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/lifecycle_state_change_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/nominal_time_run.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/output_statistics_output_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/ownership_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/ownership_job.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/parent_run.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/processing_engine_run.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/schema_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/source_code_job.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/source_code_location_job.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/sql_job.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/storage_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/symlinks_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/tags_dataset.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/tags_job.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/tags_run.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/py.typed +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/run.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/serde.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/tags.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/__init__.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/composite.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/console.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/factory.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/file.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/http.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/kafka.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/msk_iam.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/noop.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/transport.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/utils.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/uuid.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/redact_fields.yml +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/__init__.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/config/config.yml +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/config/exact_filter.yml +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/config/http.yml +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/config/openlineage.yml +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/config/regex_filter.yml +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/conftest.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/example_full_event.json +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/nominal_time_without_end.json +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/serde_example_dataset_event.json +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/serde_example_job_event.json +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/serde_example_run_event.json +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/test_composite.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/test_events.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/test_facet.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/test_facet_v2.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/test_factory.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/test_file.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/test_http.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/test_kafka.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/test_msk_iam.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/test_utils.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/test_uuid.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/transport.py +0 -0
- {openlineage_python-1.29.0 → openlineage_python-1.30.1}/tox.ini +0 -0
|
@@ -420,15 +420,21 @@ class OpenLineageClient:
|
|
|
420
420
|
"""
|
|
421
421
|
Creates or updates job and run tag facets based on user-supplied environment variables
|
|
422
422
|
"""
|
|
423
|
+
run_event_types = (RunEvent, event_v2.RunEvent)
|
|
424
|
+
run_and_job_event_types = (RunEvent, event_v2.RunEvent, JobEvent, event_v2.JobEvent)
|
|
423
425
|
tags_job = self.config.tags.job
|
|
424
|
-
if
|
|
426
|
+
if isinstance(event, run_and_job_event_types) and tags_job:
|
|
427
|
+
# Ensure facets exists
|
|
428
|
+
event.job.facets = {} if not event.job.facets else event.job.facets
|
|
425
429
|
tags_facet = event.job.facets.get("tags", TagsJobFacet())
|
|
426
|
-
event.job.facets["tags"] = self._update_tag_facet(tags_facet, tags_job) # type: ignore [arg-type]
|
|
430
|
+
event.job.facets["tags"] = self._update_tag_facet(tags_facet, tags_job) # type: ignore [arg-type, assignment]
|
|
427
431
|
|
|
428
432
|
tags_run = self.config.tags.run
|
|
429
|
-
if
|
|
433
|
+
if isinstance(event, run_event_types) and tags_run:
|
|
434
|
+
# Ensure facets exists
|
|
435
|
+
event.run.facets = {} if not event.run.facets else event.run.facets
|
|
430
436
|
tags_facet = event.run.facets.get("tags", TagsRunFacet())
|
|
431
|
-
event.run.facets["tags"] = self._update_tag_facet(tags_facet, tags_run) # type: ignore [arg-type]
|
|
437
|
+
event.run.facets["tags"] = self._update_tag_facet(tags_facet, tags_run) # type: ignore [arg-type, assignment]
|
|
432
438
|
|
|
433
439
|
return event
|
|
434
440
|
|
|
@@ -9,6 +9,7 @@ from typing import TYPE_CHECKING
|
|
|
9
9
|
from unittest.mock import MagicMock, patch
|
|
10
10
|
|
|
11
11
|
import pytest
|
|
12
|
+
from openlineage.client import event_v2
|
|
12
13
|
from openlineage.client.client import OpenLineageClient, OpenLineageClientOptions, OpenLineageConfig
|
|
13
14
|
from openlineage.client.facets import FacetsConfig
|
|
14
15
|
from openlineage.client.generated.environment_variables_run import (
|
|
@@ -874,20 +875,63 @@ class TestOpenLineageConfigLoader:
|
|
|
874
875
|
assert config == expected_config
|
|
875
876
|
|
|
876
877
|
|
|
877
|
-
|
|
878
|
+
@pytest.fixture(
|
|
879
|
+
scope="module", params=[("V1", RunEvent, Job, Run), ("V2", event_v2.RunEvent, event_v2.Job, event_v2.Run)]
|
|
880
|
+
)
|
|
881
|
+
def run_event_multi(request):
|
|
882
|
+
"""
|
|
883
|
+
Parameterized run events that allow us to test both versions for run events
|
|
884
|
+
"""
|
|
885
|
+
event_version = request.param[0]
|
|
886
|
+
event_type = request.param[1]
|
|
887
|
+
job_type = request.param[2]
|
|
888
|
+
run_type = request.param[3]
|
|
889
|
+
|
|
890
|
+
job = job_type(name="name", namespace="namespace")
|
|
891
|
+
run = run_type(runId="69f4acab-b87d-4fc0-b27b-8ea950370ff3")
|
|
892
|
+
event_args = {
|
|
893
|
+
"eventTime": "2021-11-03T10:53:52.427343",
|
|
894
|
+
"eventType": RunState.START,
|
|
895
|
+
"producer": "producer",
|
|
896
|
+
"schemaURL": "http:foo.com/schema",
|
|
897
|
+
"job": job,
|
|
898
|
+
"run": run,
|
|
899
|
+
}
|
|
900
|
+
if event_version == "V2":
|
|
901
|
+
del event_args["eventType"]
|
|
902
|
+
del event_args["schemaURL"]
|
|
903
|
+
|
|
904
|
+
return event_type(**event_args)
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
@pytest.fixture(scope="module", params=[("V1", JobEvent, Job), ("V2", event_v2.JobEvent, event_v2.Job)])
|
|
908
|
+
def job_event_multi(request):
|
|
909
|
+
"""
|
|
910
|
+
Parameterized job events that allow us to test both versions for job events
|
|
911
|
+
"""
|
|
912
|
+
event_version = request.param[0]
|
|
913
|
+
event_type = request.param[1]
|
|
914
|
+
job_type = request.param[2]
|
|
915
|
+
|
|
916
|
+
job_args = {"name": "name", "namespace": "namespace"}
|
|
917
|
+
job = job_type(**job_args)
|
|
918
|
+
event_args = {
|
|
919
|
+
"eventTime": "2021-11-03T10:53:52.427343",
|
|
920
|
+
"producer": "producer",
|
|
921
|
+
"schemaURL": "http:foo.com/schema",
|
|
922
|
+
"job": job,
|
|
923
|
+
}
|
|
924
|
+
if event_version == "V2":
|
|
925
|
+
del event_args["schemaURL"]
|
|
926
|
+
return event_type(**event_args)
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
def test_client_creates_new_job_tag_facet(transport, run_event_multi):
|
|
878
930
|
tag_environment_variables = {
|
|
879
931
|
"OPENLINEAGE__TAGS__JOB__ENVIRONMENT": "PRODUCTION",
|
|
880
932
|
"OPENLINEAGE__TAGS__JOB__pipeline": "SALES",
|
|
881
933
|
}
|
|
882
934
|
|
|
883
|
-
run_event = RunEvent(
|
|
884
|
-
RunState.START,
|
|
885
|
-
"2021-11-03T10:53:52.427343",
|
|
886
|
-
Run("69f4acab-b87d-4fc0-b27b-8ea950370ff3"),
|
|
887
|
-
Job("openlineage", "job"),
|
|
888
|
-
"producer",
|
|
889
|
-
)
|
|
890
|
-
|
|
891
935
|
tags = [
|
|
892
936
|
TagsJobFacetFields("environment", "PRODUCTION", "USER"),
|
|
893
937
|
TagsJobFacetFields("pipeline", "SALES", "USER"),
|
|
@@ -895,39 +939,25 @@ def test_update_job_tag_facet_creates_new_facet(transport):
|
|
|
895
939
|
|
|
896
940
|
with patch.dict(os.environ, tag_environment_variables):
|
|
897
941
|
client = OpenLineageClient(transport=transport)
|
|
898
|
-
client.emit(
|
|
942
|
+
client.emit(run_event_multi)
|
|
899
943
|
assert transport.event.job.facets.get("tags")
|
|
900
944
|
event_tags = sorted(transport.event.job.facets["tags"].tags, key=lambda x: x.key)
|
|
901
945
|
expected_tags = sorted(tags, key=lambda x: x.key)
|
|
902
946
|
assert event_tags == expected_tags
|
|
903
947
|
|
|
904
948
|
|
|
905
|
-
def
|
|
949
|
+
def test_client_updates_existing_job_tags_facet(transport, run_event_multi):
|
|
906
950
|
tag_environment_variables = {
|
|
907
951
|
"OPENLINEAGE__TAGS__JOB__ENVIRONMENT": "PRODUCTION",
|
|
908
952
|
"OPENLINEAGE__TAGS__JOB__pipeline": "SALES",
|
|
909
953
|
}
|
|
910
954
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
"
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
namespace="openlineage",
|
|
917
|
-
name="job",
|
|
918
|
-
facets={
|
|
919
|
-
"tags": TagsRunFacet(
|
|
920
|
-
tags=[
|
|
921
|
-
TagsJobFacetFields("environment", "STAGING", "USER"),
|
|
922
|
-
TagsJobFacetFields("foo", "bar", "USER"),
|
|
923
|
-
]
|
|
924
|
-
)
|
|
925
|
-
},
|
|
926
|
-
),
|
|
927
|
-
"producer",
|
|
928
|
-
)
|
|
955
|
+
existing_tags = [
|
|
956
|
+
TagsJobFacetFields("environment", "STAGING", "USER"),
|
|
957
|
+
TagsJobFacetFields("foo", "bar", "USER"),
|
|
958
|
+
]
|
|
959
|
+
run_event_multi.job.facets["tags"] = TagsJobFacet(tags=existing_tags)
|
|
929
960
|
|
|
930
|
-
# One existing tag (not updated), one existing tag (updated), one new tag from the user
|
|
931
961
|
tags = [
|
|
932
962
|
TagsJobFacetFields("foo", "bar", "USER"),
|
|
933
963
|
TagsJobFacetFields("environment", "PRODUCTION", "USER"),
|
|
@@ -936,27 +966,19 @@ def test_update_job_tag_facet_updates_existing_facet(transport):
|
|
|
936
966
|
|
|
937
967
|
with patch.dict(os.environ, tag_environment_variables):
|
|
938
968
|
client = OpenLineageClient(transport=transport)
|
|
939
|
-
client.emit(
|
|
969
|
+
client.emit(run_event_multi)
|
|
940
970
|
assert transport.event.job.facets.get("tags")
|
|
941
971
|
event_tags = sorted(transport.event.job.facets["tags"].tags, key=lambda x: x.key)
|
|
942
972
|
expected_tags = sorted(tags, key=lambda x: x.key)
|
|
943
973
|
assert event_tags == expected_tags
|
|
944
974
|
|
|
945
975
|
|
|
946
|
-
def
|
|
976
|
+
def test_client_creates_new_run_tags_facet(transport, run_event_multi):
|
|
947
977
|
tag_environment_variables = {
|
|
948
978
|
"OPENLINEAGE__TAGS__RUN__ENVIRONMENT": "PRODUCTION",
|
|
949
979
|
"OPENLINEAGE__TAGS__RUN__pipeline": "SALES",
|
|
950
980
|
}
|
|
951
981
|
|
|
952
|
-
run_event = RunEvent(
|
|
953
|
-
RunState.START,
|
|
954
|
-
"2021-11-03T10:53:52.427343",
|
|
955
|
-
Run("69f4acab-b87d-4fc0-b27b-8ea950370ff3"),
|
|
956
|
-
Job("openlineage", "job"),
|
|
957
|
-
"producer",
|
|
958
|
-
)
|
|
959
|
-
|
|
960
982
|
tags = [
|
|
961
983
|
TagsRunFacetFields("environment", "PRODUCTION", "USER"),
|
|
962
984
|
TagsRunFacetFields("pipeline", "SALES", "USER"),
|
|
@@ -964,36 +986,24 @@ def test_update_run_tag_facet_creates_new_facet(transport):
|
|
|
964
986
|
|
|
965
987
|
with patch.dict(os.environ, tag_environment_variables):
|
|
966
988
|
client = OpenLineageClient(transport=transport)
|
|
967
|
-
client.emit(
|
|
989
|
+
client.emit(run_event_multi)
|
|
968
990
|
assert transport.event.run.facets.get("tags")
|
|
969
991
|
event_tags = sorted(transport.event.run.facets["tags"].tags, key=lambda x: x.key)
|
|
970
992
|
expected_tags = sorted(tags, key=lambda x: x.key)
|
|
971
993
|
assert event_tags == expected_tags
|
|
972
994
|
|
|
973
995
|
|
|
974
|
-
def
|
|
996
|
+
def test_client_updates_existing_run_tags_facet(transport, run_event_multi):
|
|
975
997
|
tag_environment_variables = {
|
|
976
998
|
"OPENLINEAGE__TAGS__RUN__ENVIRONMENT": "PRODUCTION",
|
|
977
999
|
"OPENLINEAGE__TAGS__RUN__pipeline": "SALES",
|
|
978
1000
|
}
|
|
979
1001
|
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
"
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
facets={
|
|
986
|
-
"tags": TagsJobFacet(
|
|
987
|
-
tags=[
|
|
988
|
-
TagsRunFacetFields("ENVIRONMENT", "STAGING", "USER"),
|
|
989
|
-
TagsRunFacetFields("foo", "bar", "USER"),
|
|
990
|
-
]
|
|
991
|
-
)
|
|
992
|
-
},
|
|
993
|
-
),
|
|
994
|
-
Job("openlineage", "job"),
|
|
995
|
-
"producer",
|
|
996
|
-
)
|
|
1002
|
+
existing_tags = [
|
|
1003
|
+
TagsRunFacetFields("ENVIRONMENT", "STAGING", "USER"),
|
|
1004
|
+
TagsRunFacetFields("foo", "bar", "USER"),
|
|
1005
|
+
]
|
|
1006
|
+
run_event_multi.run.facets["tags"] = TagsRunFacet(tags=existing_tags)
|
|
997
1007
|
|
|
998
1008
|
# One existing tag (not updated), one existing tag (updated), one new tag from the user
|
|
999
1009
|
tags = [
|
|
@@ -1004,36 +1014,25 @@ def test_update_run_tag_facet_updates_existing_facet(transport):
|
|
|
1004
1014
|
|
|
1005
1015
|
with patch.dict(os.environ, tag_environment_variables):
|
|
1006
1016
|
client = OpenLineageClient(transport=transport)
|
|
1007
|
-
client.emit(
|
|
1017
|
+
client.emit(run_event_multi)
|
|
1008
1018
|
assert transport.event.run.facets.get("tags")
|
|
1009
1019
|
event_tags = sorted(transport.event.run.facets["tags"].tags, key=lambda x: x.key)
|
|
1010
1020
|
expected_tags = sorted(tags, key=lambda x: x.key)
|
|
1011
1021
|
assert event_tags == expected_tags
|
|
1012
1022
|
|
|
1013
1023
|
|
|
1014
|
-
def
|
|
1024
|
+
def test_client_keeps_key_case_for_existing_tags(transport, run_event_multi):
|
|
1015
1025
|
tag_environment_variables = {
|
|
1016
1026
|
"OPENLINEAGE__TAGS__RUN__ENVIRONMENT": "PRODUCTION",
|
|
1017
1027
|
"OPENLINEAGE__TAGS__RUN__pipeline": "SALES",
|
|
1018
1028
|
}
|
|
1019
1029
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
"
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
"tags": TagsJobFacet(
|
|
1027
|
-
tags=[
|
|
1028
|
-
TagsRunFacetFields("environment", "STAGING", "USER"),
|
|
1029
|
-
TagsRunFacetFields("PIPELINE", "FINANCE", "USER"),
|
|
1030
|
-
]
|
|
1031
|
-
)
|
|
1032
|
-
},
|
|
1033
|
-
),
|
|
1034
|
-
Job("openlineage", "job"),
|
|
1035
|
-
"producer",
|
|
1036
|
-
)
|
|
1030
|
+
tags = [
|
|
1031
|
+
TagsRunFacetFields("environment", "STAGING", "USER"),
|
|
1032
|
+
TagsRunFacetFields("PIPELINE", "FINANCE", "USER"),
|
|
1033
|
+
]
|
|
1034
|
+
|
|
1035
|
+
run_event_multi.run.facets["tags"] = TagsRunFacet(tags=tags)
|
|
1037
1036
|
|
|
1038
1037
|
tags = [
|
|
1039
1038
|
TagsRunFacetFields("environment", "PRODUCTION", "USER"),
|
|
@@ -1042,8 +1041,57 @@ def test_update_tag_facet_keeps_key_case(transport):
|
|
|
1042
1041
|
|
|
1043
1042
|
with patch.dict(os.environ, tag_environment_variables):
|
|
1044
1043
|
client = OpenLineageClient(transport=transport)
|
|
1045
|
-
client.emit(
|
|
1044
|
+
client.emit(run_event_multi)
|
|
1046
1045
|
assert transport.event.run.facets.get("tags")
|
|
1047
1046
|
event_tags = sorted(transport.event.run.facets["tags"].tags, key=lambda x: x.key)
|
|
1048
1047
|
expected_tags = sorted(tags, key=lambda x: x.key)
|
|
1049
1048
|
assert event_tags == expected_tags
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
def test_client_creates_tag_facets_for_job_events(transport, job_event_multi):
|
|
1052
|
+
"""
|
|
1053
|
+
Same code is used for run and job events to update facets. This just verifies
|
|
1054
|
+
it works for job events.
|
|
1055
|
+
"""
|
|
1056
|
+
tag_environment_variables = {
|
|
1057
|
+
"OPENLINEAGE__TAGS__JOB__environment": "production",
|
|
1058
|
+
"OPENLINEAGE__TAGS__JOB__pipeline": "sales",
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
tags = [
|
|
1062
|
+
TagsJobFacetFields("environment", "production", "USER"),
|
|
1063
|
+
TagsJobFacetFields("pipeline", "sales", "USER"),
|
|
1064
|
+
]
|
|
1065
|
+
|
|
1066
|
+
with patch.dict(os.environ, tag_environment_variables):
|
|
1067
|
+
client = OpenLineageClient(transport=transport)
|
|
1068
|
+
client.emit(job_event_multi)
|
|
1069
|
+
assert transport.event.job.facets.get("tags")
|
|
1070
|
+
event_tags = sorted(transport.event.job.facets["tags"].tags, key=lambda x: x.key)
|
|
1071
|
+
expected_tags = sorted(tags, key=lambda x: x.key)
|
|
1072
|
+
assert event_tags == expected_tags
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
def test_client_does_not_update_run_tags_for_job_events(transport, job_event_multi):
|
|
1076
|
+
"""
|
|
1077
|
+
Verify we do not try to update run tags in a job event. It will throw and exception
|
|
1078
|
+
if we do.
|
|
1079
|
+
"""
|
|
1080
|
+
tag_environment_variables = {
|
|
1081
|
+
"OPENLINEAGE__TAGS__JOB__environment": "production",
|
|
1082
|
+
"OPENLINEAGE__TAGS__JOB__pipeline": "sales",
|
|
1083
|
+
"OPENLINEAGE__TAGS__RUN__pipeline": "sales",
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
tags = [
|
|
1087
|
+
TagsJobFacetFields("environment", "production", "USER"),
|
|
1088
|
+
TagsJobFacetFields("pipeline", "sales", "USER"),
|
|
1089
|
+
]
|
|
1090
|
+
|
|
1091
|
+
with patch.dict(os.environ, tag_environment_variables):
|
|
1092
|
+
client = OpenLineageClient(transport=transport)
|
|
1093
|
+
client.emit(job_event_multi)
|
|
1094
|
+
assert transport.event.job.facets.get("tags")
|
|
1095
|
+
event_tags = sorted(transport.event.job.facets["tags"].tags, key=lambda x: x.key)
|
|
1096
|
+
expected_tags = sorted(tags, key=lambda x: x.key)
|
|
1097
|
+
assert event_tags == expected_tags
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/job_type_job.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/parent_run.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/sql_job.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/tags_dataset.py
RENAMED
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/tags_job.py
RENAMED
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/generated/tags_run.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/__init__.py
RENAMED
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/composite.py
RENAMED
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/console.py
RENAMED
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/factory.py
RENAMED
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/file.py
RENAMED
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/http.py
RENAMED
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/kafka.py
RENAMED
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/msk_iam.py
RENAMED
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/noop.py
RENAMED
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/openlineage/client/transport/transport.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openlineage_python-1.29.0 → openlineage_python-1.30.1}/tests/serde_example_dataset_event.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|