Package com.netflix.genie.web.scripts
Class CommandSelectorManagedScript
- java.lang.Object
-
- com.netflix.genie.web.scripts.ManagedScript
-
- com.netflix.genie.web.scripts.ResourceSelectorScript<Command,CommandSelectionContext>
-
- com.netflix.genie.web.scripts.CommandSelectorManagedScript
-
public class CommandSelectorManagedScript extends ResourceSelectorScript<Command,CommandSelectionContext>
An extension ofResourceSelectorScript
which from a set of commands and the original job request will attempt to determine the best command to use for execution.- Since:
- 4.0.0
-
-
Constructor Summary
Constructors Constructor Description CommandSelectorManagedScript(ScriptManager scriptManager, CommandSelectorManagedScriptProperties properties, io.micrometer.core.instrument.MeterRegistry registry, PropertiesMapCache propertyMapCache)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addParametersForScript(java.util.Map<java.lang.String,java.lang.Object> parameters, CommandSelectionContext context)
Add any implementation specific parameters to the map of parameters to send to the script.ResourceSelectorScriptResult<Command>
selectResource(CommandSelectionContext context)
Given theJobRequest
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.-
Methods inherited from class com.netflix.genie.web.scripts.ManagedScript
evaluateScript, warmUp
-
-
-
-
Constructor Detail
-
CommandSelectorManagedScript
public CommandSelectorManagedScript(ScriptManager scriptManager, CommandSelectorManagedScriptProperties properties, io.micrometer.core.instrument.MeterRegistry registry, PropertiesMapCache propertyMapCache)
Constructor.- Parameters:
scriptManager
- TheScriptManager
instance to useproperties
- TheCommandSelectorManagedScriptProperties
instance to useregistry
- TheMeterRegistry
instance to usepropertyMapCache
- ThePropertiesMapCache
instance to use
-
-
Method Detail
-
selectResource
public ResourceSelectorScriptResult<Command> selectResource(CommandSelectionContext context) throws ResourceSelectionException
Given theJobRequest
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.- Overrides:
selectResource
in classResourceSelectorScript<Command,CommandSelectionContext>
- Parameters:
context
- TheResourceSelectionContext
instance containing information about the context for this selection- Returns:
- A
ResourceSelectorScriptResult
instance - Throws:
ResourceSelectionException
- If an unexpected error occurs during selection
-
addParametersForScript
protected void addParametersForScript(java.util.Map<java.lang.String,java.lang.Object> parameters, CommandSelectionContext context)
Add any implementation specific parameters to the map of parameters to send to the script.- Overrides:
addParametersForScript
in classResourceSelectorScript<Command,CommandSelectionContext>
- Parameters:
parameters
- The existing set of parameters for implementations to add tocontext
- The selection context
-
-