Chromium Code Reviews| 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 """Swarming bot management, e.g. list of known bots and their state. | 5 """Swarming bot management, e.g. list of known bots and their state. |
| 6 | 6 |
| 7 +---------+ | 7 +---------+ |
| 8 |BotRoot | | 8 |BotRoot | |
| 9 |id=bot_id| | 9 |id=bot_id| |
| 10 +---------+ | 10 +---------+ |
| 11 | | 11 | |
| 12 +------+-------+---------------+---------+----- ... -----+ | 12 +-----++-------+---------------+---------+----- ... -----+ |
| 13 | | | | | | 13 | | | | | | |
| 14 v v v v v | 14 v | v v v v |
| 15 +-------+ +-----------+ +--------+ +--------+ +--------+ | 15 +-------+ | +-----------+ +--------+ +--------+ +--------+ |
| 16 |BotInfo| |BotSettings| |BotEvent| |BotEvent| ... |BotEvent| | 16 |BotInfo| | |BotSettings| |BotEvent| |BotEvent| ... |BotEvent| |
| 17 |id=info| |id=settings| |id=fffff| |if=ffffe| ... |id=00000| | 17 |id=info| | |id=settings| |id=fffff| |if=ffffe| ... |id=00000| |
| 18 +-------+ +-----------+ +--------+ +--------+ +--------+ | 18 +-------+ | +-----------+ +--------+ +--------+ +--------+ |
| 19 | | |
| 20 +--------------------+ | |
| 21 | | | |
| 22 v v | |
| 23 +-------------------+ +-------------------+ | |
| 24 |BotTaskDimensions | ... |BotTaskDimensions | | |
|
Vadim Sh.
2017/04/26 18:26:24
do this entities created/deleted separately or alw
M-A Ruel
2017/04/26 21:07:07
That's an excellent question and Michael had raise
Vadim Sh.
2017/04/26 21:24:55
It will require a transaction only if we add dimen
M-A Ruel
2017/04/26 21:30:30
Actually each dimensions_hash has its own expirati
| |
| 25 |id=<dimension_hash>| ... |id=<dimension_hash>| <task_queues.py> | |
| 26 +-------------------+ +-------------------+ | |
| 19 | 27 |
| 20 +--------Root--------+ | 28 +--------Root--------+ |
| 21 |DimensionAggregation| | 29 |DimensionAggregation| |
| 22 |id='current' | | 30 |id='current' | |
| 23 +--------------------+ | 31 +--------------------+ |
| 24 | 32 |
| 25 - BotEvent is a monotonically inserted entity that is added for each event | 33 - BotEvent is a monotonically inserted entity that is added for each event |
| 26 happening for the bot. | 34 happening for the bot. |
| 27 - BotInfo is a 'dump-only' entity used for UI, it permits quickly show the | 35 - BotInfo is a 'dump-only' entity used for UI, it permits quickly show the |
| 28 state of every bots in an single query. It is basically a cache of the last | 36 state of every bots in an single query. It is basically a cache of the last |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 Returns: | 464 Returns: |
| 457 Tuple (True to restart, text message explaining the reason). | 465 Tuple (True to restart, text message explaining the reason). |
| 458 """ | 466 """ |
| 459 # Periodically reboot bots to workaround OS level leaks (especially on Win). | 467 # Periodically reboot bots to workaround OS level leaks (especially on Win). |
| 460 running_time = state.get('running_time', 0) | 468 running_time = state.get('running_time', 0) |
| 461 assert isinstance(running_time, (int, float)) | 469 assert isinstance(running_time, (int, float)) |
| 462 period = get_bot_reboot_period(bot_id, state) | 470 period = get_bot_reboot_period(bot_id, state) |
| 463 if period and running_time > period: | 471 if period and running_time > period: |
| 464 return True, 'Periodic reboot: running longer than %ds' % period | 472 return True, 'Periodic reboot: running longer than %ds' % period |
| 465 return False, '' | 473 return False, '' |
| OLD | NEW |