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
Constructors Constructor Description 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull Pair<Collection<ElasticImageConfiguration>,Collection<EphemeralAgentLaunchRequest>>
findAgentContainersToStart(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>
getElasticAgentsToStop()
Returns a collection of currently running elastic agents that should be stopped.protected @NotNull Collection<ElasticImageConfiguration>
getImagesForQueuedExecutable(ResultKey resultKey)
protected Stream<ResultKey>
getQueuedExecutables()
-
-
-
Constructor Detail
-
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 Detail
-
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)
-
getElasticAgentsToStop
@NotNull public @NotNull Collection<RemoteElasticInstance> 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
-
-