| Index: appengine/swarming/server/task_scheduler.py
|
| diff --git a/appengine/swarming/server/task_scheduler.py b/appengine/swarming/server/task_scheduler.py
|
| index 0d79b0562b7585b3d569635a0055360d48f56c91..be6ce197c40e6e043cc11955800636de418a367e 100644
|
| --- a/appengine/swarming/server/task_scheduler.py
|
| +++ b/appengine/swarming/server/task_scheduler.py
|
| @@ -12,6 +12,7 @@ import logging
|
| import math
|
| import random
|
|
|
| +from google.appengine.api import memcache
|
| from google.appengine.ext import ndb
|
|
|
| from components import auth
|
| @@ -474,14 +475,16 @@ def exponential_backoff(attempt_num):
|
| return min(max_wait, math.pow(1.5, min(attempt_num, 10) + 1))
|
|
|
|
|
| -def schedule_request(request, secret_bytes, check_acls=True):
|
| +def schedule_request(
|
| + request, secret_bytes, check_acls=True, memcache_key_for_task_id=None):
|
| """Creates and stores all the entities to schedule a new task request.
|
|
|
| Checks ACLs first. Raises auth.AuthorizationError if caller is not authorized
|
| to post this request.
|
|
|
| The number of entities created is 3: TaskRequest, TaskToRun and
|
| - TaskResultSummary.
|
| + TaskResultSummary. If memcache_key_for_task_id is not None, sets it to the
|
| + task_id right after creation.
|
|
|
| All 4 entities in the same entity group (TaskReqest, TaskToRun,
|
| TaskResultSummary, SecretBytes) are saved as a DB transaction.
|
| @@ -566,6 +569,8 @@ def schedule_request(request, secret_bytes, check_acls=True):
|
| # be run but the client will not know about it.
|
| datastore_utils.insert(request, get_new_keys,
|
| extra=filter(bool, [task, result_summary, secret_bytes]))
|
| + if memcache_key_for_task_id:
|
| + memcache.set(memcache_key_for_task_id, result_summary.task_id)
|
| logging.debug('New request %s', result_summary.task_id)
|
|
|
| # Get parent task details if applicable.
|
|
|