Interface QueueOfExecutables
- All Known Implementing Classes:
AbstractQueueOfExecutables
,OffloadingQueueOfExecutables
,SimpleQueueOfExecutables
@ThreadSafe
public interface QueueOfExecutables
Provides an unordered store for executables.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
static class
Stores basic data about an executable. -
Method Summary
Modifier and TypeMethodDescriptionboolean
enqueue
(@NotNull CommonContext context, @Nullable MinimalRequirementSet requirements) Deprecated.@NotNull QueueOfExecutables.EnqueueResult
enqueueAndRequestDedicatedAgentIfApplicable
(@NotNull CommonContext context, @Nullable MinimalRequirementSet requirements) Adds a new executable to store.@NotNull com.google.common.collect.ImmutableList<QueueOfExecutables.ExecutableData>
executablesForAgent
(long agentId) Returns executables available for an agent.@Nullable CommonContext
Retrieves an executable with given key from storage.getExecutorsForExecutable
(@NotNull ResultKey resultKey) Returns the executors currently considered to be eligible for building resultKey.@Nullable Collection<ElasticImageConfiguration>
getImagesForExecutable
(@NotNull ResultKey resultKey) Returns the images currently considered to be eligible for building resultKey.@Nullable Collection<ElasticImageConfiguration>
getNonDedicatedImagesForExecutable
(@NotNull ResultKey resultKey) Returns the images that can execute the given executable.@Nullable Collection<EphemeralAgentTemplate>
getTemplatesForExecutable
(@NotNull ResultKey resultKey) Returns the ephemeral agents templates currently considered to be eligible for building resultKey.@Nullable CommonContext
Called when a given executable is en route to agent.void
launchDedicatedAgentsForTemplate
(@NotNull EphemeralAgentTemplate template) Launches dedicated agents for the given template and executables present in the queue at the moment of this method call.@NotNull com.google.common.collect.ImmutableList<QueueOfExecutables.ExecutableData>
nonDedicatedExecutablesForAgent
(long agentId) Returns immutable list of the non-dedicated executables available for an agent.void
recalculateExecutables
(BuildAgent agent) Updates all agent-executable mappings for a given agent.void
Recalculates executors for all executables - until then, any information about executor-executable mapping should be considered to be invalid.void
recalculateExecutors
(@NotNull Set<Key> keys) Recalculates executors for a given plan - until then, any information about executor-executable mapping for this plan should be considered to be invalid.@Nullable CommonContext
Called when an executable should be removed from the queue.void
removeDedicationTimestamp
(@NotNull ResultKey resultKey) Remove the dedication timestamp for the given result key if the one exists.int
size()
Returns the amount of executables in queue (not counting executables in flight)
-
Method Details
-
get
Retrieves an executable with given key from storage. -
enqueue
@Deprecated boolean enqueue(@NotNull @NotNull CommonContext context, @Nullable @Nullable MinimalRequirementSet requirements) Deprecated.since 9.3, useenqueueAndRequestDedicatedAgentIfApplicable(CommonContext, MinimalRequirementSet)
, this method does not handle dedicated agents.Adds a new executable to store. Will not be called concurrently. Returns false if requirements could not be retrieved for a build and were not provided in the call (assumption: the reason is that the build got deleted). -
enqueueAndRequestDedicatedAgentIfApplicable
@NotNull @NotNull QueueOfExecutables.EnqueueResult enqueueAndRequestDedicatedAgentIfApplicable(@NotNull @NotNull CommonContext context, @Nullable @Nullable MinimalRequirementSet requirements) Adds a new executable to store. Will not be called concurrently.- Parameters:
context
- context to enqueuerequirements
- requirements needed to execute the context, may be null- Returns:
- FAILED if requirements could not be retrieved for a build and were not provided in the call (assumption: the reason is that the build got deleted) ENQUEUED_COMMON if successfully enqueued ENQUEUED_DEDICATED if successfully enqueued and requested a dedicated agent for the execution
- Since:
- 9.3
-
inflight
Called when a given executable is en route to agent. May be implemented as a simple remove(). Executables in flight should be treated as removed, but may be put back into a queue if an agent fails to acknolwedge that it received the executable.- Returns:
- the removed context
-
remove
Called when an executable should be removed from the queue. will not be called concurrently- Returns:
- the removed context
-
executablesForAgent
@NotNull @NotNull com.google.common.collect.ImmutableList<QueueOfExecutables.ExecutableData> executablesForAgent(long agentId) Returns executables available for an agent. -
nonDedicatedExecutablesForAgent
@NotNull @NotNull com.google.common.collect.ImmutableList<QueueOfExecutables.ExecutableData> nonDedicatedExecutablesForAgent(long agentId) Returns immutable list of the non-dedicated executables available for an agent.- Parameters:
agentId
- id of the agent- Returns:
- list of executable data
- Since:
- 9.3
-
recalculateExecutables
Updates all agent-executable mappings for a given agent. -
recalculateExecutors
Recalculates executors for a given plan - until then, any information about executor-executable mapping for this plan should be considered to be invalid.- Parameters:
keys
- the keys to invalidate
-
recalculateExecutors
void recalculateExecutors()Recalculates executors for all executables - until then, any information about executor-executable mapping should be considered to be invalid. The dedicated agents won't be launched as a part of this process. -
size
int size()Returns the amount of executables in queue (not counting executables in flight) -
getImagesForExecutable
@Nullable @Nullable Collection<ElasticImageConfiguration> getImagesForExecutable(@NotNull @NotNull ResultKey resultKey) Returns the images currently considered to be eligible for building resultKey. -
getNonDedicatedImagesForExecutable
@Nullable @Nullable Collection<ElasticImageConfiguration> getNonDedicatedImagesForExecutable(@NotNull @NotNull ResultKey resultKey) Returns the images that can execute the given executable. If the executable is not found, null is returned. If the executable is dedicated at the moment of check, the empty list will be returned.- Parameters:
resultKey
- executable- Returns:
- list of elastic image configurations
- Since:
- 9.3
-
getTemplatesForExecutable
@Nullable @Nullable Collection<EphemeralAgentTemplate> getTemplatesForExecutable(@NotNull @NotNull ResultKey resultKey) Returns the ephemeral agents templates currently considered to be eligible for building resultKey. If the resultKey is not found the null is returned.- Parameters:
resultKey
- result key to look for- Returns:
- ephemeral agents templates.
- Since:
- 9.3
-
getExecutorsForExecutable
Returns the executors currently considered to be eligible for building resultKey. -
removeDedicationTimestamp
Remove the dedication timestamp for the given result key if the one exists. The dedication timestamp works as a due-to-date, to which the build queue holds the related executable for a dedicated agent. After the date pass, every executor can grab the executable. Removing the dedication timestamp means that the executable is no longer dedicated.- Parameters:
resultKey
- of the related executable- Since:
- 9.4
-
launchDedicatedAgentsForTemplate
Launches dedicated agents for the given template and executables present in the queue at the moment of this method call. The dedicated agent will be launched if the corresponding executable is not already waiting for any dedicated agent.- Parameters:
template
- the template to launch dedicated agents for- Since:
- 9.4
-
enqueueAndRequestDedicatedAgentIfApplicable(CommonContext, MinimalRequirementSet)
, this method does not handle dedicated agents.