Package com.netflix.genie.web.scripts
Class ClusterSelectorManagedScript
java.lang.Object
com.netflix.genie.web.scripts.ManagedScript
com.netflix.genie.web.scripts.ResourceSelectorScript<com.netflix.genie.common.internal.dtos.Cluster,ClusterSelectionContext>
com.netflix.genie.web.scripts.ClusterSelectorManagedScript
public class ClusterSelectorManagedScript
extends ResourceSelectorScript<com.netflix.genie.common.internal.dtos.Cluster,ClusterSelectionContext>
Extension of
ResourceSelectorScript that delegates selection of a job's cluster when more than one choice is
available. See also: ClusterSelector.
The contract between the script and the Java code is that the script will be supplied global variables
clusters and jobRequest which will be a Set of Cluster instances
matching the cluster criteria and the job request that kicked off this evaluation respectively. The code expects the
script to return a ResourceSelectorScriptResult instance.
- Since:
- 4.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionClusterSelectorManagedScript(ScriptManager scriptManager, ClusterSelectorScriptProperties 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, ClusterSelectionContext context) Add any implementation specific parameters to the map of parameters to send to the script.ResourceSelectorScriptResult<com.netflix.genie.common.internal.dtos.Cluster>selectResource(ClusterSelectionContext 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
-
ClusterSelectorManagedScript
public ClusterSelectorManagedScript(ScriptManager scriptManager, ClusterSelectorScriptProperties properties, io.micrometer.core.instrument.MeterRegistry registry, com.netflix.genie.common.internal.util.PropertiesMapCache propertyMapCache) Constructor.- Parameters:
scriptManager- script managerproperties- script manager propertiesregistry- meter registrypropertyMapCache- dynamic properties map cache
-
-
Method Details
-
selectResource
public ResourceSelectorScriptResult<com.netflix.genie.common.internal.dtos.Cluster> selectResource(ClusterSelectionContext context) throws ResourceSelectionException 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.- Overrides:
selectResourcein classResourceSelectorScript<com.netflix.genie.common.internal.dtos.Cluster,ClusterSelectionContext> - Parameters:
context- TheResourceSelectionContextinstance containing information about the context for this selection- Returns:
- A
ResourceSelectorScriptResultinstance - Throws:
ResourceSelectionException- If an unexpected error occurs during selection
-
addParametersForScript
protected void addParametersForScript(Map<String, Object> parameters, ClusterSelectionContext context) Add any implementation specific parameters to the map of parameters to send to the script.- Overrides:
addParametersForScriptin classResourceSelectorScript<com.netflix.genie.common.internal.dtos.Cluster,ClusterSelectionContext> - Parameters:
parameters- The existing set of parameters for implementations to add tocontext- The selection context
-