| 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 """Internal bot API handlers.""" | 5 """Internal bot API handlers.""" |
| 6 | 6 |
| 7 import base64 | 7 import base64 |
| 8 import json | 8 import json |
| 9 import logging | 9 import logging |
| 10 import re | 10 import re |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 'bot_id': bot_id, | 385 'bot_id': bot_id, |
| 386 'command': cmd, | 386 'command': cmd, |
| 387 'dimensions': request.properties.dimensions, | 387 'dimensions': request.properties.dimensions, |
| 388 'env': request.properties.env, | 388 'env': request.properties.env, |
| 389 'extra_args': request.properties.extra_args, | 389 'extra_args': request.properties.extra_args, |
| 390 'grace_period': request.properties.grace_period_secs, | 390 'grace_period': request.properties.grace_period_secs, |
| 391 'hard_timeout': request.properties.execution_timeout_secs, | 391 'hard_timeout': request.properties.execution_timeout_secs, |
| 392 'host': utils.get_versioned_hosturl(), | 392 'host': utils.get_versioned_hosturl(), |
| 393 'io_timeout': request.properties.io_timeout_secs, | 393 'io_timeout': request.properties.io_timeout_secs, |
| 394 'inputs_ref': request.properties.inputs_ref, | 394 'inputs_ref': request.properties.inputs_ref, |
| 395 'packages': [ |
| 396 { |
| 397 'package_name': p.package_name, |
| 398 'version': p.version, |
| 399 } |
| 400 for p in request.properties.packages |
| 401 ], |
| 395 'task_id': task_pack.pack_run_result_key(run_result_key), | 402 'task_id': task_pack.pack_run_result_key(run_result_key), |
| 396 }, | 403 }, |
| 397 } | 404 } |
| 398 self.send_response(utils.to_json_encodable(out)) | 405 self.send_response(utils.to_json_encodable(out)) |
| 399 | 406 |
| 400 def _cmd_sleep(self, sleep_streak, quarantined): | 407 def _cmd_sleep(self, sleep_streak, quarantined): |
| 401 out = { | 408 out = { |
| 402 'cmd': 'sleep', | 409 'cmd': 'sleep', |
| 403 'duration': task_scheduler.exponential_backoff(sleep_streak), | 410 'duration': task_scheduler.exponential_backoff(sleep_streak), |
| 404 'quarantined': quarantined, | 411 'quarantined': quarantined, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 ('/swarming/api/v1/bot/poll', BotPollHandler), | 667 ('/swarming/api/v1/bot/poll', BotPollHandler), |
| 661 ('/swarming/api/v1/bot/server_ping', ServerPingHandler), | 668 ('/swarming/api/v1/bot/server_ping', ServerPingHandler), |
| 662 ('/swarming/api/v1/bot/task_update', BotTaskUpdateHandler), | 669 ('/swarming/api/v1/bot/task_update', BotTaskUpdateHandler), |
| 663 ('/swarming/api/v1/bot/task_update/<task_id:[a-f0-9]+>', | 670 ('/swarming/api/v1/bot/task_update/<task_id:[a-f0-9]+>', |
| 664 BotTaskUpdateHandler), | 671 BotTaskUpdateHandler), |
| 665 ('/swarming/api/v1/bot/task_error', BotTaskErrorHandler), | 672 ('/swarming/api/v1/bot/task_error', BotTaskErrorHandler), |
| 666 ('/swarming/api/v1/bot/task_error/<task_id:[a-f0-9]+>', | 673 ('/swarming/api/v1/bot/task_error/<task_id:[a-f0-9]+>', |
| 667 BotTaskErrorHandler), | 674 BotTaskErrorHandler), |
| 668 ] | 675 ] |
| 669 return [webapp2.Route(*i) for i in routes] | 676 return [webapp2.Route(*i) for i in routes] |
| OLD | NEW |