public class CommandSelectorManagedScript extends ResourceSelectorScript<Command>
ResourceSelectorScript
which from a set of commands and the original job request will
attempt to determine the best command to use for execution.Constructor and Description |
---|
CommandSelectorManagedScript(ScriptManager scriptManager,
CommandSelectorManagedScriptProperties properties,
io.micrometer.core.instrument.MeterRegistry registry)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addParametersForScript(java.util.Map<java.lang.String,java.lang.Object> parameters,
java.util.Set<Command> resources,
JobRequest jobRequest)
Add any implementation specific parameters to the map of parameters to send to the script.
|
ResourceSelectorScriptResult<Command> |
selectResource(java.util.Set<Command> resources,
JobRequest jobRequest,
java.lang.String jobId)
Given the
JobRequest and an associated set of resources which matched the request criteria
invoke the configured script to see if a preferred resource is selected based on the current logic. |
evaluateScript, warmUp
public CommandSelectorManagedScript(ScriptManager scriptManager, CommandSelectorManagedScriptProperties properties, io.micrometer.core.instrument.MeterRegistry registry)
scriptManager
- The ScriptManager
instance to useproperties
- The CommandSelectorManagedScriptProperties
instance to useregistry
- The MeterRegistry
instance to usepublic ResourceSelectorScriptResult<Command> selectResource(java.util.Set<Command> resources, JobRequest jobRequest, java.lang.String jobId) throws ResourceSelectionException
JobRequest
and an associated set of resources which matched the request criteria
invoke the configured script to see if a preferred resource is selected based on the current logic.selectResource
in class ResourceSelectorScript<Command>
resources
- The set of resources of type R which should be selected fromjobRequest
- The JobRequest
that the resource will be runningjobId
- The id of the job this resource is being selected forResourceSelectorScriptResult
instanceResourceSelectionException
- If an unexpected error occurs during selectionprotected void addParametersForScript(java.util.Map<java.lang.String,java.lang.Object> parameters, java.util.Set<Command> resources, JobRequest jobRequest)
addParametersForScript
in class ResourceSelectorScript<Command>
parameters
- The existing set of parameters for implementations to add toresources
- The set of resources that need to be chosen fromjobRequest
- The job request necessitating the evaluation of this script