madecoste / swarming

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

bot_config.py should be able to customize task environment #219

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Consider a case when custom bot_config.py examines a bot state and produces 
some per-bot configuration. For example, if swarming bot works in pair with 
some testing device, IP address of that device is can be needed in tasks.

Proposal is:

1. Add to bot_config.py a new callback 'get_task_environment()' that returns 
{str -> str} dict, e.g. 

def get_task_environment():
  return {'PAIRED_DEVICE_IP': <fetch it somehow>}

2. When bot starts a task, it adds 'get_task_environment()' to os.environ of 
that task.

3. It also sends it to swarming server (perhaps as part of the state), so it is 
visible in UI.

Original issue reported on code.google.com by vadimsh@chromium.org on 13 Mar 2015 at 11:30