Giter VIP home page Giter VIP logo

teamcity-agent-priority's Introduction

Teamcity agent priority

Plugin for ordering build agents.

Description

This plugin gives you a possibility to prioritize your build agents by different criteria, so whenever the build starts, available agent with higher weight will be used.

๐Ÿผ The plugin requires Teamcity version 10+ for correct functionality, as it uses some recent API.

Installation

To install plugin download zip archive it and copy it to Teamcity <data directory>/plugins (it is $HOME/.BuildServer/plugins under Linux and C:\Users<user_name>.BuildServer\plugins under Windows). For more information, take a look at official documentation

Configuration

Build agent prioritization is configured per project. Sub-projects would inherit their parents settings. So, for example, adding configuration to the ROOT project would affect the whole Teamcity server installation. To add priority to selected build, go to the project settings and select Agent priority on the left panel. Then click on Add Priority button and select one of the available prioritizes:

  • By build status: this priority would sort agents depending on the build result, that was received during previous executions;
  • By configuration parameter: this priority would sort agents by the given parameter, provided by user. Parameter should be set in buildAgent.properties file;
  • By CPU benchmark index: this priority would sort agents by CPU benchmark index, calculated during agent start;
  • By name: this priority would sort agents by name;
  • By idle time: this priority sorts agents by idle time;
  • By random: this priority sorts agents randomly;

Each priority could have some parameters, which are described on the corresponding configuration page. Multiple priorities could be selected and reordered. For your convenience, there is a possibility to check prioritization: select the build for which you would like to see ordered agent and you would see agents in sorted order.

demo

License

MIT

teamcity-agent-priority's People

Contributors

alexanderjreid avatar grundic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

teamcity-agent-priority's Issues

cloud profile support

It would be nice to have cloud profile support, as the plugin can only rank existing agents atm, elastic agents cannot be ranked. Could set up cloudbursting really easily with your plugin if it could do that.

Support "by agent build history" mode

Hi Grigory,

We have a need to force the build to the agent that ran it previously. We have a massive compilation build that takes ~1.5 hours from scratch, but less time if it runs on the same agent with incremental compilation. Your plugin has a nice feature of showing the proposed order of matching agents. So I'd like to propose new rules for the agent order that would suit our needs:

  1. Agent that ran the build last should be first in the list.
  2. Agent that ran the build before the last agent should be second in the list.
  3. Repeat until all agents that appeared in build history are in the front of list.
  4. The rest of the agents can use existing JetBrains logic.

Perhaps implementation should pull the list for existing JetBrains logic (I think that will take care of agent compatibility) and push the agents that fit my criteria to the front of the list.

I'm not sure if "by agent build history" is the best name, so feel free to propose a different name. Thanks!

Plugin Showing as Unknown

When I install this plugin on TeamCity 9.1.1, the link shows as "Unknown" and none of the content is loaded. The plugin shows in the Plugin List but as I said it is not working.

Add round-robin priority type

From the comment on the SO:

It would be great to have a "random" or "round-robin" priority type there... Because, AFAIU, it's impossible to have such behavior in the current version :(

Does not run on TeamCity 9.1.7

Getting an exception when trying to add the plugin to our 9.1.7:

[2017-02-03 15:11:20,509] WARN - tion.CachingBuildEstimator$2$1 - Failed to execute Build estimates updater. jetbrains.buildServer.serverSide.SProject.getOwnFeaturesOfType(Ljava/lang/String;)Ljava/util/Collection; java.lang.NoSuchMethodError: jetbrains.buildServer.serverSide.SProject.getOwnFeaturesOfType(Ljava/lang/String;)Ljava/util/Collection; at com.github.grundic.agentPriority.manager.AgentPriorityManager.configuredForProject(AgentPriorityManager.java:97) at com.github.grundic.agentPriority.manager.AgentPriorityManager.configuredForProjectWithParents(AgentPriorityManager.java:129) at com.github.grundic.agentPriority.manager.AgentPriorityManager.sort(AgentPriorityManager.java:61) at com.github.grundic.agentPriority.buildDistribution.PriorityAgentsFilter.filterAgents(PriorityAgentsFilter.java:71) at jetbrains.buildServer.serverSide.impl.buildDistribution.DefaultAgentsFilter.filterAgents(DefaultAgentsFilter.java:21) at jetbrains.buildServer.serverSide.impl.buildDistribution.BuildAgentDistributor.filterAvailableAgents(BuildAgentDistributor.java:17) at jetbrains.buildServer.serverSide.impl.buildDistribution.AbstractDistributor.doDistribute(AbstractDistributor.java:35) at jetbrains.buildServer.serverSide.impl.buildDistribution.DefaultBuildDistributor.assignBuildsToAgents(DefaultBuildDistributor.java:6) at jetbrains.buildServer.serverSide.impl.buildDistribution.BuildDistributorProxy.assignBuildsToAgents(BuildDistributorProxy.java:10) at jetbrains.buildServer.serverSide.impl.timeEstimation.DefaultBuildEstimatesCalculator.estimateBuilds(DefaultBuildEstimatesCalculator.java:109) at jetbrains.buildServer.serverSide.impl.timeEstimation.DefaultBuildEstimatesCalculator.estimateBuilds(DefaultBuildEstimatesCalculator.java:42) at jetbrains.buildServer.serverSide.impl.BuildEstimatorFeeder.getEstimates(BuildEstimatorFeeder.java:2) at jetbrains.buildServer.serverSide.impl.timeEstimation.CachingBuildEstimator.computeEstimates(CachingBuildEstimator.java:87) at jetbrains.buildServer.serverSide.impl.timeEstimation.CachingBuildEstimator$2$1.run(CachingBuildEstimator.java:1) at jetbrains.buildServer.util.ExceptionUtil$1.run(ExceptionUtil.java:41) at jetbrains.buildServer.serverSide.impl.timeEstimation.CachingBuildEstimator$2.run(CachingBuildEstimator.java:9) at java.lang.Thread.run(Unknown Source)

