gocd-contrib/openstack-elastic-agent

Plugin not starting new agents when it has any in Idle OR Building

Closed this issue · 2 comments

Not starting a new when having agent in Idle is fine, but if any agent is in Building state then no new will be created. In our scenario, we ended up with one agent in Building state and 10 jobs waiting for that agent. It worked as I thought was expected after removing || (agent.agentState() == Agent.AgentState.Building) on the line:

if ((agent.agentState() == Agent.AgentState.Idle) || (agent.agentState() == Agent.AgentState.Building)){

Is there any reason for this logic?
I can create a PR if needed.

tomzo commented

Hi,

I noticed this behavior too. The question is do we/you really want to create 10 agents when 10 jobs are waiting.

Is there any reason for this logic?

I think the logic was there to limit the potential number of agents. Although the current solution is rather poor, because you can end up with that long queue.
My thoughts on this are to:

  • make the change that you suggested - agent gets created if there is no idle agent.
  • add limit on number of agents that can exist within single elastic profile, so that in above case we can have for example 5 agents process the 10 jobs.
tomzo commented

I guess we can close this. Released in 0.7.0