public class SupervisorUtils extends Object
Constructor and Description |
---|
SupervisorUtils() |
Modifier and Type | Method and Description |
---|---|
static List<LocalResource> |
blobstoreMapToLocalresources(Map<String,Map<String,Object>> blobstoreMap)
Returns a list of LocalResources based on the blobstore-map passed in
|
static boolean |
isWorkerHbTimedOut(int now,
LSWorkerHeartbeat whb,
Map<String,Object> conf) |
static Process |
launchProcess(List<String> command,
Map<String,String> environment,
String logPrefix,
ExitCodeCallback exitCodeCallback,
File dir)
Launch a new process as per
ProcessBuilder with a given callback. |
static int |
processLauncherAndWait(Map<String,Object> conf,
String user,
List<String> args,
Map<String,String> environment,
String logPreFix) |
static Set<String> |
readDownloadedTopologyIds(Map<String,Object> conf) |
protected LSWorkerHeartbeat |
readWorkerHeartbeatImpl(Map<String,Object> conf,
String workerId) |
static Map<String,LSWorkerHeartbeat> |
readWorkerHeartbeats(Map<String,Object> conf)
map from worker id to heartbeat
|
Map<String,LSWorkerHeartbeat> |
readWorkerHeartbeatsImpl(Map<String,Object> conf) |
static void |
resetInstance() |
static void |
rmrAsUser(Map<String,Object> conf,
String id,
String path) |
static void |
setInstance(SupervisorUtils u) |
static void |
setupStormCodeDir(Map<String,Object> conf,
String user,
String dir) |
static void |
setupWorkerArtifactsDir(Map<String,Object> conf,
String user,
String dir) |
static Boolean |
shouldUncompressBlob(Map<String,Object> blobInfo)
Given the blob information returns the value of the uncompress field, handling it either being a string or a boolean value, or if it’s not specified then returns false
|
static Collection<String> |
supervisorWorkerIds(Map<String,Object> conf) |
public static void setInstance(SupervisorUtils u)
public static void resetInstance()
public static int processLauncherAndWait(Map<String,Object> conf, String user, List<String> args, Map<String,String> environment, String logPreFix) throws IOException
IOException
public static void setupStormCodeDir(Map<String,Object> conf, String user, String dir) throws IOException
IOException
public static void setupWorkerArtifactsDir(Map<String,Object> conf, String user, String dir) throws IOException
IOException
public static void rmrAsUser(Map<String,Object> conf, String id, String path) throws IOException
IOException
public static Boolean shouldUncompressBlob(Map<String,Object> blobInfo)
Given the blob information returns the value of the uncompress field, handling it either being a string or a boolean value, or if it’s not specified then returns false
blobInfo
- public static List<LocalResource> blobstoreMapToLocalresources(Map<String,Map<String,Object>> blobstoreMap)
Returns a list of LocalResources based on the blobstore-map passed in
blobstoreMap
- public static Set<String> readDownloadedTopologyIds(Map<String,Object> conf) throws IOException
IOException
public static Collection<String> supervisorWorkerIds(Map<String,Object> conf)
public static Map<String,LSWorkerHeartbeat> readWorkerHeartbeats(Map<String,Object> conf) throws Exception
map from worker id to heartbeat
conf
- Exception
public Map<String,LSWorkerHeartbeat> readWorkerHeartbeatsImpl(Map<String,Object> conf) throws Exception
Exception
protected LSWorkerHeartbeat readWorkerHeartbeatImpl(Map<String,Object> conf, String workerId)
public static boolean isWorkerHbTimedOut(int now, LSWorkerHeartbeat whb, Map<String,Object> conf)
public static Process launchProcess(List<String> command, Map<String,String> environment, String logPrefix, ExitCodeCallback exitCodeCallback, File dir) throws IOException
Launch a new process as per ProcessBuilder
with a given callback.
command
- the command to be executed in the new processenvironment
- the environment to be applied to the process. Can be null.logPrefix
- a prefix for log entries from the output of the process. Can be null.exitCodeCallback
- code to be called passing the exit code value when the process completesdir
- the working directory of the new processIOException
ProcessBuilder
Copyright © 2019 The Apache Software Foundation. All Rights Reserved.