[2017-02-03 15:13:22,804] WARN - verSide.impl.BuildServerRunner - Unexpected exception occurred in Flush Queue 1, operation will be repeated java.lang.NoSuchMethodError: jetbrains.buildServer.serverSide.SProject.getOwnFeaturesOfType(Ljava/lang/String;)Ljava/util/Collection; at com.github.grundic.agentPriority.manager.AgentPriorityManager.configuredForProject(AgentPriorityManager.java:97) at com.github.grundic.agentPriority.manager.AgentPriorityManager.configuredForProjectWithParents(AgentPriorityManager.java:129) at com.github.grundic.agentPriority.manager.AgentPriorityManager.sort(AgentPriorityManager.java:61) at com.github.grundic.agentPriority.buildDistribution.PriorityAgentsFilter.filterAgents(PriorityAgentsFilter.java:71) at jetbrains.buildServer.serverSide.impl.buildDistribution.DefaultAgentsFilter.filterAgents(DefaultAgentsFilter.java:21) at jetbrains.buildServer.serverSide.impl.buildDistribution.BuildAgentDistributor.filterAvailableAgents(BuildAgentDistributor.java:17) at jetbrains.buildServer.serverSide.impl.buildDistribution.AbstractDistributor.doDistribute(AbstractDistributor.java:35) at jetbrains.buildServer.serverSide.impl.buildDistribution.DefaultBuildDistributor.assignBuildsToAgents(DefaultBuildDistributor.java:6) at jetbrains.buildServer.serverSide.impl.buildDistribution.BuildDistributorProxy.assignBuildsToAgents(BuildDistributorProxy.java:10) at jetbrains.buildServer.serverSide.impl.FlushQueueForConnectedAgents.distribute(FlushQueueForConnectedAgents.java:17) at jetbrains.buildServer.serverSide.impl.FlushQueueTemplate.flushRealAgents(FlushQueueTemplate.java:25) at jetbrains.buildServer.serverSide.impl.FlushQueueTemplate.access$100(FlushQueueTemplate.java:9) at jetbrains.buildServer.serverSide.impl.FlushQueueTemplate$2.run(FlushQueueTemplate.java:2) at jetbrains.buildServer.serverSide.impl.FlushQueueAction$QueueAction.run(FlushQueueAction.java:6) at jetbrains.buildServer.serverSide.impl.cleanup.ServerCleanupState.runUnderLock(ServerCleanupState.java:37) at jetbrains.buildServer.serverSide.impl.cleanup.ServerCleanupState.runReadAction(ServerCleanupState.java:14) at jetbrains.buildServer.serverSide.impl.cleanup.ServerCleanupManagerImpl.executeWithInactiveCleanup(ServerCleanupManagerImpl.java:141) at jetbrains.buildServer.serverSide.impl.cleanup.ServerCleanupManagerImpl$$FastClassBySpringCGLIB$$ba2c8525.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at jetbrains.buildServer.serverSide.impl.auth.TeamCityMethodSecurityInterceptor.invoke(TeamCityMethodSecurityInterceptor.java:7) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$FixedChainStaticTargetInterceptor.intercept(CglibAopProxy.java:594) at jetbrains.buildServer.serverSide.impl.cleanup.ServerCleanupManagerImpl$$EnhancerBySpringCGLIB$$b6975960.executeWithInactiveCleanup(<generated>) at jetbrains.buildServer.serverSide.impl.QueueFlushImpl.flushQueue(QueueFlushImpl.java:10) at jetbrains.buildServer.serverSide.impl.BuildServerImpl.flushQueue(BuildServerImpl.java:168) at jetbrains.buildServer.serverSide.impl.BuildServerRunner$2.doSomething(BuildServerRunner.java) at jetbrains.buildServer.serverSide.impl.BuildServerRunner$BuildServerWorker.runAction(BuildServerRunner.java:47) at jetbrains.buildServer.serverSide.impl.BuildServerRunner$BuildServerWorker.run(BuildServerRunner.java:9) at java.lang.Thread.run(Unknown Source)

Ascending / descending

It would be really useful to be able to select ascending / descending for each option. For some builds I'd like to select the highest CPU, but others the lowest. Likewise, it would be great to select by idle time to have the lowest value. This would allow cloud agents to be utilised as much as possible.

Pool priority

I have four different agent pools in my TeamCity installation: physical machines, VMs, Raspberry Pis, and GPU machines. Many of my configs could theoretically run on most or all of these pools, but for optimal resource utilization I would like to be able to specify a preference order by pool.

Examples:

  • A heavyweight compilation should preferentially run on a physical machine, but I would rather it start running on a VM than wait if all physical machines are busy.
  • A lightweight job should preferentially run on a VM but fall back to a physical machine.
  • Anything that can run on a physical machine or VM can also run on a GPU machine, but because those are more specialized I want them to be the last choice.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.