Skip to content

Commit

Permalink
openlineage: make value of slots in attrs.define consistent across al…
Browse files Browse the repository at this point in the history
…l OL usages

Signed-off-by: Kacper Muda <mudakacper@gmail.com>
  • Loading branch information
kacpermuda committed Jul 24, 2024
1 parent eca0555 commit 07ed7c4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions airflow/providers/openlineage/plugins/facets.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
reason="To be removed in the next release. Make sure to use information from AirflowRunFacet instead.",
category=AirflowProviderDeprecationWarning,
)
@define(slots=False)
@define
class AirflowMappedTaskRunFacet(RunFacet):
"""Run facet containing information about mapped tasks."""

Expand All @@ -47,7 +47,7 @@ def from_task_instance(cls, task_instance):
)


@define(slots=True)
@define
class AirflowJobFacet(JobFacet):
"""
Composite Airflow job facet.
Expand All @@ -70,7 +70,7 @@ class AirflowJobFacet(JobFacet):
tasks: dict


@define(slots=True)
@define
class AirflowStateRunFacet(RunFacet):
"""
Airflow facet providing state information.
Expand All @@ -89,7 +89,7 @@ class AirflowStateRunFacet(RunFacet):
tasksState: dict[str, str]


@define(slots=False)
@define
class AirflowRunFacet(RunFacet):
"""Composite Airflow run facet."""

Expand All @@ -100,15 +100,15 @@ class AirflowRunFacet(RunFacet):
taskUuid: str


@define(slots=True)
@define
class AirflowDagRunFacet(RunFacet):
"""Composite Airflow DAG run facet."""

dag: dict
dagRun: dict


@define(slots=False)
@define
class UnknownOperatorInstance(RedactMixin):
"""
Describes an unknown operator.
Expand All @@ -127,7 +127,7 @@ class UnknownOperatorInstance(RedactMixin):
reason="To be removed in the next release. Make sure to use information from AirflowRunFacet instead.",
category=AirflowProviderDeprecationWarning,
)
@define(slots=False)
@define
class UnknownOperatorAttributeRunFacet(RunFacet):
"""RunFacet that describes unknown operators in an Airflow DAG."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ Writing a custom facet function
from airflow.providers.common.compat.openlineage.facet import RunFacet
@attrs.define(slots=False)
@attrs.define
class MyCustomRunFacet(RunFacet):
"""Define a custom facet."""
Expand Down
8 changes: 4 additions & 4 deletions tests/providers/openlineage/plugins/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class TestInfo(InfoJsonEncodable):
casts = {"iwanttobeint": lambda x: int(x.imastring)}
renames = {"_faulty_name": "goody_name"}

@define(slots=False)
@define
class Test:
exclude_1: str
imastring: str
Expand All @@ -122,7 +122,7 @@ def test_info_json_encodable_list_does_not_flatten():
class TestInfo(InfoJsonEncodable):
includes = ["alist"]

@define(slots=False)
@define
class Test:
alist: list[str]

Expand All @@ -135,7 +135,7 @@ def test_info_json_encodable_list_does_include_nonexisting():
class TestInfo(InfoJsonEncodable):
includes = ["exists", "doesnotexist"]

@define(slots=False)
@define
class Test:
exists: str

Expand Down Expand Up @@ -191,7 +191,7 @@ def __init__(self):
self.password = "passwd"
self.transparent = "123"

@define(slots=False)
@define
class NestedMixined(RedactMixin):
_skip_redact = ["nested_field"]
password: str
Expand Down
2 changes: 1 addition & 1 deletion tests/providers/openlineage/utils/custom_facet_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from airflow.models.taskinstance import TaskInstance, TaskInstanceState


@attrs.define(slots=False)
@attrs.define
class MyCustomRunFacet(RunFacet):
"""Define a custom run facet."""

Expand Down

0 comments on commit 07ed7c4

Please sign in to comment.