public class RuntimeEnvironment extends Object implements Environment, BufferProvider, LocalBufferPoolOwner, Runnable
BufferProvider.BufferAvailabilityRegistration| Constructor and Description |
|---|
RuntimeEnvironment(Task owner,
TaskDeploymentDescriptor tdd,
ClassLoader userCodeClassLoader,
MemoryManager memoryManager,
IOManager ioManager,
InputSplitProvider inputSplitProvider,
AccumulatorProtocol accumulatorProtocolProxy,
BroadcastVariableManager bcVarManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCopyTaskForCacheFile(String name,
FutureTask<Path> copyTask) |
void |
addCopyTasksForCacheFile(Map<String,FutureTask<Path>> copyTasks) |
void |
cancelExecution() |
void |
clearLocalBufferPool()
Clears the local buffer pool and returns all buffers to the global buffer pool.
|
<T extends IOReadableWritable> |
createAndRegisterInputGate()
Creates a new InputGate and registers it with the Environment.
|
OutputGate |
createAndRegisterOutputGate()
Creates a new OutputGate and registers it with the Environment.
|
AccumulatorProtocol |
getAccumulatorProtocolProxy()
Returns the proxy object for the accumulator protocol.
|
BroadcastVariableManager |
getBroadcastVariableManager() |
int |
getBufferSize()
Returns the size of buffers (in bytes) available at this buffer provider.
|
Map<String,FutureTask<Path>> |
getCopyTask() |
int |
getCurrentNumberOfSubtasks()
Returns the current number of subtasks the respective task is split into.
|
Thread |
getExecutingThread()
Returns the thread which is assigned to execute the user code.
|
int |
getIndexInSubtaskGroup()
Returns the index of this subtask in the subtask group.
|
Set<ChannelID> |
getInputChannelIDs()
Returns the IDs of all input channels connected to this environment.
|
Set<ChannelID> |
getInputChannelIDsOfGate(GateID gateID)
Returns the IDs of all the input channels connected to the gate with the given ID.
|
InputGate<? extends IOReadableWritable> |
getInputGate(int pos)
Returns the registered input gate with index
pos. |
Set<GateID> |
getInputGateIDs()
Returns the IDs of all input gates connected to this environment.
|
InputSplitProvider |
getInputSplitProvider()
Returns the input split provider assigned to this environment.
|
AbstractInvokable |
getInvokable()
Returns the invokable object that represents the Nephele task.
|
IOManager |
getIOManager()
Returns the current
IOManager. |
Configuration |
getJobConfiguration()
Returns the job configuration object which was attached to the original
JobGraph. |
JobID |
getJobID()
Returns the ID of the job from the original job graph.
|
JobVertexID |
getJobVertexId()
Gets the ID of the jobVertex that this task corresponds to.
|
MemoryManager |
getMemoryManager()
Returns the current
MemoryManager. |
GateID |
getNextUnboundInputGateID()
Returns the next unbound input gate ID or
null if no such ID exists |
int |
getNumberOfChannels()
Returns the number of byte-buffered channels that will retrieve their buffers from the local buffer pool.
|
int |
getNumberOfInputChannels()
Returns the number of input channels attached to this environment.
|
int |
getNumberOfInputGates()
Returns the number of input gates registered with this environment.
|
int |
getNumberOfOutputChannels()
Returns the number of output channels attached to this environment.
|
int |
getNumberOfOutputGates()
Returns the number of output gates registered with this environment.
|
BufferProvider |
getOutputBufferProvider()
Returns the buffer provider for this environment.
|
Set<ChannelID> |
getOutputChannelIDs()
Returns the IDs of all output channels connected to this environment.
|
Set<ChannelID> |
getOutputChannelIDsOfGate(GateID gateID)
Returns the IDs of all the output channels connected to the gate with the given ID.
|
OutputGate |
getOutputGate(int index)
Returns the registered output gate with index
pos. |
Set<GateID> |
getOutputGateIDs()
Returns the IDs of all output gates connected to this environment.
|
Configuration |
getTaskConfiguration()
Returns the task configuration object which was attached to the original JobVertex.
|
String |
getTaskName()
Returns the name of the task running in this environment.
|
ClassLoader |
getUserClassLoader()
Returns the user code class loader
|
List<InputGate<? extends IOReadableWritable>> |
inputGates() |
void |
logBufferUtilization()
Logs the current status of the local buffer pool.
|
List<OutputGate> |
outputGates() |
BufferProvider.BufferAvailabilityRegistration |
registerBufferAvailabilityListener(BufferAvailabilityListener listener)
Registers the given
BufferAvailabilityListener with an empty buffer pool. |
void |
registerGlobalBufferPool(GlobalBufferPool globalBufferPool) |
void |
reportAsynchronousEvent()
Reports an asynchronous event and interrupts each blocking method of this buffer provider in order to allow the
blocked thread to respond to the event.
|
Buffer |
requestBuffer(int minBufferSize)
Requests a buffer with a minimum size of
minBufferSize. |
Buffer |
requestBufferBlocking(int minBufferSize)
Requests a buffer with a minimum size of
minBufferSize. |
void |
run() |
void |
setDesignatedNumberOfBuffers(int numBuffers)
Sets the designated number of buffers the local buffer pool owner is allowed to fetch from the global buffer pool
and manage locally by means of the
LocalBufferPool. |
public RuntimeEnvironment(Task owner, TaskDeploymentDescriptor tdd, ClassLoader userCodeClassLoader, MemoryManager memoryManager, IOManager ioManager, InputSplitProvider inputSplitProvider, AccumulatorProtocol accumulatorProtocolProxy, BroadcastVariableManager bcVarManager) throws Exception
Exceptionpublic AbstractInvokable getInvokable()
public JobID getJobID()
EnvironmentgetJobID in interface Environmentpublic JobVertexID getJobVertexId()
EnvironmentgetJobVertexId in interface Environmentpublic GateID getNextUnboundInputGateID()
Environmentnull if no such ID existsgetNextUnboundInputGateID in interface Environmentnull if no such ID existspublic OutputGate createAndRegisterOutputGate()
EnvironmentcreateAndRegisterOutputGate in interface Environmentpublic <T extends IOReadableWritable> InputGate<T> createAndRegisterInputGate()
EnvironmentcreateAndRegisterInputGate in interface Environmentpublic int getNumberOfOutputGates()
EnvironmentgetNumberOfOutputGates in interface Environmentpublic int getNumberOfInputGates()
EnvironmentgetNumberOfInputGates in interface Environmentpublic int getNumberOfOutputChannels()
EnvironmentgetNumberOfOutputChannels in interface Environmentpublic int getNumberOfInputChannels()
EnvironmentgetNumberOfInputChannels in interface Environmentpublic InputGate<? extends IOReadableWritable> getInputGate(int pos)
pos.pos - the index of the input gate to returnpos or null if no such index existspublic OutputGate getOutputGate(int index)
pos.index - the index of the output gate to returnpos or null if no such index existspublic Thread getExecutingThread()
public void cancelExecution()
public IOManager getIOManager()
EnvironmentIOManager.getIOManager in interface EnvironmentIOManager.public MemoryManager getMemoryManager()
EnvironmentMemoryManager.getMemoryManager in interface EnvironmentMemoryManager.public BroadcastVariableManager getBroadcastVariableManager()
getBroadcastVariableManager in interface Environmentpublic Configuration getTaskConfiguration()
EnvironmentgetTaskConfiguration in interface Environmentpublic Configuration getJobConfiguration()
EnvironmentJobGraph.getJobConfiguration in interface EnvironmentJobGraphpublic int getCurrentNumberOfSubtasks()
EnvironmentgetCurrentNumberOfSubtasks in interface Environmentpublic int getIndexInSubtaskGroup()
EnvironmentgetIndexInSubtaskGroup in interface Environmentpublic String getTaskName()
EnvironmentgetTaskName in interface Environmentpublic InputSplitProvider getInputSplitProvider()
EnvironmentgetInputSplitProvider in interface Environmentnull if no such provider has been assigned to this environment.public Set<ChannelID> getOutputChannelIDs()
EnvironmentgetOutputChannelIDs in interface Environmentpublic Set<ChannelID> getInputChannelIDs()
EnvironmentgetInputChannelIDs in interface Environmentpublic Set<GateID> getInputGateIDs()
EnvironmentgetInputGateIDs in interface Environmentpublic Set<GateID> getOutputGateIDs()
EnvironmentgetOutputGateIDs in interface Environmentpublic Set<ChannelID> getOutputChannelIDsOfGate(GateID gateID)
EnvironmentgetOutputChannelIDsOfGate in interface EnvironmentgateID - the gate IDpublic Set<ChannelID> getInputChannelIDsOfGate(GateID gateID)
EnvironmentgetInputChannelIDsOfGate in interface EnvironmentgateID - the gate IDpublic List<OutputGate> outputGates()
public List<InputGate<? extends IOReadableWritable>> inputGates()
public AccumulatorProtocol getAccumulatorProtocolProxy()
EnvironmentgetAccumulatorProtocolProxy in interface Environmentpublic ClassLoader getUserClassLoader()
EnvironmentgetUserClassLoader in interface Environmentpublic void addCopyTasksForCacheFile(Map<String,FutureTask<Path>> copyTasks)
public void addCopyTaskForCacheFile(String name, FutureTask<Path> copyTask)
public Map<String,FutureTask<Path>> getCopyTask()
getCopyTask in interface Environmentpublic BufferProvider getOutputBufferProvider()
EnvironmentgetOutputBufferProvider in interface EnvironmentRecordWriterpublic Buffer requestBuffer(int minBufferSize) throws IOException
BufferProviderminBufferSize. The method returns immediately, even if the
request could not be fulfilled.requestBuffer in interface BufferProviderminBufferSize - minimum size of the requested buffer (in bytes)null if no such buffer is currently availableIOExceptionpublic Buffer requestBufferBlocking(int minBufferSize) throws IOException, InterruptedException
BufferProviderminBufferSize. The method blocks until the request has
been fulfilled or BufferProvider.reportAsynchronousEvent() has been called.requestBufferBlocking in interface BufferProviderminBufferSize - minimum size of the requested buffer (in bytes)IOExceptionInterruptedExceptionpublic int getBufferSize()
BufferProvidergetBufferSize in interface BufferProviderpublic BufferProvider.BufferAvailabilityRegistration registerBufferAvailabilityListener(BufferAvailabilityListener listener)
BufferProviderBufferAvailabilityListener with an empty buffer pool.
The registration only succeeds, if the buffer pool is empty and has not been destroyed yet.
The registered listener will receive a notification when at least one buffer has become available again. After the notification, the listener will be unregistered.
registerBufferAvailabilityListener in interface BufferProviderlistener - the listener to be registeredtrue if the registration has been successful; false if the registration
failed, because the buffer pool was not empty or has already been destroyedpublic int getNumberOfChannels()
LocalBufferPoolOwnergetNumberOfChannels in interface LocalBufferPoolOwnerpublic void setDesignatedNumberOfBuffers(int numBuffers)
LocalBufferPoolOwnerLocalBufferPool.setDesignatedNumberOfBuffers in interface LocalBufferPoolOwnernumBuffers - the numBuffers the local buffer pool owner is allowed to fetch from the global buffer poolpublic void clearLocalBufferPool()
LocalBufferPoolOwnerclearLocalBufferPool in interface LocalBufferPoolOwnerpublic void registerGlobalBufferPool(GlobalBufferPool globalBufferPool)
registerGlobalBufferPool in interface LocalBufferPoolOwnerpublic void logBufferUtilization()
LocalBufferPoolOwnerlogBufferUtilization in interface LocalBufferPoolOwnerpublic void reportAsynchronousEvent()
BufferProviderreportAsynchronousEvent in interface BufferProviderreportAsynchronousEvent in interface LocalBufferPoolOwnerCopyright © 2015 The Apache Software Foundation. All rights reserved.