History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QB-1629
Type: New Feature New Feature
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Robin Shen
Reporter: Lukasz Guminski
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
QuickBuild

Graceful shutdown of agents in auto-scaling cloud environment

Created: 15/May/13 01:04 PM   Updated: 17/May/13 11:27 PM
Component/s: None
Affects Version/s: 5.0.19
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
We would like to deploy our build farm to a cloud environment, however, it is important to be able to scale it up and down according to current needs for computing power.

For this reason, we would need to have a way to instruct a build agent to shut down gracefully when the machine (the agent is running at) is about to be disposed. After receiving such an instruction, the agent should finish current tasks, stop accepting any new ones, and shut down.

A possible implementation could be for instance checking periodically by the agent if there is a specific file present in the system (e.g. <agent install dir>/conf/SHUTTING_DOWN). Once it is there, the agent start shut down procedure.

In addition to this, it would be nice to have such an option within QB administration UI.

 All   Comments   Work Log   Change History      Sort Order:
Robin Shen [16/May/13 12:21 AM]
Which cloud environment are you using? For EC2, QB already has a plugin to launch node on demand and shutdown gracefully after using. For other environments, you may write your own plugin to launch/shutdown node using the cloud extension point in QB.

Lukasz Guminski [16/May/13 09:45 AM]
We use Cloudstack and an external tool which based on current load scales up and down our systems. The solution works nicely, and now we would like to apply it to Quickbuild build farm, without the need for writing custom plugins, because the scaling logic is already implemented.

Robin Shen [16/May/13 12:14 PM]
The build agent can be shutdown gracefully by running "./agent.sh stop". As long as the command returns, agent will be stopped.

Lukasz Guminski [16/May/13 12:24 PM]
But this will break the current build, so it is not graceful. What is needed is a way to tell the agent to not accept new builds, so that it would still finish the current ones, and then shut down. Otherwise the build status would be red.

Robin Shen [17/May/13 12:26 AM]
When request to stop, QB agent makes sure that current running steps assigned to it are finished. It can not wait for finish of build as build may contain many steps and it does not know which step will be assigned to it. So generally if you have agents start/stop frequently please make sure that steps are not tired to the agent, that is, a step should not rely on particular agent so that if one of them gets stopped, other agents in the pool can pick up the step. Another approach is to wrap all steps using particular agent with a container step and configure that container step to run on that specific agent, this way, agent will wait for the container step to stop.

Lukasz Guminski [17/May/13 12:42 PM]
I made a test and you are right: at step level everything works as it should i.e. "./agent.sh stop" makes agent exiting in a graceful way.

That's all I need. Thank you for your comments. Please close my request.