kaxil commented on code in PR #59835:
URL: https://github.com/apache/airflow/pull/59835#discussion_r2651015572
##########
airflow-core/src/airflow/task/priority_strategy.py:
##########
@@ -41,46 +42,22 @@ class PriorityWeightStrategy(ABC):
"""
@abstractmethod
- def get_weight(self, ti: TaskInstance):
+ def get_weight(self, ti: TaskInstance) -> int:
"""Get the priority weight of a task."""
- ...
-
- @classmethod
- def deserialize(cls, data: dict[str, Any]) -> PriorityWeightStrategy:
- """
- Deserialize a priority weight strategy from data.
-
- This is called when a serialized DAG is deserialized. ``data`` will be
whatever
- was returned by ``serialize`` during DAG serialization. The default
- implementation constructs the priority weight strategy without any
arguments.
- """
- return cls(**data)
-
- def serialize(self) -> dict[str, Any]:
- """
- Serialize the priority weight strategy for JSON encoding.
-
- This is called during DAG serialization to store priority weight
strategy information
- in the database. This should return a JSON-serializable dict that will
be fed into
- ``deserialize`` when the DAG is deserialized. The default
implementation returns
- an empty dict.
- """
- return {}
+ raise NotImplementedError("must be implemented by a subclass")
def __eq__(self, other: object) -> bool:
"""Equality comparison."""
- if not isinstance(other, type(self)):
- return False
- return self.serialize() == other.serialize()
+ return isinstance(other, type(self))
- def __hash__(self):
- return hash(self.serialize())
+ def __hash__(self) -> int:
+ return hash(None)
Review Comment:
Naah that explains -- its fine as-is
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]