Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2881)

Unified Diff: appengine/findit/model/wf_swarming_task.py

Issue 2147713002: [Findit] Make sure not use empty list or dict as default value. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: . Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/findit/model/wf_try_job.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/model/wf_swarming_task.py
diff --git a/appengine/findit/model/wf_swarming_task.py b/appengine/findit/model/wf_swarming_task.py
index 88107889460b5b82b97867e4002c7325758c10d8..14939ed667748b5cd0c6baae0a2eb0cf150b870b 100644
--- a/appengine/findit/model/wf_swarming_task.py
+++ b/appengine/findit/model/wf_swarming_task.py
@@ -20,7 +20,7 @@ class WfSwarmingTask(BaseBuildModel):
# A dict to keep track of running information for each test:
# number of total runs, number of each status (such as 'SUCCESS' or 'FAILED')
- tests_statuses = ndb.JsonProperty(default={}, indexed=False, compressed=True)
+ tests_statuses = ndb.JsonProperty(indexed=False, compressed=True)
# The status of the swarming task.
status = ndb.IntegerProperty(
@@ -37,7 +37,7 @@ class WfSwarmingTask(BaseBuildModel):
completed_time = ndb.DateTimeProperty(indexed=False)
# parameters need to be stored and analyzed later.
- parameters = ndb.JsonProperty(default={}, indexed=False, compressed=True)
+ parameters = ndb.JsonProperty(indexed=False, compressed=True)
@property
def classified_tests(self):
@@ -74,9 +74,12 @@ class WfSwarmingTask(BaseBuildModel):
@staticmethod
def Create(
master_name, builder_name, build_number, step_name): # pragma: no cover
- return WfSwarmingTask(
+ task = WfSwarmingTask(
key=WfSwarmingTask._CreateKey(
master_name, builder_name, build_number, step_name))
+ task.parameters = task.parameters or {}
+ task.tests_statuses = task.tests_statuses or {}
+ return task
@staticmethod
def Get(
« no previous file with comments | « no previous file | appengine/findit/model/wf_try_job.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698