Improved the agent demand calculation logic.#3
Conversation
A new agent is launched only when all of the above are true: 1. The scheduled pending jobs should be either positive or constantly greater than 1, for last 5 times. 2. The idle agents in the server should be 0.
| def goIdleAgentsCount() = { | ||
| println("Polling Go server for idle agents") | ||
| try { | ||
| val responseJson = jsonRequest(buildUrl() + "/go/api/agents") |
There was a problem hiding this comment.
@tamizhgeek I know the api.go.cd response says this is the schema of the response, but can you quickly check the same on our servers? Our main build is running the latest 16.2.0. They look different actually. We might want to file a bug against it.
There was a problem hiding this comment.
@ashwanthkumar The difference in the responses are because of the Accept header we send. The difference is this:
curl -X GET http://build.gocd.io/go/api/agents -H "Authorization: Basic asdadsadasdasd="
and
curl -X GET http://build.gocd.io/go/api/agents -H "Authorization: Basic adsdasdasda=" -H "Accept: application/vnd.go.cd.v1+json"
:)
|
Some questions (pardon my ignorance)
|
| responseHistory += scheduled | ||
|
|
||
| } | ||
| if(responseHistory.size > 5) { |
There was a problem hiding this comment.
I would really like the 5 number (scheduledJobs > 5) to be a configuration :)
|
@ashwanthkumar Yeah. We don't do any downscaling as of now. Also the agents are not launched specific to environment/resources. They are TODO stuff. |
1. The scalar runs in a thread instead of the poller and supports scale down and scaleup. 2. The agents are remembered using a unique UUID after launch. This helps to find the agents launched by us vs other systems.
A new agent is launched only when all of the below are true:
@Sriram-R @ashwanthkumar