public abstract class AbstractQueueOfExecutables extends Object implements QueueOfExecutables
QueueOfExecutables.EnqueueResult, QueueOfExecutables.ExecutableData
Modifier | Constructor and Description |
---|---|
protected |
AbstractQueueOfExecutables(ExecutorCalculator executorCalculator,
CommonContextMap map,
com.atlassian.event.api.EventPublisher eventPublisher) |
Modifier and Type | Method and Description |
---|---|
boolean |
enqueue(@NotNull CommonContext context,
@Nullable MinimalRequirementSet requirements)
Adds a new executable to store.
|
@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.
|
@NotNull com.google.common.collect.ImmutableList<QueueOfExecutables.ExecutableData> |
executablesForAgent(long agentId,
Function<Long,Collection<ResultKey>> source) |
@Nullable CommonContext |
get(@NotNull ResultKey resultKey)
Retrieves an executable with given key from storage.
|
@Nullable Set<Long> |
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 |
inflight(@NotNull ResultKey resultKey)
Called when a given executable is en route to agent.
|
@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 |
recalculateExecutors()
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 |
remove(@NotNull ResultKey resultKey)
Called when an executable should be removed from the queue.
|
int |
size()
Returns the amount of executables in queue (not counting executables in flight)
|
protected AbstractQueueOfExecutables(ExecutorCalculator executorCalculator, CommonContextMap map, com.atlassian.event.api.EventPublisher eventPublisher)
@Nullable public @Nullable CommonContext inflight(@NotNull @NotNull ResultKey resultKey)
QueueOfExecutables
inflight
in interface QueueOfExecutables
@Nullable public @Nullable CommonContext remove(@NotNull @NotNull ResultKey resultKey)
QueueOfExecutables
remove
in interface QueueOfExecutables
public boolean enqueue(@NotNull @NotNull CommonContext context, @Nullable @Nullable MinimalRequirementSet requirements)
QueueOfExecutables
enqueue
in interface QueueOfExecutables
@NotNull public @NotNull QueueOfExecutables.EnqueueResult enqueueAndRequestDedicatedAgentIfApplicable(@NotNull @NotNull CommonContext context, @Nullable @Nullable MinimalRequirementSet requirements)
QueueOfExecutables
enqueueAndRequestDedicatedAgentIfApplicable
in interface QueueOfExecutables
context
- context to enqueuerequirements
- requirements needed to execute the context, may be null@NotNull public @NotNull com.google.common.collect.ImmutableList<QueueOfExecutables.ExecutableData> executablesForAgent(long agentId)
QueueOfExecutables
executablesForAgent
in interface QueueOfExecutables
@NotNull public @NotNull com.google.common.collect.ImmutableList<QueueOfExecutables.ExecutableData> nonDedicatedExecutablesForAgent(long agentId)
QueueOfExecutables
nonDedicatedExecutablesForAgent
in interface QueueOfExecutables
agentId
- id of the agent@NotNull public @NotNull com.google.common.collect.ImmutableList<QueueOfExecutables.ExecutableData> executablesForAgent(long agentId, Function<Long,Collection<ResultKey>> source)
public void recalculateExecutables(BuildAgent agent)
QueueOfExecutables
recalculateExecutables
in interface QueueOfExecutables
public void recalculateExecutors()
QueueOfExecutables
recalculateExecutors
in interface QueueOfExecutables
public int size()
QueueOfExecutables
size
in interface QueueOfExecutables
@Nullable public @Nullable Collection<ElasticImageConfiguration> getImagesForExecutable(@NotNull @NotNull ResultKey resultKey)
QueueOfExecutables
getImagesForExecutable
in interface QueueOfExecutables
@Nullable public @Nullable Collection<ElasticImageConfiguration> getNonDedicatedImagesForExecutable(@NotNull @NotNull ResultKey resultKey)
QueueOfExecutables
getNonDedicatedImagesForExecutable
in interface QueueOfExecutables
resultKey
- executable@Nullable public @Nullable Collection<EphemeralAgentTemplate> getTemplatesForExecutable(@NotNull @NotNull ResultKey resultKey)
QueueOfExecutables
getTemplatesForExecutable
in interface QueueOfExecutables
resultKey
- result key to look for@Nullable public @Nullable Set<Long> getExecutorsForExecutable(@NotNull @NotNull ResultKey resultKey)
QueueOfExecutables
getExecutorsForExecutable
in interface QueueOfExecutables
public void recalculateExecutors(@NotNull @NotNull Set<Key> keys)
QueueOfExecutables
recalculateExecutors
in interface QueueOfExecutables
keys
- the keys to invalidate@Nullable public @Nullable CommonContext get(@NotNull @NotNull ResultKey resultKey)
QueueOfExecutables
get
in interface QueueOfExecutables
Copyright © 2023 Atlassian Software Systems Pty Ltd. All rights reserved.