From 27c2494db713f83397828fce23ff17e2b13f63ae Mon Sep 17 00:00:00 2001 From: Paul Tindall Date: Sun, 17 Jan 2021 12:10:16 -0600 Subject: [PATCH] Add a UTC date to the marker document and /venv to the .gitignore --- .gitignore | 1 + luigi/contrib/esindex.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 819fe424a1..14edacf645 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,7 @@ var/ *.egg-info/ .installed.cfg *.egg +venv/ # PyInstaller # Usually these files are written by a python script from a template diff --git a/luigi/contrib/esindex.py b/luigi/contrib/esindex.py index d7f71dfbd3..0612febed4 100644 --- a/luigi/contrib/esindex.py +++ b/luigi/contrib/esindex.py @@ -169,7 +169,9 @@ def touch(self): The document id would be sufficient but, for documentation, - we index the parameters `update_id`, `target_index`, `target_doc_type` and `date` as well. + we index the parameters `update_id`, `target_index`, `target_doc_type` and `date` as well. `date_utc` added + so we can be sure to get the actual date and time based upon UTC and not the client date and time based on the + client machine. """ self.create_marker_index() self.es.index(index=self.marker_index, doc_type=self.marker_doc_type, @@ -177,7 +179,8 @@ def touch(self): 'update_id': self.update_id, 'target_index': self.index, 'target_doc_type': self.doc_type, - 'date': datetime.datetime.now()}) + 'date': datetime.datetime.now(), + 'date_utc': datetime.datetime.utcnow()}) self.es.indices.flush(index=self.marker_index) self.ensure_hist_size()