Package com.atlassian.bamboo.plan
Class ExecutableAgentsHelperImpl
- java.lang.Object
-
- com.atlassian.bamboo.plan.ExecutableAgentsHelperImpl
-
- All Implemented Interfaces:
ExecutableAgentsHelper
public class ExecutableAgentsHelperImpl extends Object implements ExecutableAgentsHelper
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.bamboo.plan.ExecutableAgentsHelper
ExecutableAgentsHelper.ExecutableQuery, ExecutableAgentsHelper.ExecutorQuery
-
-
Constructor Summary
Constructors Constructor Description ExecutableAgentsHelperImpl(CachedPlanManager cachedPlanManager, ExecutionStatusProvider executionStatusProvider, com.atlassian.plugin.PluginAccessor pluginAccessor, AgentAssignmentService agentAssignmentService, CapabilityRequirementsMatcher capabilityRequirementsMatcher, CapabilitySetManager capabilitySetManager, ElasticInstanceManager elasticInstanceManager, ElasticImageConfigurationAccessor elasticImageConfigurationAccessor, EphemeralAgentsService ephemeralAgentsService, EnvironmentCustomConfigService environmentCustomConfigService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanExecute(@NotNull ExecutableAgentsHelper.ExecutorQuery executorQuery, @NotNull EphemeralAgentTemplate ephemeralAgentTemplate)Checks if the given template is applicable for the given query - whether the template meets the query requirements.booleancanExecute(@NotNull BuildAgent buildAgent, @NotNull CommonContext context, @NotNull ImmutableRequirementSet requirements)Returns true or false depending on whether the agent can execute the given context, taking into account requirement set and other global settings such as agent assignments.@NotNull Collection<BuildAgent>getExecutableAgents(@NotNull ExecutableAgentsHelper.ExecutorQuery executorQuery)ExecutableAgentsMatrixgetExecutableAgentsMatrix(@NotNull ExecutableAgentsHelper.ExecutorQuery executorQuery)@NotNull Collection<ImmutableBuildable>getExecutableBuildables(@NotNull ExecutableAgentsHelper.ExecutableQuery executableQuery)Collection of buildables for which this agent can execute.@NotNull Collection<ImmutableBuildable>getExecutableBuildables(ExecutableAgentsHelper.ExecutableQuery executableQuery, Predicate<? super ImmutableBuildable> filter)Collection of buildables for which this agent can execute.@NotNull Collection<Environment>getExecutableEnvironments(@NotNull ExecutableAgentsHelper.ExecutableQuery executableQuery)@NotNull Collection<EphemeralAgentTemplate>getExecutableEphemeralAgentTemplates(@NotNull ExecutableAgentsHelper.ExecutorQuery executorQuery)Calculates the list of ephemeral agents templates that are capable of running an agent that can build a Buildable plan.Collection<ElasticImageConfiguration>getExecutableImages(@NotNull ExecutableAgentsHelper.ExecutorQuery executorQuery)Calculates the list of elastic images that are capable of running an agent that can build a Buildable plan.booleanisAgentEligibleForReceivingJobs(long agentId)This method checks if agent is eligible to receive new jobs.booleanplanHasExecutableAgents(@NotNull PlanKey planKey, boolean includeDisabled)Checks if a Buildable can be built on any active agent.booleanplanHasExecutableAgents(@NotNull PlanResultKey planResultKey)Checks if a Job can be built on any active agent.voidresendStopAgentMessageIfRequired(long agentId)If agent is online andBuildAgent.isRequestedToBeStopped()is true, the system will re-request the agent stop.
-
-
-
Constructor Detail
-
ExecutableAgentsHelperImpl
public ExecutableAgentsHelperImpl(CachedPlanManager cachedPlanManager, ExecutionStatusProvider executionStatusProvider, com.atlassian.plugin.PluginAccessor pluginAccessor, AgentAssignmentService agentAssignmentService, CapabilityRequirementsMatcher capabilityRequirementsMatcher, CapabilitySetManager capabilitySetManager, ElasticInstanceManager elasticInstanceManager, ElasticImageConfigurationAccessor elasticImageConfigurationAccessor, EphemeralAgentsService ephemeralAgentsService, EnvironmentCustomConfigService environmentCustomConfigService)
-
-
Method Detail
-
getExecutableAgents
@NotNull @Transactional public @NotNull Collection<BuildAgent> getExecutableAgents(@NotNull @NotNull ExecutableAgentsHelper.ExecutorQuery executorQuery)
- Specified by:
getExecutableAgentsin interfaceExecutableAgentsHelper
-
canExecute
public boolean canExecute(@NotNull @NotNull BuildAgent buildAgent, @NotNull @NotNull CommonContext context, @NotNull @NotNull ImmutableRequirementSet requirements)Description copied from interface:ExecutableAgentsHelperReturns true or false depending on whether the agent can execute the given context, taking into account requirement set and other global settings such as agent assignments.- Specified by:
canExecutein interfaceExecutableAgentsHelper
-
getExecutableAgentsMatrix
public ExecutableAgentsMatrix getExecutableAgentsMatrix(@NotNull @NotNull ExecutableAgentsHelper.ExecutorQuery executorQuery)
- Specified by:
getExecutableAgentsMatrixin interfaceExecutableAgentsHelper
-
isAgentEligibleForReceivingJobs
public boolean isAgentEligibleForReceivingJobs(long agentId)
Description copied from interface:ExecutableAgentsHelperThis method checks if agent is eligible to receive new jobs.- Specified by:
isAgentEligibleForReceivingJobsin interfaceExecutableAgentsHelper- Returns:
- true iff agent it's ok to receive jobs (i.e. we haven't requested it's shutdown)
-
resendStopAgentMessageIfRequired
public void resendStopAgentMessageIfRequired(long agentId)
Description copied from interface:ExecutableAgentsHelperIf agent is online andBuildAgent.isRequestedToBeStopped()is true, the system will re-request the agent stop.- Specified by:
resendStopAgentMessageIfRequiredin interfaceExecutableAgentsHelper
-
getExecutableImages
public Collection<ElasticImageConfiguration> getExecutableImages(@NotNull @NotNull ExecutableAgentsHelper.ExecutorQuery executorQuery)
Description copied from interface:ExecutableAgentsHelperCalculates the list of elastic images that are capable of running an agent that can build a Buildable plan.- Specified by:
getExecutableImagesin interfaceExecutableAgentsHelper
-
getExecutableEphemeralAgentTemplates
@NotNull public @NotNull Collection<EphemeralAgentTemplate> getExecutableEphemeralAgentTemplates(@NotNull @NotNull ExecutableAgentsHelper.ExecutorQuery executorQuery)
Description copied from interface:ExecutableAgentsHelperCalculates the list of ephemeral agents templates that are capable of running an agent that can build a Buildable plan.- Specified by:
getExecutableEphemeralAgentTemplatesin interfaceExecutableAgentsHelper- Returns:
- collection of ephemeral agent templates that match the query
-
canExecute
public boolean canExecute(@NotNull @NotNull ExecutableAgentsHelper.ExecutorQuery executorQuery, @NotNull @NotNull EphemeralAgentTemplate ephemeralAgentTemplate)Description copied from interface:ExecutableAgentsHelperChecks if the given template is applicable for the given query - whether the template meets the query requirements.- Specified by:
canExecutein interfaceExecutableAgentsHelper- Parameters:
executorQuery- query to checkephemeralAgentTemplate- template to check- Returns:
- true if the template is applicable for the query, false otherwise
-
planHasExecutableAgents
@Transactional public boolean planHasExecutableAgents(@NotNull @NotNull PlanKey planKey, boolean includeDisabled)Checks if a Buildable can be built on any active agent. This implementation utilises information already available in ExecutionStatus if it exists.- Specified by:
planHasExecutableAgentsin interfaceExecutableAgentsHelper- Parameters:
planKey-includeDisabled- indicate whether disabled agents should be included in checking- Returns:
-
planHasExecutableAgents
@Transactional public boolean planHasExecutableAgents(@NotNull @NotNull PlanResultKey planResultKey)Checks if a Job can be built on any active agent. This implementation utilises information already available in ExecutionStatus if it exists.- Specified by:
planHasExecutableAgentsin interfaceExecutableAgentsHelper- Parameters:
planResultKey-- Returns:
-
getExecutableBuildables
@NotNull public @NotNull Collection<ImmutableBuildable> getExecutableBuildables(@NotNull @NotNull ExecutableAgentsHelper.ExecutableQuery executableQuery)
Description copied from interface:ExecutableAgentsHelperCollection of buildables for which this agent can execute. Checks capabilities and agent assignments- Specified by:
getExecutableBuildablesin interfaceExecutableAgentsHelper
-
getExecutableBuildables
@NotNull public @NotNull Collection<ImmutableBuildable> getExecutableBuildables(ExecutableAgentsHelper.ExecutableQuery executableQuery, Predicate<? super ImmutableBuildable> filter)
Description copied from interface:ExecutableAgentsHelperCollection of buildables for which this agent can execute. Checks capabilities and agent assignments- Specified by:
getExecutableBuildablesin interfaceExecutableAgentsHelper
-
getExecutableEnvironments
@NotNull public @NotNull Collection<Environment> getExecutableEnvironments(@NotNull @NotNull ExecutableAgentsHelper.ExecutableQuery executableQuery)
- Specified by:
getExecutableEnvironmentsin interfaceExecutableAgentsHelper- Returns:
- collection of environments that can be executed using given set of capabilities/assignments
-
-