| OLD | NEW |
| 1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed by the Apache v2.0 license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """This module defines Swarming Server endpoints handlers.""" | 5 """This module defines Swarming Server endpoints handlers.""" |
| 6 | 6 |
| 7 import datetime | 7 import datetime |
| 8 import json | 8 import json |
| 9 import logging | 9 import logging |
| 10 | 10 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 when=obj.created_ts, | 162 when=obj.created_ts, |
| 163 version=obj.version) | 163 version=obj.version) |
| 164 | 164 |
| 165 | 165 |
| 166 TaskId = endpoints.ResourceContainer( | 166 TaskId = endpoints.ResourceContainer( |
| 167 message_types.VoidMessage, | 167 message_types.VoidMessage, |
| 168 task_id=messages.StringField(1, required=True)) | 168 task_id=messages.StringField(1, required=True)) |
| 169 | 169 |
| 170 | 170 |
| 171 TaskIdWithPerf = endpoints.ResourceContainer( | 171 TaskIdWithPerf = endpoints.ResourceContainer( |
| 172 swarming_rpcs.PerformanceStatsRequest, | 172 message_types.VoidMessage, |
| 173 task_id=messages.StringField(1, required=True)) | 173 task_id=messages.StringField(1, required=True), |
| 174 include_performance_stats=messages.BooleanField(2, default=False)) |
| 174 | 175 |
| 175 | 176 |
| 176 @swarming_api.api_class(resource_name='task', path='task') | 177 @swarming_api.api_class(resource_name='task', path='task') |
| 177 class SwarmingTaskService(remote.Service): | 178 class SwarmingTaskService(remote.Service): |
| 178 """Swarming's task-related API.""" | 179 """Swarming's task-related API.""" |
| 179 @gae_ts_mon.instrument_endpoint() | 180 @gae_ts_mon.instrument_endpoint() |
| 180 @auth.endpoints_method( | 181 @auth.endpoints_method( |
| 181 TaskIdWithPerf, swarming_rpcs.TaskResult, | 182 TaskIdWithPerf, swarming_rpcs.TaskResult, |
| 182 name='result', | 183 name='result', |
| 183 path='{task_id}/result', | 184 path='{task_id}/result', |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 parts = d.split(':', 1) | 598 parts = d.split(':', 1) |
| 598 if len(parts) != 2 or any(i.strip() != i or not i for i in parts): | 599 if len(parts) != 2 or any(i.strip() != i or not i for i in parts): |
| 599 raise endpoints.BadRequestException('Invalid dimensions') | 600 raise endpoints.BadRequestException('Invalid dimensions') |
| 600 q = q.filter(bot_management.BotInfo.dimensions_flat == d) | 601 q = q.filter(bot_management.BotInfo.dimensions_flat == d) |
| 601 bots, cursor = datastore_utils.fetch_page(q, request.limit, request.cursor) | 602 bots, cursor = datastore_utils.fetch_page(q, request.limit, request.cursor) |
| 602 return swarming_rpcs.BotList( | 603 return swarming_rpcs.BotList( |
| 603 cursor=cursor, | 604 cursor=cursor, |
| 604 death_timeout=config.settings().bot_death_timeout_secs, | 605 death_timeout=config.settings().bot_death_timeout_secs, |
| 605 items=[message_conversion.bot_info_to_rpc(bot, now) for bot in bots], | 606 items=[message_conversion.bot_info_to_rpc(bot, now) for bot in bots], |
| 606 now=now) | 607 now=now) |
| OLD | NEW |