Agent/job priority

Hi there,

I have a number of code compile jobs in TeamCity, and have recently started adding larger tasks (such as producing ISOs of our products for various platforms). The ISOs can be built with a large number of options, and I have written a separate application to handle these options, this application is able to submit a job to a TeamCity configuration, which in turns performs the job and emails the user results. To accommodate these larger tasks I have brought online a number of higher specification PC's (i7 @ 4 GHz, 6 GB RAM, SATA III SSD hard drives), as we need to be able to turn around ISOs reasonably quickly. The problem I am having right now is I want to be able to use these new fast build agents for *all* build jobs, but when a special ISO build is added, I want that to take priority. To attempt to do this I currently always place ISO jobs at the top of the build queue, which means they will get processed before any non ISO jobs, but the problem with this is the ISO jobs don't trigger in the right order, for example if I have three producers, who trigger one build each in sequence Producer A, Producer B, Producer C, the build queue will be reversed. This gets worse if people are constantly adding new builds to the queue, as it means the first build will never make it to the top of the queue.

Can anyone think of anyway to fix my problem? The only solutions I can think of are along the lines of:

Query the current build queue, and then place any ISO build jobs above non ISO build jobs, but below existing ISO build jobs. I could probably query the build queue information from the SQL database (or look at the html returned by querying the build queue URL), and could probably work out what I need to submit to change the order.

While doing something like this wouldn't be impossible, I was hoping someone might be able to come up with a nicer solution - eventually I'd love to see some priority system inside TeamCity itself, something as simple as being able to assign build configurations a priority between 0 and 100, with 50 being the default, and then when a build is triggered, it'd be added to the build queue in a way that makes sure the build queue is in priority order (if other items in the queue have the same priority it'd always go below them). I can see how a simple system like this could leave to some things in the queue starving, but at least the user would have some control over it. Certainly for me that'd fix the issues I have right now rather well.

Steve

3 comments

Just building on my suggestion for priority before, potentially as well as specifying a priority, you could specify a 'priority increment time', the idea being that you could set a build up to have a priority of 40, and priority increment time of 2 minutes, so every 2 minutes the priority would be increased by 1, meaning after 20 minutes the build would have a priority of 50 (the default), which would mean jobs could be added at a low priority, but starvation would be avoided as eventually lower priority jobs will climb up and become higher priority jobs.

Just thinking out loud!

Steve

0

Steven,

Seems, TW-5279 is what you need and we've done some work around it already, so there are chances the functinoality will soon become available with "experimental" tag.

However, the queue there will have some smartness built in , so that if a low-prority build waits in queue for a long time it can still be built before just added high-priority build.

As to current workaround until our solution is not published... you can probably write a Java TeamCity plugin for that.

0

Thank you, I have added a small comment to the link posted. I hope this feature is available soon as it sounds like it should hopefully do what I want.

Steve

0

Please sign in to leave a comment.