Package com.netflix.genie.web.scripts
Class ResourceSelectorScript<R,C extends ResourceSelectionContext<R>>
java.lang.Object
com.netflix.genie.web.scripts.ManagedScript
com.netflix.genie.web.scripts.ResourceSelectorScript<R,C>
- Type Parameters:
R- The type of resource this script is selecting fromC- The context for resource selection which must extendResourceSelectionContext
- Direct Known Subclasses:
AgentLauncherSelectorManagedScript,ClusterSelectorManagedScript,CommandSelectorManagedScript
Interface for defining the contract between the selection of a resource from a set of resources for a given
job request.
- Since:
- 4.0.0
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedResourceSelectorScript(ScriptManager scriptManager, ManagedScriptBaseProperties properties, io.micrometer.core.instrument.MeterRegistry registry, com.netflix.genie.common.internal.util.PropertiesMapCache propertyMapCache) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddParametersForScript(Map<String, Object> parameters, C context) Add any implementation specific parameters to the map of parameters to send to the script.selectResource(C context) Given theJobRequestand 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 Details
-
ResourceSelectorScript
protected ResourceSelectorScript(ScriptManager scriptManager, ManagedScriptBaseProperties properties, io.micrometer.core.instrument.MeterRegistry registry, com.netflix.genie.common.internal.util.PropertiesMapCache propertyMapCache) Constructor.- Parameters:
scriptManager- TheScriptManagerinstance to useproperties- TheManagedScriptBasePropertiesinstance to useregistry- TheMeterRegistryinstance to usepropertyMapCache- ThePropertiesMapCacheinstance to use
-
-
Method Details
-
selectResource
Given theJobRequestand 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.- Parameters:
context- TheResourceSelectionContextinstance containing information about the context for this selection- Returns:
- A
ResourceSelectorScriptResultinstance - Throws:
ResourceSelectionException- If an unexpected error occurs during selection
-
addParametersForScript
Add any implementation specific parameters to the map of parameters to send to the script.- Parameters:
parameters- The existing set of parameters for implementations to add tocontext- The selection context
-