I - Vertex idV - Vertex dataE - Edge datapublic class BspServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable> extends BspService<I,V,E> implements CentralizedServiceWorker<I,V,E>, ResetSuperstepMetricsObserver
CentralizedServiceWorker.| Modifier and Type | Field and Description |
|---|---|
static String |
TIMER_WAIT_REQUESTS
Name of gauge for time spent waiting on other workers
|
APPLICATION_ATTEMPTS_DIR, applicationAttemptsPath, BASE_DIR, basePath, checkpointBasePath, CLEANED_UP_DIR, cleanedUpPath, COUNTERS_DIR, FORCE_CHECKPOINT_USER_FLAG, HALT_COMPUTATION_NODE, haltComputationPath, INPUT_SPLITS_ALL_DONE_NODE, INPUT_SPLITS_WORKER_DONE_DIR, INPUT_SUPERSTEP, inputSplitsAllDonePath, inputSplitsWorkerDonePath, JSONOBJ_APPLICATION_ATTEMPT_KEY, JSONOBJ_METRICS_KEY, JSONOBJ_NUM_MESSAGE_BYTES_KEY, JSONOBJ_NUM_MESSAGES_KEY, JSONOBJ_STATE_KEY, JSONOBJ_SUPERSTEP_KEY, KRYO_REGISTERED_CLASS_DIR, kryoRegisteredClassPath, MASTER_ELECTION_DIR, MASTER_JOB_STATE_NODE, MASTER_SUFFIX, masterElectionPath, masterJobStatePath, MEMORY_OBSERVER_DIR, memoryObserverPath, METRICS_DIR, PARTITION_EXCHANGE_DIR, savedCheckpointBasePath, SUPERSTEP_DIR, SUPERSTEP_FINISHED_NODE, UNSET_APPLICATION_ATTEMPT, UNSET_SUPERSTEP, WORKER_FINISHED_DIR, WORKER_HEALTHY_DIR, WORKER_SUFFIX, WORKER_UNHEALTHY_DIR, WORKER_WROTE_CHECKPOINT_DIR| Constructor and Description |
|---|
BspServiceWorker(org.apache.hadoop.mapreduce.Mapper.Context context,
GraphTaskManager<I,V,E> graphTaskManager)
Constructor for setting up the worker.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addressesAndPartitionsReceived(AddressesAndPartitionsWritable addressesAndPartitions)
Received addresses and partitions assignments from master.
|
void |
cleanup(FinishedSuperstepStats finishedSuperstepStats)
Clean up the service (no calls may be issued after this)
|
void |
closeZooKeeper()
Method to close the zookeeper connection, after the worker has sent
the counters to the master
|
void |
exchangeVertexPartitions(Collection<? extends PartitionOwner> masterSetPartitionOwners)
If desired by the user, vertex partitions are redistributed among
workers according to the chosen WorkerGraphPartitioner.
|
void |
failureCleanup()
Operations that will be called if there is a failure by a worker.
|
FinishedSuperstepStats |
finishSuperstep(List<PartitionStats> partitionStatsList,
GiraphTimerContext superstepTimerContext)
Worker is done with its portion of the superstep.
|
WorkerAggregatorHandler |
getAggregatorHandler()
Get worker aggregator handler
|
GlobalStats |
getGlobalStats()
Loads Global stats from zookeeper.
|
WorkerInputSplitsHandler |
getInputSplitsHandler()
Get input splits handler used during input
|
LocalData<I,V,E,? extends org.apache.hadoop.io.Writable> |
getLocalData() |
MasterInfo |
getMasterInfo()
Get master info
|
Partition |
getNextPartition()
|
BspEvent |
getPartitionExchangeChildrenChangedEvent()
Get event when the state of a partition exchange has changed.
|
int |
getPartitionId(I vertexId)
Get the partition id that a vertex id would belong to.
|
Iterable<Integer> |
getPartitionIds()
Get the ids of all the stored partitions (on current worker) as Iterable
|
Iterable<? extends PartitionOwner> |
getPartitionOwners()
Get all partition owners.
|
PartitionStore<I,V,E> |
getPartitionStore()
Get the partition store for this worker.
|
long |
getPartitionVertexCount(Integer partitionId)
Return the number of vertices in a partition.
|
ServerData<I,V,E> |
getServerData()
Get server data
|
SuperstepOutput<I,V,E> |
getSuperstepOutput()
Get the superstep output class
|
TranslateEdge<I,E> |
getTranslateEdge() |
PartitionOwner |
getVertexPartitionOwner(I vertexId)
Every client will need to get a partition owner from a vertex id so that
they know which worker to sent the request to.
|
WorkerClient<I,V,E> |
getWorkerClient()
Get the worker client (for instantiating WorkerClientRequestProcessor
instances.
|
WorkerContext |
getWorkerContext()
Get the worker context.
|
WorkerInfo |
getWorkerInfo()
Get the worker information
|
List<WorkerInfo> |
getWorkerInfoList()
Get list of workers
|
WorkerObserver[] |
getWorkerObservers()
Get the observers for this Worker.
|
boolean |
hasPartition(Integer partitionId)
Whether a partition with given id exists on this worker.
|
boolean |
isHealthy()
Intended to check the health of the node.
|
VertexEdgeCount |
loadCheckpoint(long superstep)
Load the vertices, edges, messages from the beginning of a superstep.
|
void |
newSuperstep(SuperstepMetricsRegistry superstepMetrics)
Starting a new superstep.
|
void |
prepareSuperstep()
Final preparation for superstep, called after startSuperstep and
potential loading from checkpoint, right before the computation started
TODO how to avoid this additional function
|
protected boolean |
processEvent(org.apache.zookeeper.WatchedEvent event)
Derived classes that want additional ZooKeeper events to take action
should override this.
|
void |
putPartition(Partition partition)
|
FinishedSuperstepStats |
setup()
Setup (must be called prior to any other function)
|
void |
startIteration()
|
Collection<? extends PartitionOwner> |
startSuperstep()
Take all steps prior to actually beginning the computation of a
superstep.
|
void |
storeCheckpoint()
Both the vertices and the messages need to be checkpointed in order
for them to be used.
|
void |
storeCountersInZooKeeper(boolean allSuperstepsDone)
Method to store the counter values in the zookeeper
This is called at the end of each superstep and after finishing all the
supersteps
|
getApplicationAttempt, getApplicationAttemptChangedEvent, getCheckpointBasePath, getCleanedUpChildrenChangedEvent, getConfiguration, getContext, getFs, getGraphPartitionerFactory, getGraphTaskManager, getHealthyHostnameIdFromPath, getHostname, getHostnameTaskId, getInputSplitsAllDoneEvent, getInputSplitsWorkerDoneEvent, getJobId, getJobProgressTracker, getJobState, getLastCheckpointedSuperstep, getMasterElectionChildrenChangedEvent, getPartitionExchangePath, getPartitionExchangeWorkerPath, getRestartedSuperstep, getSavedCheckpointBasePath, getSuperstep, getSuperstepFinishedEvent, getSuperstepFinishedPath, getSuperstepFromPath, getSuperstepPath, getTaskId, getWorkerCountersFinishedPath, getWorkerHealthRegistrationChangedEvent, getWorkerId, getWorkerInfoById, getWorkerInfoHealthyPath, getWorkerInfoUnhealthyPath, getWorkerMetricsFinishedPath, getWorkerWroteCheckpointPath, getWrittenCountersToZKEvent, getZkExt, incrCachedSuperstep, process, registerBspEvent, setApplicationAttempt, setCachedSuperstep, setRestartedSuperstepclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetGraphTaskManagergetConfiguration, getJobProgressTracker, getRestartedSuperstep, getSupersteppublic static final String TIMER_WAIT_REQUESTS
public BspServiceWorker(org.apache.hadoop.mapreduce.Mapper.Context context,
GraphTaskManager<I,V,E> graphTaskManager)
throws IOException,
InterruptedException
context - Mapper contextgraphTaskManager - GraphTaskManager for this compute nodeIOExceptionInterruptedExceptionpublic void newSuperstep(SuperstepMetricsRegistry superstepMetrics)
ResetSuperstepMetricsObservernewSuperstep in interface ResetSuperstepMetricsObserversuperstepMetrics - SuperstepMetricsRegistry being used.public WorkerContext getWorkerContext()
CentralizedServiceWorkergetWorkerContext in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public WorkerObserver[] getWorkerObservers()
CentralizedServiceWorkergetWorkerObservers in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public WorkerClient<I,V,E> getWorkerClient()
CentralizedServiceWorkergetWorkerClient in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public TranslateEdge<I,E> getTranslateEdge()
public boolean isHealthy()
public MasterInfo getMasterInfo()
CentralizedServicegetMasterInfo in interface CentralizedService<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public List<WorkerInfo> getWorkerInfoList()
CentralizedServicegetWorkerInfoList in interface CentralizedService<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public FinishedSuperstepStats setup()
CentralizedServiceWorkersetup in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public void failureCleanup()
CentralizedServiceWorkerfailureCleanup in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public Collection<? extends PartitionOwner> startSuperstep()
CentralizedServiceWorkerstartSuperstep in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public FinishedSuperstepStats finishSuperstep(List<PartitionStats> partitionStatsList, GiraphTimerContext superstepTimerContext)
CentralizedServiceWorkerfinishSuperstep in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>partitionStatsList - All the partition stats for this workersuperstepTimerContext - superstep timer context only given when the
function needs to stop the timer, otherwise null.public void cleanup(FinishedSuperstepStats finishedSuperstepStats) throws IOException, InterruptedException
CentralizedServiceWorkercleanup in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>finishedSuperstepStats - Finished supestep statsIOExceptionInterruptedExceptionpublic void storeCountersInZooKeeper(boolean allSuperstepsDone)
storeCountersInZooKeeper in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>allSuperstepsDone - Whether the job has finished all supersteps
This is needed to ensure the superstep number is the same for master and
worker, when all supersteps are finishedpublic void closeZooKeeper()
closeZooKeeper in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public void storeCheckpoint()
throws IOException
CentralizedServiceWorkerstoreCheckpoint in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>IOExceptionpublic VertexEdgeCount loadCheckpoint(long superstep)
CentralizedServiceWorkerloadCheckpoint in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>superstep - which checkpoint to usepublic final void exchangeVertexPartitions(Collection<? extends PartitionOwner> masterSetPartitionOwners)
CentralizedServiceWorkerexchangeVertexPartitions in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>masterSetPartitionOwners - Partition owner info passed from the
master.public final BspEvent getPartitionExchangeChildrenChangedEvent()
protected boolean processEvent(org.apache.zookeeper.WatchedEvent event)
BspServiceprocessEvent in class BspService<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>event - Event that occurredpublic WorkerInfo getWorkerInfo()
CentralizedServiceWorkergetWorkerInfo in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public PartitionStore<I,V,E> getPartitionStore()
CentralizedServiceWorkergetPartitionStore in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public PartitionOwner getVertexPartitionOwner(I vertexId)
CentralizedServiceWorkergetVertexPartitionOwner in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>vertexId - Vertex index to look forpublic Iterable<? extends PartitionOwner> getPartitionOwners()
CentralizedServiceWorkergetPartitionOwners in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public int getPartitionId(I vertexId)
CentralizedServiceWorkergetPartitionId in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>getPartitionId in interface PartitionSplitInfo<I extends org.apache.hadoop.io.WritableComparable>vertexId - Vertex idpublic boolean hasPartition(Integer partitionId)
CentralizedServiceWorkerhasPartition in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>partitionId - Partition idpublic Iterable<Integer> getPartitionIds()
PartitionSplitInfogetPartitionIds in interface PartitionSplitInfo<I extends org.apache.hadoop.io.WritableComparable>public long getPartitionVertexCount(Integer partitionId)
PartitionSplitInfogetPartitionVertexCount in interface PartitionSplitInfo<I extends org.apache.hadoop.io.WritableComparable>partitionId - Partition idpublic void startIteration()
PartitionSplitInfostartIteration in interface PartitionSplitInfo<I extends org.apache.hadoop.io.WritableComparable>public Partition getNextPartition()
PartitionSplitInfogetNextPartition in interface PartitionSplitInfo<I extends org.apache.hadoop.io.WritableComparable>public void putPartition(Partition partition)
PartitionSplitInfoputPartition in interface PartitionSplitInfo<I extends org.apache.hadoop.io.WritableComparable>partition - Partitionpublic ServerData<I,V,E> getServerData()
CentralizedServiceWorkergetServerData in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public WorkerAggregatorHandler getAggregatorHandler()
CentralizedServiceWorkergetAggregatorHandler in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public void prepareSuperstep()
CentralizedServiceWorkerprepareSuperstep in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public SuperstepOutput<I,V,E> getSuperstepOutput()
CentralizedServiceWorkergetSuperstepOutput in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public GlobalStats getGlobalStats()
CentralizedServiceWorkergetGlobalStats in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public WorkerInputSplitsHandler getInputSplitsHandler()
CentralizedServiceWorkergetInputSplitsHandler in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>public void addressesAndPartitionsReceived(AddressesAndPartitionsWritable addressesAndPartitions)
CentralizedServiceWorkeraddressesAndPartitionsReceived in interface CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>addressesAndPartitions - Addresses and partitions assignmentCopyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.