| OLD | NEW |
| 1 # Copyright 2014 The LUCI Authors. All rights reserved. | 1 # Copyright 2014 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """Bot interface used in bot_config.py.""" | 5 """Bot interface used in bot_config.py.""" |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import time | 9 import time |
| 10 | 10 |
| 11 import os_utilities | 11 import os_utilities |
| 12 from utils import zip_package | |
| 13 | 12 |
| 14 # Method could be a function - pylint: disable=R0201 | 13 # Method could be a function - pylint: disable=R0201 |
| 15 | 14 |
| 16 | 15 |
| 17 class Bot(object): | 16 class Bot(object): |
| 18 def __init__( | 17 def __init__( |
| 19 self, remote, attributes, server, server_version, base_dir, | 18 self, remote, attributes, server, server_version, base_dir, |
| 20 shutdown_hook): | 19 shutdown_hook): |
| 21 # Do not expose attributes for now, as attributes may be refactored. | 20 # Do not expose attributes for now, as attributes may be refactored. |
| 22 assert server is None or not server.endswith('/'), server | 21 assert server is None or not server.endswith('/'), server |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 """Called internally to update Bot.dimensions.""" | 188 """Called internally to update Bot.dimensions.""" |
| 190 dimensions = new_dimensions.copy() | 189 dimensions = new_dimensions.copy() |
| 191 dimensions.update(self._server_side_dimensions) | 190 dimensions.update(self._server_side_dimensions) |
| 192 self._attributes['dimensions'] = dimensions | 191 self._attributes['dimensions'] = dimensions |
| 193 | 192 |
| 194 def _update_state(self, new_state): | 193 def _update_state(self, new_state): |
| 195 """Called internally to update Bot.state.""" | 194 """Called internally to update Bot.state.""" |
| 196 state = new_state.copy() | 195 state = new_state.copy() |
| 197 state['bot_group_cfg_version'] = self._bot_group_cfg_ver | 196 state['bot_group_cfg_version'] = self._bot_group_cfg_ver |
| 198 self._attributes['state'] = state | 197 self._attributes['state'] = state |
| OLD | NEW |