public abstract class MasterCompute extends DefaultImmutableClassesGiraphConfigurable implements MasterAggregatorUsage, MasterGlobalCommUsage, org.apache.hadoop.io.Writable
Constructor and Description |
---|
MasterCompute() |
Modifier and Type | Method and Description |
---|---|
void |
broadcast(String name,
org.apache.hadoop.io.Writable object)
Broadcast given value to all workers for next computation.
|
abstract void |
compute()
Must be defined by user to specify what the master has to do.
|
<A extends org.apache.hadoop.io.Writable> |
getAggregatedValue(String name)
Get value of an aggregator.
|
Class<? extends Computation> |
getComputation()
Get Computation class to be used
|
org.apache.hadoop.mapreduce.Mapper.Context |
getContext()
Get the mapper context
|
Class<? extends MessageCombiner> |
getMessageCombiner()
Get MessageCombiner class to be used
|
<T extends org.apache.hadoop.io.Writable> |
getReduced(String name)
Get reduced value from previous worker computation.
|
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.
|
List<WorkerInfo> |
getWorkerInfoList()
Get list of workers
|
void |
haltComputation()
After this is called, the computation will stop, even if there are
still messages in the system or vertices that have not voted to halt.
|
abstract void |
initialize()
Initialize the MasterCompute class, this is the place to register
aggregators.
|
boolean |
isHalted()
Has the master halted?
|
void |
logToCommandLine(String line)
Call this to log a line to command line of the job.
|
<A extends org.apache.hadoop.io.Writable> |
registerAggregator(String name,
Class<? extends Aggregator<A>> aggregatorClass)
Register an aggregator in preSuperstep() and/or preApplication().
|
<A extends org.apache.hadoop.io.Writable> |
registerPersistentAggregator(String name,
Class<? extends Aggregator<A>> aggregatorClass)
Register persistent aggregator in preSuperstep() and/or
preApplication().
|
<S,R extends org.apache.hadoop.io.Writable> |
registerReducer(String name,
ReduceOperation<S,R> reduceOp)
Register reducer to be reduced in the next worker computation,
using given name and operations.
|
<S,R extends org.apache.hadoop.io.Writable> |
registerReducer(String name,
ReduceOperation<S,R> reduceOp,
R globalInitialValue)
Register reducer to be reduced in the next worker computation, using
given name and operations, starting globally from globalInitialValue.
|
<A extends org.apache.hadoop.io.Writable> |
setAggregatedValue(String name,
A value)
Sets value of an aggregator.
|
void |
setComputation(Class<? extends Computation> computationClass)
Set Computation class to be used
|
void |
setGraphState(GraphState graphState) |
void |
setIncomingMessage(Class<? extends org.apache.hadoop.io.Writable> incomingMessageClass)
Deprecated.
|
void |
setMasterService(CentralizedServiceMaster serviceMaster) |
void |
setMessageCombiner(Class<? extends MessageCombiner> combinerClass)
Set MessageCombiner class to be used
|
void |
setOutgoingMessage(Class<? extends org.apache.hadoop.io.Writable> outgoingMessageClass)
Set outgoing message class to be used
|
void |
setOutgoingMessageClasses(MessageClasses<? extends org.apache.hadoop.io.WritableComparable,? extends org.apache.hadoop.io.Writable> outgoingMessageClasses)
Set outgoing message classes to be used
|
void |
setSuperstepClasses(SuperstepClasses superstepClasses) |
getConf, setConf
public abstract void compute()
public abstract void initialize() throws InstantiationException, IllegalAccessException
public final long getSuperstep()
public final long getTotalNumVertices()
public final long getTotalNumEdges()
public final void haltComputation()
public final boolean isHalted()
public final org.apache.hadoop.mapreduce.Mapper.Context getContext()
public final List<WorkerInfo> getWorkerInfoList()
public final void setComputation(Class<? extends Computation> computationClass)
computationClass
- Computation classpublic final Class<? extends Computation> getComputation()
public final void setMessageCombiner(Class<? extends MessageCombiner> combinerClass)
combinerClass
- MessageCombiner classpublic final Class<? extends MessageCombiner> getMessageCombiner()
@Deprecated public final void setIncomingMessage(Class<? extends org.apache.hadoop.io.Writable> incomingMessageClass)
incomingMessageClass
- incoming message classpublic final void setOutgoingMessage(Class<? extends org.apache.hadoop.io.Writable> outgoingMessageClass)
outgoingMessageClass
- outgoing message classpublic void setOutgoingMessageClasses(MessageClasses<? extends org.apache.hadoop.io.WritableComparable,? extends org.apache.hadoop.io.Writable> outgoingMessageClasses)
outgoingMessageClasses
- outgoing message classespublic final <S,R extends org.apache.hadoop.io.Writable> void registerReducer(String name, ReduceOperation<S,R> reduceOp)
MasterGlobalCommUsageAggregators
registerReducer
in interface MasterGlobalCommUsageAggregators
S
- Single value typeR
- Reduced value typename
- Name of the reducerreduceOp
- Reduce operationspublic final <S,R extends org.apache.hadoop.io.Writable> void registerReducer(String name, ReduceOperation<S,R> reduceOp, R globalInitialValue)
MasterGlobalCommUsageAggregators
registerReducer
in interface MasterGlobalCommUsageAggregators
S
- Single value typeR
- Reduced value typename
- Name of the reducerreduceOp
- Reduce operationsglobalInitialValue
- Global initial valuepublic final <T extends org.apache.hadoop.io.Writable> T getReduced(String name)
MasterGlobalCommUsageAggregators
getReduced
in interface MasterGlobalCommUsageAggregators
T
- Reduced value typename
- Name of the reducerpublic final void broadcast(String name, org.apache.hadoop.io.Writable object)
MasterGlobalCommUsageAggregators
broadcast
in interface MasterGlobalCommUsageAggregators
name
- Name of the broadcast objectobject
- Valuepublic final <A extends org.apache.hadoop.io.Writable> boolean registerAggregator(String name, Class<? extends Aggregator<A>> aggregatorClass) throws InstantiationException, IllegalAccessException
MasterAggregatorUsage
registerAggregator
in interface MasterAggregatorUsage
A
- Aggregator typename
- of aggregatoraggregatorClass
- Class type of the aggregatorInstantiationException
IllegalAccessException
public final <A extends org.apache.hadoop.io.Writable> boolean registerPersistentAggregator(String name, Class<? extends Aggregator<A>> aggregatorClass) throws InstantiationException, IllegalAccessException
MasterAggregatorUsage
registerPersistentAggregator
in interface MasterAggregatorUsage
A
- Aggregator typename
- of aggregatoraggregatorClass
- Class type of the aggregatorInstantiationException
IllegalAccessException
public final <A extends org.apache.hadoop.io.Writable> A getAggregatedValue(String name)
AggregatorUsage
getAggregatedValue
in interface AggregatorUsage
A
- Aggregated valuename
- Name of aggregatorpublic final <A extends org.apache.hadoop.io.Writable> void setAggregatedValue(String name, A value)
MasterAggregatorUsage
setAggregatedValue
in interface MasterAggregatorUsage
A
- Aggregated valuename
- Name of aggregatorvalue
- Value to setpublic void logToCommandLine(String line)
line
- Line to printpublic final void setGraphState(GraphState graphState)
public final void setMasterService(CentralizedServiceMaster serviceMaster)
public final void setSuperstepClasses(SuperstepClasses superstepClasses)
Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.