madecoste / swarming

Automatically exported from code.google.com/p/swarming
Apache License 2.0
0 stars 1 forks source link

Add a new 'properties' bot attribute #184

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The bot currently advertise 3 attributes:
- dimensions, which is used for task selection; semi-ephemeral (normally 
constant)
- state, which is free form ephemeral state; ephemeral by design.
- version, which is a properties of the bot, describing the currently running 
code; constant by design.

There's a strong incentive to make some 'state' magical, in the sense that they 
affect how the server view the bot, e.g. 'autoreboot' and I'd like to add a new 
one. Instead of making 'state' more auto-magic, I'd like to make a new dict 
named 'properties' to keep things more maintainable.

It's design hold non-ephemeral (constant) magical values. The values put in 
there are:
- version: the root level attribute 'version' would be moved there.
- autoreboot: to enable the auto-reboot feature, see issue 182.
- cost: the cost of using this VM per second, to define the cost of running 
tasks, see issue 183.

Original issue reported on code.google.com by maruel@chromium.org on 1 Dec 2014 at 3:46

GoogleCodeExporter commented 9 years ago

Original comment by maruel@chromium.org on 1 Dec 2014 at 3:46

GoogleCodeExporter commented 9 years ago

Original comment by maruel@chromium.org on 1 Dec 2014 at 3:46

GoogleCodeExporter commented 9 years ago
What is the strict formal difference between 'state' and 'properties'? "Magic 
values" sounds to vague :)

Is it correct to say that:
a) 'state' can be modified from bot_config (based on bot machine state).
b) 'properties' can NOT be modified from bot_config, but rather assigned by the 
server ('version' is derived from server version, some other properties may be 
read from the datastore, etc.)

If it is not correct and there's no clear distinction between 'state' and 
'properties', I'd rather we have a single set.

Original comment by vadimsh@chromium.org on 1 Dec 2014 at 5:55

GoogleCodeExporter commented 9 years ago
Fair point. The current magical values are:
dimensions:
- id: must be one item and the item must be unique
- quarantined: if set, the server behavior changes.

state:
- quarantined: if set, the server behavior changes.

I guess proper documentation would be fine.

Original comment by maruel@chromium.org on 1 Dec 2014 at 7:52

GoogleCodeExporter commented 9 years ago
So... If I want to add a new key-value pair, how do I choose where to add it to 
('state' or 'properties')?

Original comment by vadimsh@chromium.org on 1 Dec 2014 at 7:54

GoogleCodeExporter commented 9 years ago
If it's magic, e.g. it changes the server behavior w.r.t. this specific bot, it 
should be in 'properties'. 'state' would be for monitoring only. That's the 
basic idea.

Original comment by maruel@chromium.org on 1 Dec 2014 at 7:58

GoogleCodeExporter commented 9 years ago
Wrote a wiki page instead: 
https://code.google.com/p/swarming/wiki/SwarmingMagicValues

Original comment by maruel@chromium.org on 3 Dec 2014 at 6:22