OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 # Copyright 2014 The LUCI Authors. All rights reserved. | 2 # Copyright 2014 The LUCI Authors. All rights reserved. |
3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
5 | 5 |
6 """Base class for handlers_*_test.py""" | 6 """Base class for handlers_*_test.py""" |
7 | 7 |
8 import base64 | 8 import base64 |
9 import json | 9 import json |
10 import os | 10 import os |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 'properties': props, | 256 'properties': props, |
257 'tags': [], | 257 'tags': [], |
258 'user': 'joe@localhost', | 258 'user': 'joe@localhost', |
259 } | 259 } |
260 params.update(kwargs) | 260 params.update(kwargs) |
261 | 261 |
262 # Note that protorpc message constructor accepts dicts for submessages. | 262 # Note that protorpc message constructor accepts dicts for submessages. |
263 request = swarming_rpcs.NewTaskRequest(**params) | 263 request = swarming_rpcs.NewTaskRequest(**params) |
264 response = self.endpoint_call( | 264 response = self.endpoint_call( |
265 handlers_endpoints.SwarmingTasksService, 'new', request) | 265 handlers_endpoints.SwarmingTasksService, 'new', request) |
266 return response, response['task_id'] | 266 return request, response, response['task_id'] |
267 | 267 |
268 def client_create_task_isolated(self, properties=None, **kwargs): | 268 def client_create_task_isolated(self, properties=None, **kwargs): |
269 properties = (properties or {}).copy() | 269 properties = (properties or {}).copy() |
270 properties['inputs_ref'] = { | 270 properties['inputs_ref'] = { |
271 'isolated': '0123456789012345678901234567890123456789', | 271 'isolated': '0123456789012345678901234567890123456789', |
272 'isolatedserver': 'http://localhost:1', | 272 'isolatedserver': 'http://localhost:1', |
273 'namespace': 'default-gzip', | 273 'namespace': 'default-gzip', |
274 } | 274 } |
275 return self._client_create_task(properties, **kwargs) | 275 return self._client_create_task(properties, **kwargs) |
276 | 276 |
277 def client_create_task_raw(self, properties=None, **kwargs): | 277 def client_create_task_raw(self, properties=None, **kwargs): |
278 """Creates a raw command TaskRequest via the Cloud Endpoints API.""" | 278 """Creates a raw command TaskRequest via the Cloud Endpoints API.""" |
279 properties = (properties or {}).copy() | 279 properties = (properties or {}).copy() |
280 properties['command'] = ['python', 'run_test.py'] | 280 properties['command'] = ['python', 'run_test.py'] |
281 return self._client_create_task(properties, **kwargs) | 281 return self._client_create_task(properties, **kwargs) |
282 | 282 |
283 def client_get_results(self, task_id): | 283 def client_get_results(self, task_id): |
284 return self.endpoint_call( | 284 return self.endpoint_call( |
285 handlers_endpoints.SwarmingTaskService, 'result', {'task_id': task_id}) | 285 handlers_endpoints.SwarmingTaskService, 'result', {'task_id': task_id}) |
OLD | NEW |