Class ManagedAgentContainersOptimizerImpl
java.lang.Object
com.atlassian.bamboo.agent.managed.schedule.ManagedAgentContainersOptimizerImpl
- All Implemented Interfaces:
ManagedAgentContainersOptimizer
public class ManagedAgentContainersOptimizerImpl
extends Object
implements ManagedAgentContainersOptimizer
-
Constructor Summary
ConstructorDescriptionManagedAgentContainersOptimizerImpl
(AdministrationConfigurationAccessor administrationConfigurationAccessor, AgentResultsSummaryManager agentResultsSummaryManager, AwsAccountBean awsAccountBean, BambooLicenseManager bambooLicenseManager, BuildExecutionManager buildExecutionManager, BuildQueueManager buildQueueManager, CachedPlanManager cachedPlanManager, DeploymentResultService deploymentResultService, ElasticAccountBean elasticAccountBean, ElasticInstanceManager elasticInstanceManager, com.opensymphony.xwork2.TextProvider textProvider, EphemeralAgentsLaunchRequestRegistry ephemeralAgentsLaunchRequestRegistry) -
Method Summary
Modifier and TypeMethodDescriptionfindAgentContainersToStart
(boolean elasticsEnabled, boolean ephemeralsEnabled) Which and how many elastic images should be started.protected List<ElasticImageConfiguration>
findMostNeededElasticConfigurations
(int numberToFind, @NotNull List<ElasticImageConfiguration> necessary) @NotNull Collection<RemoteElasticInstance>
Returns a collection of currently running elastic agents that should be stopped.protected @NotNull Collection<ElasticImageConfiguration>
getImagesForQueuedExecutable
(ResultKey resultKey)
-
Constructor Details
-
ManagedAgentContainersOptimizerImpl
public ManagedAgentContainersOptimizerImpl(AdministrationConfigurationAccessor administrationConfigurationAccessor, AgentResultsSummaryManager agentResultsSummaryManager, AwsAccountBean awsAccountBean, BambooLicenseManager bambooLicenseManager, BuildExecutionManager buildExecutionManager, BuildQueueManager buildQueueManager, CachedPlanManager cachedPlanManager, DeploymentResultService deploymentResultService, ElasticAccountBean elasticAccountBean, ElasticInstanceManager elasticInstanceManager, com.opensymphony.xwork2.TextProvider textProvider, EphemeralAgentsLaunchRequestRegistry ephemeralAgentsLaunchRequestRegistry)
-
-
Method Details
-
findAgentContainersToStart
@NotNull public @NotNull Pair<Collection<ElasticImageConfiguration>,Collection<EphemeralAgentLaunchRequest>> findAgentContainersToStart(boolean elasticsEnabled, boolean ephemeralsEnabled) Description copied from interface:ManagedAgentContainersOptimizer
Which and how many elastic images should be started.- Specified by:
findAgentContainersToStart
in interfaceManagedAgentContainersOptimizer
- Returns:
- list of elastic image configurations to start
-
getImagesForQueuedExecutable
@NotNull protected @NotNull Collection<ElasticImageConfiguration> getImagesForQueuedExecutable(ResultKey resultKey) -
findMostNeededElasticConfigurations
protected List<ElasticImageConfiguration> findMostNeededElasticConfigurations(int numberToFind, @NotNull @NotNull List<ElasticImageConfiguration> necessary) -
getQueuedExecutables
-
getElasticAgentsToStop
Description copied from interface:ManagedAgentContainersOptimizer
Returns a collection of currently running elastic agents that should be stopped. Current implementation returns the list of elastic instances that - cannot run any of the builds currently in queue - have been idle for longer than ELASTIC_AGENT_IDLE_THRESHOLD - nearing the end of their billing period - didn't have an agent running of them within an hour of startup- Specified by:
getElasticAgentsToStop
in interfaceManagedAgentContainersOptimizer
- Returns:
- list of elastic instances that cannot run any of the builds currently in queue
-