I
- Vertex idV
- Vertex dataE
- Edge datapublic abstract class BspService<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable> extends Object implements org.apache.zookeeper.Watcher, CentralizedService<I,V,E>
CentralizedService
.Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_ATTEMPTS_DIR
Directory of attempts of this application
|
protected String |
applicationAttemptsPath
Path to the application attempts)
|
static String |
BASE_DIR
Base ZooKeeper directory
|
protected String |
basePath
Path to the job's root
|
protected String |
checkpointBasePath
Path to the checkpoint's root (including job id)
|
static String |
CLEANED_UP_DIR
Denotes which workers have been cleaned up
|
protected String |
cleanedUpPath
Path to the cleaned up notifications
|
static String |
COUNTERS_DIR
Counter sub directory
|
static String |
FORCE_CHECKPOINT_USER_FLAG
User sets this flag to checkpoint and stop the job
|
static String |
HALT_COMPUTATION_NODE
Denotes that computation should be halted
|
protected String |
haltComputationPath
If this path exists computation will be halted
|
static String |
INPUT_SPLITS_ALL_DONE_NODE
Input splits all done node
|
static String |
INPUT_SPLITS_WORKER_DONE_DIR
Input splits worker done directory
|
static long |
INPUT_SUPERSTEP
Input superstep (superstep when loading the vertices happens)
|
protected String |
inputSplitsAllDonePath
Input splits all done node
|
protected String |
inputSplitsWorkerDonePath
Input splits worker done directory
|
static String |
JSONOBJ_APPLICATION_ATTEMPT_KEY
JSON application attempt key
|
static String |
JSONOBJ_METRICS_KEY
JSON metrics key
|
static String |
JSONOBJ_NUM_MESSAGE_BYTES_KEY
JSON message bytes count key
|
static String |
JSONOBJ_NUM_MESSAGES_KEY
JSON message count key
|
static String |
JSONOBJ_STATE_KEY
JSON state key
|
static String |
JSONOBJ_SUPERSTEP_KEY
JSON superstep key
|
static String |
KRYO_REGISTERED_CLASS_DIR
Directory to store kryo className-ID assignment
|
protected String |
kryoRegisteredClassPath
Kryo className-ID mapping directory
|
static String |
MASTER_ELECTION_DIR
Where the master election happens
|
static String |
MASTER_JOB_STATE_NODE
Master job state znode above base dir
|
static String |
MASTER_SUFFIX
Suffix denotes a master
|
protected String |
masterElectionPath
Path to the master election path
|
protected String |
masterJobStatePath
Path to the job state determined by the master (informative only)
|
static String |
MEMORY_OBSERVER_DIR
Memory observer dir
|
protected String |
memoryObserverPath
Path where memory observer stores data
|
static String |
METRICS_DIR
Metrics sub directory
|
static String |
PARTITION_EXCHANGE_DIR
Helps coordinate the partition exchnages
|
protected String |
savedCheckpointBasePath
Old checkpoint in case we want to restart some job
|
static String |
SUPERSTEP_DIR
Superstep scope
|
static String |
SUPERSTEP_FINISHED_NODE
Denotes that the superstep is done
|
static long |
UNSET_APPLICATION_ATTEMPT
Unset application attempt
|
static long |
UNSET_SUPERSTEP
Unset superstep
|
static String |
WORKER_FINISHED_DIR
Finished workers notify here
|
static String |
WORKER_HEALTHY_DIR
Healthy workers register here.
|
static String |
WORKER_SUFFIX
Suffix denotes a worker
|
static String |
WORKER_UNHEALTHY_DIR
Unhealthy workers register here.
|
static String |
WORKER_WROTE_CHECKPOINT_DIR
Workers which wrote checkpoint notify here
|
Constructor and Description |
---|
BspService(org.apache.hadoop.mapreduce.Mapper.Context context,
GraphTaskManager<I,V,E> graphTaskManager)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
long |
getApplicationAttempt()
Get the latest application attempt and cache it.
|
BspEvent |
getApplicationAttemptChangedEvent() |
String |
getCheckpointBasePath(long superstep)
Generate the base superstep directory path for a given application
attempt
|
BspEvent |
getCleanedUpChildrenChangedEvent() |
ImmutableClassesGiraphConfiguration<I,V,E> |
getConfiguration()
Get configuration
|
org.apache.hadoop.mapreduce.Mapper.Context |
getContext() |
org.apache.hadoop.fs.FileSystem |
getFs()
Get the file system
|
protected GraphPartitionerFactory<I,V,E> |
getGraphPartitionerFactory()
Subclasses can use this to instantiate their respective partitioners
|
GraphTaskManager<I,V,E> |
getGraphTaskManager() |
static String |
getHealthyHostnameIdFromPath(String path)
Get the hostname and id from a "healthy" worker path
|
String |
getHostname() |
String |
getHostnameTaskId() |
BspEvent |
getInputSplitsAllDoneEvent() |
BspEvent |
getInputSplitsWorkerDoneEvent() |
String |
getJobId()
Get the job id
|
JobProgressTracker |
getJobProgressTracker()
Get JobProgressTracker to report progress to
|
org.json.JSONObject |
getJobState()
Get the master commanded job state as a JSONObject.
|
protected long |
getLastCheckpointedSuperstep()
Get the last saved superstep.
|
BspEvent |
getMasterElectionChildrenChangedEvent() |
String |
getPartitionExchangePath(long attempt,
long superstep)
Generate the "partition exchange" directory path for a superstep
|
String |
getPartitionExchangeWorkerPath(long attempt,
long superstep,
WorkerInfo workerInfo)
Based on the superstep, worker info, and attempt, get the appropriate
worker path for the exchange.
|
long |
getRestartedSuperstep()
Get the restarted superstep
|
String |
getSavedCheckpointBasePath(long superstep)
In case when we restart another job this will give us a path
to saved checkpoint.
|
long |
getSuperstep()
Get the latest superstep and cache it.
|
BspEvent |
getSuperstepFinishedEvent() |
String |
getSuperstepFinishedPath(long attempt,
long superstep)
Generate the "superstep finished" directory path for a superstep
|
static long |
getSuperstepFromPath(String path)
Get the superstep from a ZooKeeper path
|
String |
getSuperstepPath(long attempt)
Generate the base superstep directory path for a given application
attempt
|
int |
getTaskId() |
String |
getWorkerCountersFinishedPath(long attempt,
long superstep)
Generate the worker "finished" directory path for a
superstep, for storing the superstep-related counters
|
BspEvent |
getWorkerHealthRegistrationChangedEvent() |
protected int |
getWorkerId(WorkerInfo workerInfo)
For every worker this method returns unique number
between 0 and N, where N is the total number of workers.
|
protected WorkerInfo |
getWorkerInfoById(int id)
Returns worker info corresponding to specified worker id.
|
String |
getWorkerInfoHealthyPath(long attempt,
long superstep)
Generate the worker information "healthy" directory path for a
superstep
|
String |
getWorkerInfoUnhealthyPath(long attempt,
long superstep)
Generate the worker information "unhealthy" directory path for a
superstep
|
String |
getWorkerMetricsFinishedPath(long attempt,
long superstep)
Generate the worker "finished" directory path for a
superstep, for storing the superstep-related metrics
|
String |
getWorkerWroteCheckpointPath(long attempt,
long superstep)
Generate the worker "wrote checkpoint" directory path for a
superstep
|
BspEvent |
getWrittenCountersToZKEvent() |
ZooKeeperExt |
getZkExt()
Get the ZooKeeperExt instance.
|
void |
incrCachedSuperstep()
Increment the cached superstep.
|
void |
process(org.apache.zookeeper.WatchedEvent event) |
protected boolean |
processEvent(org.apache.zookeeper.WatchedEvent event)
Derived classes that want additional ZooKeeper events to take action
should override this.
|
void |
registerBspEvent(BspEvent event)
Register a BspEvent.
|
void |
setApplicationAttempt(long applicationAttempt)
Set the cached application attempt (should only be used for restart from
failure by the master)
|
void |
setCachedSuperstep(long superstep)
Set the cached superstep (should only be used for loading checkpoints
or recovering from failure).
|
void |
setRestartedSuperstep(long superstep)
Set the restarted superstep
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMasterInfo, getWorkerInfoList
public static final long UNSET_SUPERSTEP
public static final long INPUT_SUPERSTEP
public static final long UNSET_APPLICATION_ATTEMPT
public static final String BASE_DIR
public static final String MASTER_JOB_STATE_NODE
public static final String INPUT_SPLITS_WORKER_DONE_DIR
public static final String INPUT_SPLITS_ALL_DONE_NODE
public static final String KRYO_REGISTERED_CLASS_DIR
public static final String APPLICATION_ATTEMPTS_DIR
public static final String MASTER_ELECTION_DIR
public static final String SUPERSTEP_DIR
public static final String COUNTERS_DIR
public static final String METRICS_DIR
public static final String WORKER_HEALTHY_DIR
public static final String WORKER_UNHEALTHY_DIR
public static final String WORKER_WROTE_CHECKPOINT_DIR
public static final String WORKER_FINISHED_DIR
public static final String PARTITION_EXCHANGE_DIR
public static final String SUPERSTEP_FINISHED_NODE
public static final String HALT_COMPUTATION_NODE
public static final String MEMORY_OBSERVER_DIR
public static final String FORCE_CHECKPOINT_USER_FLAG
public static final String CLEANED_UP_DIR
public static final String JSONOBJ_NUM_MESSAGES_KEY
public static final String JSONOBJ_NUM_MESSAGE_BYTES_KEY
public static final String JSONOBJ_METRICS_KEY
public static final String JSONOBJ_STATE_KEY
public static final String JSONOBJ_APPLICATION_ATTEMPT_KEY
public static final String JSONOBJ_SUPERSTEP_KEY
public static final String WORKER_SUFFIX
public static final String MASTER_SUFFIX
protected final String basePath
protected final String masterJobStatePath
protected final String inputSplitsWorkerDonePath
protected final String inputSplitsAllDonePath
protected final String applicationAttemptsPath
protected final String cleanedUpPath
protected final String checkpointBasePath
protected final String savedCheckpointBasePath
protected final String masterElectionPath
protected final String haltComputationPath
protected final String memoryObserverPath
protected final String kryoRegisteredClassPath
public BspService(org.apache.hadoop.mapreduce.Mapper.Context context, GraphTaskManager<I,V,E> graphTaskManager)
context
- Mapper contextgraphTaskManager
- GraphTaskManager for this compute nodepublic static long getSuperstepFromPath(String path)
path
- Path to parse for the supersteppublic static String getHealthyHostnameIdFromPath(String path)
path
- Path to checkpublic final String getSuperstepPath(long attempt)
attempt
- application attempt numberpublic final String getWorkerInfoHealthyPath(long attempt, long superstep)
attempt
- application attempt numbersuperstep
- superstep to usepublic final String getWorkerInfoUnhealthyPath(long attempt, long superstep)
attempt
- application attempt numbersuperstep
- superstep to usepublic final String getWorkerWroteCheckpointPath(long attempt, long superstep)
attempt
- application attempt numbersuperstep
- superstep to usepublic final String getWorkerMetricsFinishedPath(long attempt, long superstep)
attempt
- application attempt numbersuperstep
- superstep to usepublic final String getWorkerCountersFinishedPath(long attempt, long superstep)
attempt
- application attempt numbersuperstep
- superstep to usepublic final String getPartitionExchangePath(long attempt, long superstep)
attempt
- application attempt numbersuperstep
- superstep to usepublic final String getPartitionExchangeWorkerPath(long attempt, long superstep, WorkerInfo workerInfo)
attempt
- Application attemptsuperstep
- SuperstepworkerInfo
- Worker info of the exchange.public final String getSuperstepFinishedPath(long attempt, long superstep)
attempt
- application attempt numbersuperstep
- superstep to usepublic final String getCheckpointBasePath(long superstep)
superstep
- Superstep to usepublic final String getSavedCheckpointBasePath(long superstep)
superstep
- superstep to usepublic final ZooKeeperExt getZkExt()
public final long getRestartedSuperstep()
CentralizedService
getRestartedSuperstep
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 final void setRestartedSuperstep(long superstep)
superstep
- Set the manually restarted supersteppublic final org.apache.hadoop.fs.FileSystem getFs()
public final ImmutableClassesGiraphConfiguration<I,V,E> getConfiguration()
CentralizedService
getConfiguration
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 final org.apache.hadoop.mapreduce.Mapper.Context getContext()
public final String getHostname()
public final String getHostnameTaskId()
public final int getTaskId()
public final GraphTaskManager<I,V,E> getGraphTaskManager()
public final BspEvent getWorkerHealthRegistrationChangedEvent()
public final BspEvent getApplicationAttemptChangedEvent()
public final BspEvent getInputSplitsWorkerDoneEvent()
public final BspEvent getInputSplitsAllDoneEvent()
public final BspEvent getSuperstepFinishedEvent()
public final BspEvent getMasterElectionChildrenChangedEvent()
public final BspEvent getCleanedUpChildrenChangedEvent()
public final BspEvent getWrittenCountersToZKEvent()
public final org.json.JSONObject getJobState()
public final String getJobId()
public final long getApplicationAttempt()
public final long getSuperstep()
getSuperstep
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 final void incrCachedSuperstep()
public final void setCachedSuperstep(long superstep)
superstep
- will be used as the next superstep iterationpublic final void setApplicationAttempt(long applicationAttempt)
applicationAttempt
- Will denote the new application attemptpublic void registerBspEvent(BspEvent event)
event
- Event to be registered.protected GraphPartitionerFactory<I,V,E> getGraphPartitionerFactory()
protected boolean processEvent(org.apache.zookeeper.WatchedEvent event)
event
- Event that occurredpublic final void process(org.apache.zookeeper.WatchedEvent event)
process
in interface org.apache.zookeeper.Watcher
protected long getLastCheckpointedSuperstep() throws IOException
IOException
public JobProgressTracker getJobProgressTracker()
CentralizedService
getJobProgressTracker
in interface CentralizedService<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>
protected int getWorkerId(WorkerInfo workerInfo)
workerInfo
- worker info objectprotected WorkerInfo getWorkerInfoById(int id)
id
- unique worker idCopyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.