Index: tools/android/loading/cloud/frontend/clovis_frontend.py |
diff --git a/tools/android/loading/cloud/frontend/clovis_frontend.py b/tools/android/loading/cloud/frontend/clovis_frontend.py |
index 3303b5bd32045cec8dae26fe0ae21c022c7ea2fb..01e4699bb63dac6983504258db3e9c6f86a608dc 100644 |
--- a/tools/android/loading/cloud/frontend/clovis_frontend.py |
+++ b/tools/android/loading/cloud/frontend/clovis_frontend.py |
@@ -268,10 +268,6 @@ def StartFromJsonString(http_body_str): |
task_dir_components.append(task_tag) |
task_dir = os.path.join(task.Action(), '_'.join(task_dir_components)) |
- # Create the instance template if required. |
- if not CreateInstanceTemplate(task, task_dir): |
- return Render('Template creation failed.', memory_logs) |
- |
# Build the URL where the result will live. |
task_url = None |
if task.Action() == 'trace': |
@@ -295,10 +291,6 @@ def StartFromJsonString(http_body_str): |
if not EnqueueTasks(sub_tasks, task_tag): |
return Render('Task creation failed.', memory_logs) |
- # Start the instances if required. |
- if not CreateInstances(task): |
- return Render('Instance creation failed.', memory_logs) |
- |
# Start polling the progress. |
clovis_logger.info('Creating worker polling task.') |
first_poll_delay_minutes = 10 |
@@ -306,6 +298,12 @@ def StartFromJsonString(http_body_str): |
deferred.defer(PollWorkers, task_tag, time.time(), timeout_hours, user_email, |
task_url, _countdown=(60 * first_poll_delay_minutes)) |
+ # Start the instances if required. |
+ if not CreateInstanceTemplate(task, task_dir): |
+ return Render('Instance template creation failed.', memory_logs) |
+ if not CreateInstances(task): |
+ return Render('Instance creation failed.', memory_logs) |
+ |
return Render(flask.Markup( |
'Success!<br>Your task %s has started.<br>' |
'You will be notified at %s when completed.') % (task_tag, user_email), |