This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/master by this push:
new 5c89515 Make airflow/models/xcom.py Pylint Compatible (#9658)
5c89515 is described below
commit 5c895154ed1d5df4adcdaea06ba65b8153148047
Author: Kaxil Naik <[email protected]>
AuthorDate: Sun Jul 5 07:56:43 2020 +0100
Make airflow/models/xcom.py Pylint Compatible (#9658)
---
airflow/models/dag.py | 2 +-
airflow/models/xcom.py | 10 ++++++++--
scripts/ci/pylint_todo.txt | 1 -
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/airflow/models/dag.py b/airflow/models/dag.py
index 2f51edd..753e606 100644
--- a/airflow/models/dag.py
+++ b/airflow/models/dag.py
@@ -1720,7 +1720,7 @@ class DagTag(Base):
class DagModel(Base):
- """Table containing DAG propoerties"""
+ """Table containing DAG properties"""
__tablename__ = "dag"
"""
diff --git a/airflow/models/xcom.py b/airflow/models/xcom.py
index 6f27e31..05cd8d6 100644
--- a/airflow/models/xcom.py
+++ b/airflow/models/xcom.py
@@ -50,8 +50,7 @@ class BaseXCom(Base, LoggingMixin):
key = Column(String(512, **COLLATION_ARGS), primary_key=True)
value = Column(LargeBinary)
- timestamp = Column(
- UtcDateTime, default=timezone.utcnow, nullable=False)
+ timestamp = Column(UtcDateTime, default=timezone.utcnow, nullable=False)
execution_date = Column(UtcDateTime, primary_key=True)
# source information
@@ -64,6 +63,10 @@ class BaseXCom(Base, LoggingMixin):
"""
@reconstructor
def init_on_load(self):
+ """
+ Called by the ORM after the instance has been loaded from the DB or
otherwise reconstituted
+ i.e automatically deserialize Xcom value when loading from DB.
+ """
try:
self.value = XCom.deserialize_value(self)
except (UnicodeEncodeError, ValueError):
@@ -229,6 +232,7 @@ class BaseXCom(Base, LoggingMixin):
@classmethod
@provide_session
def delete(cls, xcoms, session=None):
+ """Delete Xcom"""
if isinstance(xcoms, XCom):
xcoms = [xcoms]
for xcom in xcoms:
@@ -241,6 +245,7 @@ class BaseXCom(Base, LoggingMixin):
@staticmethod
def serialize_value(value: Any):
+ """Serialize Xcom value to str or pickled object"""
# TODO: "pickling" has been deprecated and JSON is preferred.
# "pickling" will be removed in Airflow 2.0.
if conf.getboolean('core', 'enable_xcom_pickling'):
@@ -256,6 +261,7 @@ class BaseXCom(Base, LoggingMixin):
@staticmethod
def deserialize_value(result) -> Any:
+ """Deserialize Xcom value from str or pickle object"""
# TODO: "pickling" has been deprecated and JSON is preferred.
# "pickling" will be removed in Airflow 2.0.
enable_pickling = conf.getboolean('core', 'enable_xcom_pickling')
diff --git a/scripts/ci/pylint_todo.txt b/scripts/ci/pylint_todo.txt
index b194aa0..42adffa 100644
--- a/scripts/ci/pylint_todo.txt
+++ b/scripts/ci/pylint_todo.txt
@@ -8,7 +8,6 @@
./airflow/models/dagrun.py
./airflow/models/kubernetes.py
./airflow/models/taskinstance.py
-./airflow/models/xcom.py
./airflow/stats.py
./airflow/www/utils.py
./airflow/www/views.py