public final class SchedulerUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
PORTS_REQUIRED_FOR_EXECUTOR |
static int |
PORTS_REQUIRED_FOR_SCHEDULER |
Modifier and Type | Method and Description |
---|---|
static Scheduler.SchedulerResponse |
constructSchedulerResponse(boolean isOK)
construct heron scheduler response basing on the given result
|
static boolean |
curlAndExtractPackage(java.lang.String workingDirectory,
java.lang.String packageURI,
java.lang.String packageDestination,
boolean isDeletePackage,
boolean isVerbose)
Curl a package, extract it to working directory
|
static java.lang.String |
decodeJavaOpts(java.lang.String encodedJavaOpts)
Decode the JVM options
1. |
static java.lang.String |
encodeJavaOpts(java.lang.String javaOpts)
Encode the JVM options
1. |
static java.lang.String[] |
executorCommand(Config config,
Config runtime,
int containerIndex,
java.util.List<java.lang.Integer> freePorts)
Utils method to construct the command to start heron-executor
|
static java.lang.String[] |
executorCommandArgs(Config config,
Config runtime,
java.util.List<java.lang.Integer> freePorts)
Util method to get the arguments to the heron executor.
|
static boolean |
onScheduleAsLibrary(Config config,
Config runtime,
IScheduler scheduler,
PackingPlan packing)
Invoke the onScheduler() in IScheduler directly as a library
|
static java.lang.String[] |
schedulerCommand(Config config,
Config runtime,
java.util.List<java.lang.Integer> freePorts)
Utils method to construct the command to start heron-scheduler
|
static boolean |
setLibSchedulerLocation(Config runtime,
IScheduler scheduler,
boolean isService)
Set the location of scheduler for other processes to discover,
when invoke IScheduler as a library on client side
|
static boolean |
setSchedulerLocation(Config runtime,
java.lang.String schedulerEndpoint,
IScheduler scheduler)
Set the location of scheduler for other processes to discover
|
static boolean |
setupWorkingDirectory(java.lang.String workingDirectory,
java.lang.String coreReleasePackageURL,
java.lang.String coreReleaseDestination,
java.lang.String topologyPackageURL,
java.lang.String topologyPackageDestination,
boolean isVerbose)
Setup the working directory:
1. |
public static final int PORTS_REQUIRED_FOR_EXECUTOR
public static final int PORTS_REQUIRED_FOR_SCHEDULER
public static boolean onScheduleAsLibrary(Config config, Config runtime, IScheduler scheduler, PackingPlan packing)
config
- The Config to initialize ISchedulerruntime
- The runtime Config to initialize ISchedulerscheduler
- the IScheduler to invokepacking
- The PackingPlan to scheduler for OnSchedule()public static java.lang.String[] schedulerCommand(Config config, Config runtime, java.util.List<java.lang.Integer> freePorts)
config
- The static Configruntime
- The runtime ConfigfreePorts
- list of free portspublic static java.lang.String[] executorCommand(Config config, Config runtime, int containerIndex, java.util.List<java.lang.Integer> freePorts)
config
- The static Configruntime
- The runtime ConfigcontainerIndex
- the executor/container indexfreePorts
- list of free portspublic static java.lang.String[] executorCommandArgs(Config config, Config runtime, java.util.List<java.lang.Integer> freePorts)
config
- The static Configruntime
- The runtime ConfigfreePorts
- list of free portspublic static boolean setLibSchedulerLocation(Config runtime, IScheduler scheduler, boolean isService)
runtime
- the runtime configurationscheduler
- the IScheduler to provide more infoisService
- true if the scheduler is a service; false otherwisepublic static boolean setSchedulerLocation(Config runtime, java.lang.String schedulerEndpoint, IScheduler scheduler)
runtime
- the runtime configurationschedulerEndpoint
- the endpoint that scheduler listens for receives requestsscheduler
- the IScheduler to provide more infopublic static Scheduler.SchedulerResponse constructSchedulerResponse(boolean isOK)
isOK
- whether the request successfulpublic static java.lang.String encodeJavaOpts(java.lang.String javaOpts)
public static java.lang.String decodeJavaOpts(java.lang.String encodedJavaOpts)
public static boolean setupWorkingDirectory(java.lang.String workingDirectory, java.lang.String coreReleasePackageURL, java.lang.String coreReleaseDestination, java.lang.String topologyPackageURL, java.lang.String topologyPackageDestination, boolean isVerbose)
workingDirectory
- the working directory to setupcoreReleasePackageURL
- the URL of core release packagecoreReleaseDestination
- the destination of the core release package fetchedtopologyPackageURL
- the URL of heron topology release packagetopologyPackageDestination
- the destination of heron topology release package fetchedisVerbose
- display verbose output or notpublic static boolean curlAndExtractPackage(java.lang.String workingDirectory, java.lang.String packageURI, java.lang.String packageDestination, boolean isDeletePackage, boolean isVerbose)
workingDirectory
- the working directory to setuppackageURI
- the URL of core release packagepackageDestination
- the destination of the core release package fetchedisDeletePackage
- delete the package curled or notisVerbose
- display verbose output or not