You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bo...@apache.org on 2018/01/11 19:26:19 UTC
incubator-airflow git commit: [AIRFLOW-1930] Convert func.now() to
timezone.utcnow()
Repository: incubator-airflow
Updated Branches:
refs/heads/master 804710fda -> d9bbb6312
[AIRFLOW-1930] Convert func.now() to timezone.utcnow()
func.now() defaults to the timezone of the
database,
we assume that everything is in UTC which might
not be
the case if func.now() is used.
Closes #2882 from bolkedebruin/AIRFLOW-1930
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/d9bbb631
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/d9bbb631
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/d9bbb631
Branch: refs/heads/master
Commit: d9bbb63120d71feae5c65f73eeb81ee978a272d8
Parents: 804710f
Author: Bolke de Bruin <bo...@xs4all.nl>
Authored: Thu Jan 11 20:26:13 2018 +0100
Committer: Bolke de Bruin <bo...@xs4all.nl>
Committed: Thu Jan 11 20:26:13 2018 +0100
----------------------------------------------------------------------
airflow/models.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/d9bbb631/airflow/models.py
----------------------------------------------------------------------
diff --git a/airflow/models.py b/airflow/models.py
index ec41b50..f07e985 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -737,7 +737,7 @@ class DagPickle(Base):
"""
id = Column(Integer, primary_key=True)
pickle = Column(PickleType(pickler=dill))
- created_dttm = Column(UtcDateTime, default=func.now())
+ created_dttm = Column(UtcDateTime, default=timezone.utcnow())
pickle_hash = Column(Text)
__tablename__ = "dag_pickle"
@@ -3975,7 +3975,7 @@ class Chart(Base):
"User", cascade=False, cascade_backrefs=False, backref='charts')
x_is_date = Column(Boolean, default=True)
iteration_no = Column(Integer, default=0)
- last_modified = Column(UtcDateTime, default=func.now())
+ last_modified = Column(UtcDateTime, default=timezone.utcnow())
def __repr__(self):
return self.label
@@ -4124,7 +4124,7 @@ class XCom(Base, LoggingMixin):
key = Column(String(512))
value = Column(LargeBinary)
timestamp = Column(
- DateTime, default=func.now(), nullable=False)
+ DateTime, default=timezone.utcnow(), nullable=False)
execution_date = Column(UtcDateTime, nullable=False)
# source information
@@ -4443,8 +4443,8 @@ class DagRun(Base, LoggingMixin):
id = Column(Integer, primary_key=True)
dag_id = Column(String(ID_LEN))
- execution_date = Column(UtcDateTime, default=func.now())
- start_date = Column(UtcDateTime, default=func.now())
+ execution_date = Column(UtcDateTime, default=timezone.utcnow())
+ start_date = Column(UtcDateTime, default=timezone.utcnow())
end_date = Column(UtcDateTime)
_state = Column('state', String(50), default=State.RUNNING)
run_id = Column(String(ID_LEN))