public abstract class WorkerContext extends WorkerAggregatorDelegator<org.apache.hadoop.io.WritableComparable,org.apache.hadoop.io.Writable,org.apache.hadoop.io.Writable> implements org.apache.hadoop.io.Writable, WorkerIndexUsage<org.apache.hadoop.io.WritableComparable>
| Constructor and Description |
|---|
WorkerContext() |
| Modifier and Type | Method and Description |
|---|---|
List<org.apache.hadoop.io.Writable> |
getAndClearMessagesFromOtherWorkers()
Get messages which other workers sent to this worker and clear them (can
be called once per superstep)
|
org.apache.hadoop.mapreduce.Mapper.Context |
getContext()
Get the mapper context
|
int |
getMyWorkerIndex()
Get index for this worker
|
long |
getSuperstep()
Retrieves the current superstep.
|
long |
getTotalNumEdges()
Get the total (all workers) number of edges that
existed in the previous superstep.
|
long |
getTotalNumVertices()
Get the total (all workers) number of vertices that
existed in the previous superstep.
|
int |
getWorkerCount()
Get number of workers
|
int |
getWorkerForVertex(org.apache.hadoop.io.WritableComparable vertexId)
Get worker index which will contain vertex with given id,
if such vertex exists.
|
void |
logToCommandLine(String line)
Call this to log a line to command line of the job.
|
abstract void |
postApplication()
Finalize the WorkerContext.
|
abstract void |
postSuperstep()
Execute user code.
|
abstract void |
preApplication()
Initialize the WorkerContext.
|
abstract void |
preSuperstep()
Execute user code.
|
void |
readFields(DataInput dataInput) |
void |
sendMessageToWorker(org.apache.hadoop.io.Writable message,
int workerIndex)
Send message to another worker
|
void |
setGraphState(GraphState graphState)
Set the graph state.
|
void |
setupSuperstep(CentralizedServiceWorker<?,?,?> serviceWorker)
Setup superstep.
|
void |
write(DataOutput dataOutput) |
aggregate, getAggregatedValue, getBroadcast, reduce, reduceMerge, setWorkerGlobalCommUsagegetConf, setConfpublic final void setGraphState(GraphState graphState)
graphState - Used to set the graph state.public final void setupSuperstep(CentralizedServiceWorker<?,?,?> serviceWorker)
serviceWorker - Service worker containing all the informationpublic abstract void preApplication()
throws InstantiationException,
IllegalAccessException
IllegalAccessException - Thrown for getting the classInstantiationException - Expected instantiation in this method.public abstract void postApplication()
public abstract void preSuperstep()
public final int getWorkerCount()
getWorkerCount in interface WorkerIndexUsage<org.apache.hadoop.io.WritableComparable>public final int getMyWorkerIndex()
getMyWorkerIndex in interface WorkerIndexUsage<org.apache.hadoop.io.WritableComparable>public final int getWorkerForVertex(org.apache.hadoop.io.WritableComparable vertexId)
WorkerIndexUsagegetWorkerForVertex in interface WorkerIndexUsage<org.apache.hadoop.io.WritableComparable>vertexId - vertex idpublic final List<org.apache.hadoop.io.Writable> getAndClearMessagesFromOtherWorkers()
public final void sendMessageToWorker(org.apache.hadoop.io.Writable message,
int workerIndex)
message - Message to sendworkerIndex - Index of the worker to send the message topublic abstract void postSuperstep()
public final long getSuperstep()
public final long getTotalNumVertices()
public final long getTotalNumEdges()
public final org.apache.hadoop.mapreduce.Mapper.Context getContext()
public final void logToCommandLine(String line)
line - Line to printpublic void write(DataOutput dataOutput) throws IOException
write in interface org.apache.hadoop.io.WritableIOExceptionpublic void readFields(DataInput dataInput) throws IOException
readFields in interface org.apache.hadoop.io.WritableIOExceptionCopyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.