chromeperf: Fix updated_time in signal quality
Get current timestamp in the pipeline because dataflow template will
evaluate all global variables which fixing current timestamp to the time
template created.
Change-Id: I43a967b7a24b76562a77fc0f3a86b35c1d4cf6eb
Reviewed-on: https://chromium-review.googlesource.com/c/infra/infra/+/2834956
Auto-Submit: Chenlin Fan <fancl@chromium.org>
Commit-Queue: Dean Berris <dberris@chromium.org>
Reviewed-by: Dean Berris <dberris@chromium.org>
Cr-Commit-Position: refs/heads/master@{#40224}
diff --git a/chromeperf/src/chromeperf_pipelines/write_signal_quality.py b/chromeperf/src/chromeperf_pipelines/write_signal_quality.py
index 46ec364..fde61d1 100644
--- a/chromeperf/src/chromeperf_pipelines/write_signal_quality.py
+++ b/chromeperf/src/chromeperf_pipelines/write_signal_quality.py
@@ -3,7 +3,6 @@
# found in the LICENSE file.
import logging
-import datetime
import apache_beam as beam
from apache_beam.io.gcp.datastore.v1new import datastoreio
@@ -12,7 +11,9 @@
from apache_beam.options.pipeline_options import PipelineOptions
-def make_signal_quality_entities(project, now, p):
+def make_signal_quality_entities(project, p):
+ import datetime
+
from apache_beam.io.gcp.datastore.v1new.types import Entity
from apache_beam.io.gcp.datastore.v1new.types import Key
@@ -32,7 +33,7 @@
entity = Entity(key)
entity.set_properties({
'score': score,
- 'updated_time': now,
+ 'updated_time': datetime.datetime.now(),
})
return entity
@@ -73,7 +74,6 @@
)
entities = make_signal_quality_entities(
project,
- datetime.datetime.now(),
bisections,
)
entities | 'WriteToDatastore' >> datastoreio.WriteToDatastore(project)