innocent_cls_precq: Rename datastore key
"PreCQProcessed" is a better name for the key, because it represents
builds that we have examined, not necessarily builds we took an action
on. Most builds that Pre-CQ-Exonerator examines don't result in a
Trybot-Ready+1 label being applied.
BUG=chromium:793042
TEST=unit tests
Change-Id: Ife33c6302fc502e3049ceb963f154e692b896b01
Reviewed-on: https://chromium-review.googlesource.com/953338
Commit-Ready: Paul Hobbs <phobbs@google.com>
Tested-by: Paul Hobbs <phobbs@google.com>
Reviewed-by: Paul Hobbs <phobbs@google.com>
Reviewed-by: Ningning Xia <nxia@chromium.org>
diff --git a/exonerator/innocent_cls_precq.py b/exonerator/innocent_cls_precq.py
index 864f98e..5ebd901 100644
--- a/exonerator/innocent_cls_precq.py
+++ b/exonerator/innocent_cls_precq.py
@@ -23,7 +23,7 @@
from exonerator import innocent_cls
-_PRECQ_FORGIVEN_KEY = 'PreCQForgiven'
+_PRECQ_PROCESSED_KEY = 'PreCQProcessed'
_SANITY_BUILD_REASON = 'sanity-pre-cq'
# Forgive failed builds up to 3 days before a sanity failure, and 1 day
@@ -91,7 +91,7 @@
def Save(item):
change, build_id = item
logging.info('Inserting Pre-CQ checkpoint row %s.', build_id)
- entity = datastore.Entity(key=ds.key(_PRECQ_FORGIVEN_KEY, build_id))
+ entity = datastore.Entity(key=ds.key(_PRECQ_PROCESSED_KEY, build_id))
# A build may include more than one CL, so add a property to the entity for
# each CL of the build that was processed.
entity.update({change.gerrit_number: True})
@@ -184,7 +184,7 @@
change: A GerritPatchTuple instance.
pre_cq_id: The CIDB build id for the pre-cq run.
"""
- entity = ds.get(key=ds.key(_PRECQ_FORGIVEN_KEY, pre_cq_id))
+ entity = ds.get(key=ds.key(_PRECQ_PROCESSED_KEY, pre_cq_id))
# Each entity stores the CLs that were processed by exonerator for that
# build. For simplicity, assume gerrit_number:change is a one-to-one mapping.
# Technically, this is false, but it's extremely unlikely to affect the
diff --git a/exonerator/innocent_cls_precq_test.py b/exonerator/innocent_cls_precq_test.py
index 52ffc88..dd3258f 100644
--- a/exonerator/innocent_cls_precq_test.py
+++ b/exonerator/innocent_cls_precq_test.py
@@ -105,9 +105,10 @@
def test_NewInnocentCLsAlreadyForgiven(self):
"""If we already forgave the build, we don't forgive it again."""
- key = self.ds.key(innocent_cls_precq._PRECQ_FORGIVEN_KEY,
+ key = self.ds.key(innocent_cls_precq._PRECQ_PROCESSED_KEY,
self.build_ids[-1])
last_run = datastore.Entity(key=key)
+ last_run[1234] = True
self.ds.put(last_run)
new_cls = list(innocent_cls_precq.NewInnocentCLs(self.db))