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

Unified Diff: appengine/swarming/server/task_request.py

Issue 2985753003: swarming: Remove support for task without 'pool' dimension (Closed)
Patch Set: Tweak comments Created 3 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/swarming/server/task_request_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/server/task_request.py
diff --git a/appengine/swarming/server/task_request.py b/appengine/swarming/server/task_request.py
index 063fc2645531e0582db07c00d31f2dcc2e577fdb..d3c66d403a97f767cd41bbd43bf99483bcd94331 100644
--- a/appengine/swarming/server/task_request.py
+++ b/appengine/swarming/server/task_request.py
@@ -162,9 +162,6 @@ def _validate_dimensions(prop, value):
if not config.validate_dimension_value(val):
raise datastore_errors.BadValueError(
u'dimension %r:%r isn\'t valid' % (key, val))
- if u'pool' not in value and u'id' not in value:
- raise datastore_errors.BadValueError(
- u'At least one of \'id\' or \'pool\' must be used as %s' % prop._name)
if len(value) > 64:
raise datastore_errors.BadValueError(
'%s can have up to 64 keys' % prop._name)
@@ -489,7 +486,7 @@ class TaskProperties(ndb.Model):
# Filter to use to determine the required properties on the bot to run on. For
# example, Windows or hostname. Encoded as json. Either 'pool' or 'id'
- # dimension are required (see _validate_dimensions).
+ # dimension are required (see _validate_dimensions and _pre_put_hook).
dimensions = datastore_utils.DeterministicJsonProperty(
validator=_validate_dimensions, json_type=dict, indexed=False)
@@ -554,9 +551,14 @@ class TaskProperties(ndb.Model):
super(TaskProperties, self)._pre_put_hook()
if self.is_terminate:
# Most values are not valid with a terminate task. self.is_terminate
- # already check those.
+ # already check those. Terminate task can only use 'id'.
return
+ if u'pool' not in self.dimensions:
+ # Only terminate task may no use 'pool'. Others must specify one.
+ raise datastore_errors.BadValueError(
+ u'\'pool\' must be used as dimensions')
+
isolated_input = self.inputs_ref and self.inputs_ref.isolated
if not self.command and not isolated_input:
raise datastore_errors.BadValueError(
« no previous file with comments | « no previous file | appengine/swarming/server/task_request_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698