Chromium Code Reviews| Index: appengine/swarming/handlers_endpoints.py |
| diff --git a/appengine/swarming/handlers_endpoints.py b/appengine/swarming/handlers_endpoints.py |
| index 629d4a1198484ea9dcbf946e9c4cbb5c82c250df..33ccaf803c172dc453acfcde48e17685942978aa 100644 |
| --- a/appengine/swarming/handlers_endpoints.py |
| +++ b/appengine/swarming/handlers_endpoints.py |
| @@ -555,7 +555,34 @@ class SwarmingBotService(remote.Service): |
| task. |
| """ |
| logging.info('%s', request) |
| - bot = get_or_raise(bot_management.get_info_key(request.bot_id)) |
| + bot_id = request.bot_id |
| + bot = bot_management.get_info_key(bot_id).get() |
| + |
|
M-A Ruel
2017/01/31 18:45:04
remove one line or even better both :)
kjlubick
2017/01/31 19:04:40
Done.
|
| + |
| + if not bot: |
| + # If there is not BotInfo, look if there are BotEvent child of this |
| + # entity. If this is the case, it means the bot was deleted but it's |
| + # useful to show information about it to the user even if the bot was |
| + # deleted. For example, it could be an machine-provider bot. |
| + events = bot_management.get_events_query(bot_id, True).fetch(1) |
| + if not events: |
| + raise endpoints.NotFoundException('%s not found.' % bot_id) |
| + bot = bot_management.BotInfo( |
| + key=bot_management.get_info_key(bot_id), |
| + dimensions_flat=bot_management.dimensions_to_flat( |
| + events[0].dimensions), |
| + state=events[0].state, |
| + external_ip=events[0].external_ip, |
| + authenticated_as=events[0].authenticated_as, |
| + version=events[0].version, |
| + quarantined=events[0].quarantined, |
| + task_id=events[0].task_id, |
| + last_seen_ts=events[0].ts, |
| + lease_id=events[0].lease_id, |
| + lease_expiration_ts=events[0].lease_expiration_ts, |
| + machine_type=events[0].machine_type, |
| + deleted=True) |
| + |
| return message_conversion.bot_info_to_rpc(bot, utils.utcnow()) |
|
M-A Ruel
2017/01/31 18:45:04
modify bot_info_to_rpc instead to accept a new fla
kjlubick
2017/01/31 19:04:40
Done.
|
| @gae_ts_mon.instrument_endpoint() |