public interface ResourceIsolationInterface
A plugin to support resource isolation and limitation within Storm.
Modifier and Type | Method and Description |
---|---|
boolean |
areAllProcessesDead(String user,
String workerId)
Check if all the processes are dead.
|
void |
cleanup(String user,
String workerId,
int port)
This function will be called when the worker needs to shutdown.
|
void |
forceKill(String user,
String workerId)
Kill the given worker forcefully.
|
long |
getMemoryUsage(String user,
String workerId,
int port)
Get the current memory usage of the a given worker.
|
long |
getSystemFreeMemoryMb()
Get the amount of free memory in MB.
|
boolean |
isResourceManaged()
Return true if resources are being managed.
|
void |
kill(String user,
String workerId)
Kill the given worker.
|
void |
launchWorkerProcess(String user,
String topologyId,
Map<String,Object> topoConf,
int port,
String workerId,
List<String> command,
Map<String,String> env,
String logPrefix,
ExitCodeCallback processExitCallback,
File targetDir)
After reserving resources for the worker (i.e.
|
void |
prepare(Map<String,Object> conf)
Called when starting up.
|
void |
reserveResourcesForWorker(String workerId,
Integer workerMemory,
Integer workerCpu,
String numaId)
This function should be used prior to starting the worker to reserve resources for the worker.
|
boolean |
runProfilingCommand(String user,
String workerId,
List<String> command,
Map<String,String> env,
String logPrefix,
File targetDir)
Run profiling command.
|
void prepare(Map<String,Object> conf) throws IOException
Called when starting up.
conf
- the cluster configIOException
- on any error.void reserveResourcesForWorker(String workerId, Integer workerMemory, Integer workerCpu, String numaId)
This function should be used prior to starting the worker to reserve resources for the worker.
workerId
- worker id of the worker to startworkerMemory
- the amount of memory for the worker or null if not enforcedworkerCpu
- the amount of cpu for the worker or null if not enforcednumaId
- NUMA zone if applicable the worker should be bound tovoid cleanup(String user, String workerId, int port) throws IOException
This function will be called when the worker needs to shutdown. This function should include logic to clean up after a worker is shutdown.
user
- the user of the workerworkerId
- worker id to shutdown and clean up afterport
- the port of the workerIOException
void launchWorkerProcess(String user, String topologyId, Map<String,Object> topoConf, int port, String workerId, List<String> command, Map<String,String> env, String logPrefix, ExitCodeCallback processExitCallback, File targetDir) throws IOException
After reserving resources for the worker (i.e. calling reserveResourcesForWorker), this function can be used to launch worker process.
user
- the user who runs the command astopologyId
- the Id of the topologytopoConf
- the topology configurationport
- the port where the worker is onworkerId
- the Id of the workercommand
- the command to runenv
- the environment to run the commandlogPrefix
- the prefix to include in the logsprocessExitCallback
- a callback for when the process exitstargetDir
- the working directory to run the command inIOException
- on I/O exceptionlong getMemoryUsage(String user, String workerId, int port) throws IOException
Get the current memory usage of the a given worker.
user
- the user that the worker is running asworkerId
- the id of the workerport
- the port of the workerIOException
- on I/O exceptionlong getSystemFreeMemoryMb() throws IOException
Get the amount of free memory in MB. This might not be the entire box, it might be within a parent resource group.
IOException
- on I/O exceptionvoid kill(String user, String workerId) throws IOException
Kill the given worker.
user
- the user that the worker is running asworkerId
- the id of the worker to killIOException
- on I/O exceptionvoid forceKill(String user, String workerId) throws IOException
Kill the given worker forcefully.
user
- the user that the worker is running asworkerId
- the id of the worker to killIOException
- on I/O exceptionboolean areAllProcessesDead(String user, String workerId) throws IOException
Check if all the processes are dead.
user
- the user that the processes are running asworkerId
- the id of the worker to killIOException
- on I/O exceptionboolean runProfilingCommand(String user, String workerId, List<String> command, Map<String,String> env, String logPrefix, File targetDir) throws IOException, InterruptedException
Run profiling command.
user
- the user that the worker is running asworkerId
- the id of the workercommand
- the command to runenv
- the environment to run the commandlogPrefix
- the prefix to include in the logstargetDir
- the working directory to run the command inIOException
- on I/O exceptionInterruptedException
- if interruptedboolean isResourceManaged()
Return true if resources are being managed. The DefaultResourceIsolationManager
will have it return false since it doesn’t really manage resources.
Copyright © 2022 The Apache Software Foundation. All rights reserved.