@Component
@ConditionalOnProperty(value="genie.jobs.clusters.loadBalancers.script.enabled",
havingValue="true")
public class ScriptLoadBalancer
extends java.lang.Object
implements com.netflix.genie.core.services.ClusterLoadBalancer
The contract between the script and the Java code is that the script will be supplied global variables
clusters and jobRequest which will be JSON strings representing the list (array) of clusters
matching the cluster criteria tags and the job request that kicked off this evaluation. The code expects the script
to either return the id of the cluster if one is selected or null if none was selected.
| Constructor and Description |
|---|
ScriptLoadBalancer(org.springframework.core.task.AsyncTaskExecutor asyncTaskExecutor,
org.springframework.scheduling.TaskScheduler taskScheduler,
com.netflix.genie.core.services.impl.GenieFileTransferService fileTransferService,
org.springframework.core.env.Environment environment,
com.fasterxml.jackson.databind.ObjectMapper mapper,
com.netflix.spectator.api.Registry registry)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getOrder() |
void |
refresh()
Check if the script file needs to be refreshed.
|
com.netflix.genie.common.dto.Cluster |
selectCluster(java.util.Set<com.netflix.genie.common.dto.Cluster> clusters,
com.netflix.genie.common.dto.JobRequest jobRequest) |
@Autowired
public ScriptLoadBalancer(@Qualifier(value="genieAsyncTaskExecutor")
org.springframework.core.task.AsyncTaskExecutor asyncTaskExecutor,
@Qualifier(value="genieTaskScheduler")
org.springframework.scheduling.TaskScheduler taskScheduler,
@Qualifier(value="cacheGenieFileTransferService")
com.netflix.genie.core.services.impl.GenieFileTransferService fileTransferService,
org.springframework.core.env.Environment environment,
com.fasterxml.jackson.databind.ObjectMapper mapper,
com.netflix.spectator.api.Registry registry)
asyncTaskExecutor - The asynchronous task executor to use to run the load balancer script intaskScheduler - The task scheduler to schedule the script refresh task withfileTransferService - The file transfer service to use to download the scriptenvironment - The program environment to get properties frommapper - The object mapper to use to serialize objects to JSON for binding with scriptsregistry - The metrics registry to use for collecting metricspublic com.netflix.genie.common.dto.Cluster selectCluster(@Nonnull @NonNull @NotEmpty
java.util.Set<com.netflix.genie.common.dto.Cluster> clusters,
@Nonnull @NonNull
com.netflix.genie.common.dto.JobRequest jobRequest)
throws com.netflix.genie.common.exceptions.GenieException
selectCluster in interface com.netflix.genie.core.services.ClusterLoadBalancercom.netflix.genie.common.exceptions.GenieExceptionpublic int getOrder()
getOrder in interface com.netflix.genie.core.services.ClusterLoadBalancergetOrder in interface org.springframework.core.Orderedpublic void refresh()