|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.bamboo.buildqueue.manager.LocalAgentManagerImpl
public class LocalAgentManagerImpl
TODO: This is poorly named as it also manages all agents. We should refactor this out into another generic manager
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.atlassian.bamboo.buildqueue.manager.LocalAgentManager |
---|
LocalAgentManager.DisabledAgentsInclusion, LocalAgentManager.OfflineAgentsInclusion |
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_AGENT_NAME
|
Constructor Summary | |
---|---|
LocalAgentManagerImpl()
|
Method Summary | ||
---|---|---|
void |
abandonBuild(BuildAgent remoteAgent,
boolean agentStartingUp)
|
|
boolean |
allowNewElasticAgent()
Allow an elastic agent to register and come online? Based on licensing restrictions. |
|
boolean |
allowNewElasticAgents(int numOfAgentsToCreate)
Allow a specified number of elastic agents to register and come online? Based on licensing restrictions. |
|
boolean |
allowNewLocalAgent()
Allow a local agent to come online? Based on licensing restrictions. |
|
boolean |
allowNewRemoteAgent()
Allow a remote agent to register and come online? Based on licensing restrictions. |
|
boolean |
allowNewRemoteAgents(int numOfAgentsToCreate)
Allow a specified number of remote agents to register and come online? Based on licensing restrictions. |
|
boolean |
checkPipelinesAreDisabled()
|
|
void |
createDefaultAgent()
sets up a default local agent if no local agent exists |
|
void |
createLocalAgent(LocalAgentDefinition definition)
Create a new local agent. |
|
void |
disableAllAgents()
Disable all pipelines |
|
void |
enableAllAgents()
Enable all pipelines |
|
|
executeIfIdle(java.util.concurrent.Callable<T> callable)
Executes a given Callable only if no builds are in progress. |
|
java.util.Map<java.lang.Long,PipelineDefinition> |
findAllAgentsForAgentIds(java.util.Collection<java.lang.Long> agentIds)
Returns a Map of PipelineDefinition s keyed by their id |
|
java.util.Collection<BuildAgent> |
getActiveAndEnabledAgents()
Returns agents that are enabled and online |
|
BuildAgent |
getAgent(long agentId)
|
|
PipelineDefinition |
getAgentDefinition(java.lang.Long agentId)
|
|
PipelineDefinition |
getAgentDefinitionByName(java.lang.String name)
Retrieve a pipelineDefinition by name. |
|
java.util.List<PipelineDefinition> |
getAgentDefinitionsWithNameLike(java.lang.String likeName)
Retrun a list of agents whose name is like the provided string. |
|
java.util.List<BuildAgent> |
getAllAgents()
|
|
java.util.List<ElasticAgentDefinition> |
getAllElasticAgentDefinitions()
Retrieve all elastic agent definitions from db. |
|
java.util.List<LocalBuildAgent> |
getAllLocalAgents()
Returns all LocalBuildAgent objects |
|
java.util.List<BuildAgent> |
getAllNonElasticAgents()
|
|
java.util.List<PipelineDefinition> |
getAllPersistedAgentDefinitions()
Retrieves a list of all agent definitions stored in the database. |
|
java.util.List<BuildAgent> |
getAllRemoteAgents()
Gets all remote agents in the system. |
|
java.util.List<BuildAgent> |
getAllRemoteAgents(boolean onlineOnly)
Get remote agents. |
|
java.util.Collection<BuildAgent> |
getBusyBuildAgents()
Gets a collection agents that are currently building or cancelling a build |
|
java.util.Collection<BuildAgent> |
getExecutableAgents(RequirementSet requirementSet,
boolean includeDisabled)
Gets all agents which can run a given RequirementSet |
|
java.util.Collection<BuildAgent> |
getExecutableAgents(RequirementSet requirementSet,
LocalAgentManager.DisabledAgentsInclusion includeDisabled,
LocalAgentManager.OfflineAgentsInclusion includeOffline)
Gets all agents which can run a given RequirementSet |
|
ExecutableAgentsMatrix |
getExecutableAgentsMatrix(RequirementSet requirementSet,
boolean includeDisabled)
Returns a matrix of how many agents match each requirement in the set. |
|
ExecutableAgentsMatrix |
getExecutableAgentsMatrix(RequirementSet requirementSet,
LocalAgentManager.DisabledAgentsInclusion includeDisabled,
LocalAgentManager.OfflineAgentsInclusion includeOffline)
Returns a matrix of how many agents match each requirement in the set. |
|
java.util.Collection<ElasticImageConfiguration> |
getExecutableImages(RequirementSet requirementSet)
Retrieves a list of all images which satisfy the given requirements set. |
|
LocalBuildAgent |
getLocalAgent(long pipelineId)
Returns the pipeline that matches the passed id |
|
java.util.List<BuildAgent> |
getOnlineElasticAgents()
Retrieve all online elastic build agents. |
|
void |
initAgents()
Inits the local agents Must be ran before any other methods. |
|
void |
removeAgent(long agentId)
Removes the passed agent |
|
void |
saveAnyPipeline(PipelineDefinition pipelineDefinition)
Stores a pipeline PipelineDefinition of any type (elastic, local, remote) |
|
void |
saveElasticPipeline(ElasticAgentDefinition elasticDefinition)
Stores the elastic PipelineDefinition |
|
void |
savePipeline(PipelineDefinition pipelineDefinition)
Stores the PipelineDefinition . |
|
void |
setAgentDao(AgentDao agentDao)
|
|
void |
setBambooLicenseManager(BambooLicenseManager bambooLicenseManager)
|
|
void |
setBuildAgentController(BuildAgentController buildAgentController)
|
|
void |
setBuildExecutionManager(BuildExecutionManager buildExecutionManager)
|
|
void |
setCapabilityRequirementsMatcher(CapabilityRequirementsMatcher capabilityRequirementsMatcher)
|
|
void |
setCapabilitySetManager(CapabilitySetManager capabilitySetManager)
|
|
void |
setElasticAgentManager(ElasticInstanceManager elasticInstanceManager)
|
|
void |
setElasticImageConfigurationAccessor(ElasticImageConfigurationAccessor elasticImageConfigurationAccessor)
|
|
void |
setErrorUpdateHander(ErrorUpdateHandler errorUpdateHandler)
|
|
void |
setEventManager(com.atlassian.event.EventManager eventManager)
|
|
void |
startLocalAgents()
Starts all current LocalBuildAgent objects |
|
void |
stopAgent(BuildAgent agent)
Performs any other operations required when an agent goes offline, such as updating the status and shutdown time. |
|
void |
stopLocalAgents()
Stops all LocalBuildAgent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_AGENT_NAME
Constructor Detail |
---|
public LocalAgentManagerImpl()
Method Detail |
---|
public void createDefaultAgent()
LocalAgentManager
createDefaultAgent
in interface LocalAgentManager
public void initAgents()
LocalAgentManager
initAgents
in interface LocalAgentManager
public void startLocalAgents()
LocalAgentManager
LocalBuildAgent
objects
startLocalAgents
in interface LocalAgentManager
public void stopLocalAgents() throws java.lang.InterruptedException
LocalAgentManager
LocalBuildAgent
stopLocalAgents
in interface LocalAgentManager
java.lang.InterruptedException
@NotNull public java.util.List<LocalBuildAgent> getAllLocalAgents()
LocalAgentManager
LocalBuildAgent
objects
getAllLocalAgents
in interface LocalAgentManager
LocalBuildAgent
objects, or an empty collection if none exists.@NotNull public java.util.List<BuildAgent> getOnlineElasticAgents()
LocalAgentManager
getOnlineElasticAgents
in interface LocalAgentManager
@NotNull public java.util.List<ElasticAgentDefinition> getAllElasticAgentDefinitions()
LocalAgentManager
getAllElasticAgentDefinitions
in interface LocalAgentManager
@NotNull public java.util.List<BuildAgent> getAllRemoteAgents(boolean onlineOnly)
LocalAgentManager
getAllRemoteAgents
in interface LocalAgentManager
onlineOnly
- - only return those agents which are online currently.
@NotNull public java.util.List<BuildAgent> getAllRemoteAgents()
LocalAgentManager
getAllRemoteAgents
in interface LocalAgentManager
@NotNull public java.util.List<BuildAgent> getAllAgents()
getAllAgents
in interface LocalAgentManager
@NotNull public java.util.List<BuildAgent> getAllNonElasticAgents()
getAllNonElasticAgents
in interface LocalAgentManager
@NotNull public java.util.Collection<BuildAgent> getBusyBuildAgents()
LocalAgentManager
getBusyBuildAgents
in interface LocalAgentManager
BuildAgent
@NotNull public java.util.Collection<BuildAgent> getActiveAndEnabledAgents()
LocalAgentManager
getActiveAndEnabledAgents
in interface LocalAgentManager
BuildAgent
@NotNull public java.util.Collection<BuildAgent> getExecutableAgents(RequirementSet requirementSet, boolean includeDisabled)
LocalAgentManager
RequirementSet
getExecutableAgents
in interface LocalAgentManager
@NotNull public java.util.Collection<BuildAgent> getExecutableAgents(RequirementSet requirementSet, LocalAgentManager.DisabledAgentsInclusion includeDisabled, LocalAgentManager.OfflineAgentsInclusion includeOffline)
LocalAgentManager
RequirementSet
getExecutableAgents
in interface LocalAgentManager
@NotNull public ExecutableAgentsMatrix getExecutableAgentsMatrix(@NotNull RequirementSet requirementSet, boolean includeDisabled)
LocalAgentManager
getExecutableAgentsMatrix
in interface LocalAgentManager
@NotNull public ExecutableAgentsMatrix getExecutableAgentsMatrix(@NotNull RequirementSet requirementSet, LocalAgentManager.DisabledAgentsInclusion includeDisabled, LocalAgentManager.OfflineAgentsInclusion includeOffline)
LocalAgentManager
getExecutableAgentsMatrix
in interface LocalAgentManager
@NotNull public java.util.Collection<ElasticImageConfiguration> getExecutableImages(@NotNull RequirementSet requirementSet)
LocalAgentManager
getExecutableImages
in interface LocalAgentManager
requirementSet
- to check
ElasticImageConfiguration
which can build the requirement set (currently this can be 1 or none)public void createLocalAgent(LocalAgentDefinition definition) throws BambooLicenseException
LocalAgentManager
createLocalAgent
in interface LocalAgentManager
BambooLicenseException
public void savePipeline(@NotNull PipelineDefinition pipelineDefinition)
LocalAgentManager
PipelineDefinition
. Updates any caches so calls to LocalAgentManager.getLocalAgent(long)
will return the
LocalBuildAgent
returns with the new definition
savePipeline
in interface LocalAgentManager
pipelineDefinition
- - Must not be nullpublic void saveElasticPipeline(@NotNull ElasticAgentDefinition elasticDefinition)
LocalAgentManager
PipelineDefinition
saveElasticPipeline
in interface LocalAgentManager
elasticDefinition
- - Must not be nullpublic java.util.List<PipelineDefinition> getAllPersistedAgentDefinitions()
LocalAgentManager
getAllPersistedAgentDefinitions
in interface LocalAgentManager
public void abandonBuild(@NotNull BuildAgent remoteAgent, boolean agentStartingUp)
abandonBuild
in interface LocalAgentManager
public void stopAgent(@NotNull BuildAgent agent)
LocalAgentManager
stopAgent
in interface LocalAgentManager
agent
- to be stoppedpublic LocalBuildAgent getLocalAgent(long pipelineId)
LocalAgentManager
getLocalAgent
in interface LocalAgentManager
LocalBuildAgent
object. Null if pipeline does not exist@Nullable public BuildAgent getAgent(long agentId)
getAgent
in interface LocalAgentManager
@Nullable public PipelineDefinition getAgentDefinition(@NotNull java.lang.Long agentId)
getAgentDefinition
in interface LocalAgentManager
public java.util.Map<java.lang.Long,PipelineDefinition> findAllAgentsForAgentIds(@NotNull java.util.Collection<java.lang.Long> agentIds)
LocalAgentManager
PipelineDefinition
s keyed by their id
findAllAgentsForAgentIds
in interface LocalAgentManager
@Nullable public PipelineDefinition getAgentDefinitionByName(@NotNull java.lang.String name)
LocalAgentManager
getAgentDefinitionByName
in interface LocalAgentManager
name
- of the agent to find
@NotNull public java.util.List<PipelineDefinition> getAgentDefinitionsWithNameLike(@NotNull java.lang.String likeName)
LocalAgentManager
getAgentDefinitionsWithNameLike
in interface LocalAgentManager
likeName
- the string to match
public void saveAnyPipeline(@NotNull PipelineDefinition pipelineDefinition)
LocalAgentManager
PipelineDefinition
of any type (elastic, local, remote)
saveAnyPipeline
in interface LocalAgentManager
pipelineDefinition
- - Must not be nullpublic void disableAllAgents()
LocalAgentManager
disableAllAgents
in interface LocalAgentManager
public void enableAllAgents()
LocalAgentManager
enableAllAgents
in interface LocalAgentManager
public boolean checkPipelinesAreDisabled()
checkPipelinesAreDisabled
in interface LocalAgentManager
public <T> T executeIfIdle(java.util.concurrent.Callable<T> callable) throws java.lang.Exception
LocalAgentManager
Executes a given Callable
only if no builds are in progress. Builds are prevented from starting while
the Callable
executes.
executeIfIdle
in interface LocalAgentManager
callable
- the Callable
to be executed
callable
BambooBusyException
- if builds are in progress
java.lang.Exception
- if thrown by callable
public void removeAgent(long agentId) throws java.util.concurrent.TimeoutException
LocalAgentManager
removeAgent
in interface LocalAgentManager
java.util.concurrent.TimeoutException
public boolean allowNewRemoteAgent()
LocalAgentManager
allowNewRemoteAgent
in interface LocalAgentManager
public boolean allowNewRemoteAgents(int numOfAgentsToCreate)
LocalAgentManager
allowNewRemoteAgents
in interface LocalAgentManager
public boolean allowNewElasticAgent()
LocalAgentManager
allowNewElasticAgent
in interface LocalAgentManager
public boolean allowNewElasticAgents(int numOfAgentsToCreate)
LocalAgentManager
allowNewElasticAgents
in interface LocalAgentManager
public boolean allowNewLocalAgent()
LocalAgentManager
allowNewLocalAgent
in interface LocalAgentManager
public void setBuildAgentController(BuildAgentController buildAgentController)
public void setCapabilityRequirementsMatcher(CapabilityRequirementsMatcher capabilityRequirementsMatcher)
public void setCapabilitySetManager(CapabilitySetManager capabilitySetManager)
public void setEventManager(com.atlassian.event.EventManager eventManager)
public void setBambooLicenseManager(BambooLicenseManager bambooLicenseManager)
public void setElasticImageConfigurationAccessor(ElasticImageConfigurationAccessor elasticImageConfigurationAccessor)
public void setAgentDao(AgentDao agentDao)
public void setElasticAgentManager(ElasticInstanceManager elasticInstanceManager)
public void setBuildExecutionManager(BuildExecutionManager buildExecutionManager)
public void setErrorUpdateHander(ErrorUpdateHandler errorUpdateHandler)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |