public final class WorkerEnvironment
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the worker environment
|
TWSChannel |
getChannel() |
Communicator |
getCommunicator() |
Config |
getConfig() |
JobAPI.Job |
getJob() |
int |
getNumberOfWorkers() |
IPersistentVolume |
getPersistentVolume() |
static java.lang.Object |
getSharedValue(java.lang.String key) |
static <T> T |
getSharedValue(java.lang.String key,
java.lang.Class<T> clazz) |
IVolatileVolume |
getVolatileVolume() |
IWorkerController |
getWorkerController() |
static WorkerEnvironment |
getWorkerEnv() |
int |
getWorkerId() |
java.util.List<JobMasterAPI.WorkerInfo> |
getWorkerList() |
static WorkerEnvironment |
init(Config config,
JobAPI.Job job,
IWorkerController workerController,
IPersistentVolume persistentVolume,
IVolatileVolume volatileVolume)
Initialize the worker environment, this is a singleton and every job should call this method
|
static void |
putSharedValue(java.lang.String key,
java.lang.Object value) |
static void |
putWeakSharedValue(java.lang.String key,
java.lang.Object value)
This method will wrap the value with a
WeakReference before inserting into the
key-value store. |
static void |
removeSharedValue(java.lang.String key) |
public Config getConfig()
public int getWorkerId()
public JobAPI.Job getJob()
public int getNumberOfWorkers()
public java.util.List<JobMasterAPI.WorkerInfo> getWorkerList()
public IWorkerController getWorkerController()
public IPersistentVolume getPersistentVolume()
public IVolatileVolume getVolatileVolume()
public Communicator getCommunicator()
public TWSChannel getChannel()
public void close()
public static WorkerEnvironment init(Config config, JobAPI.Job job, IWorkerController workerController, IPersistentVolume persistentVolume, IVolatileVolume volatileVolume)
config
- configurationjob
- job object for this Twister2 jobworkerController
- worker controllerpersistentVolume
- persistent volumevolatileVolume
- volatile volumepublic static void putSharedValue(java.lang.String key, java.lang.Object value)
public static void putWeakSharedValue(java.lang.String key, java.lang.Object value)
WeakReference
before inserting into the
key-value store.public static void removeSharedValue(java.lang.String key)
public static java.lang.Object getSharedValue(java.lang.String key)
public static <T> T getSharedValue(java.lang.String key, java.lang.Class<T> clazz)
public static WorkerEnvironment getWorkerEnv()