org.apache.giraph.bsp
Interface CentralizedServiceMaster<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable,M extends org.apache.hadoop.io.Writable>

Type Parameters:
I - Vertex id
V - Vertex value
E - Edge value
M - Message data
All Superinterfaces:
CentralizedService<I,V,E,M>
All Known Implementing Classes:
BspServiceMaster

public interface CentralizedServiceMaster<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable,M extends org.apache.hadoop.io.Writable>
extends CentralizedService<I,V,E,M>

At most, there will be one active master at a time, but many threads can be trying to be the active master.


Method Summary
 boolean becomeMaster()
          Become the master.
 void cleanup()
          Clean up the service (no calls may be issued after this)
 SuperstepState coordinateSuperstep()
          Master coordinates the superstep
 int createEdgeInputSplits()
          Create the InputSplit objects from the index range based on the user-defined EdgeInputFormat.
 int createVertexInputSplits()
          Create the InputSplit objects from the index range based on the user-defined VertexInputFormat.
 void failureCleanup(Exception e)
          Called when the job fails in order to let the Master do any cleanup.
 MasterAggregatorHandler getAggregatorHandler()
          Get master aggregator handler
 long getLastGoodCheckpoint()
          Get the last known good checkpoint
 MasterInfo getMasterInfo()
          Get master information
 void postApplication()
          Application has finished.
 void postSuperstep()
          Superstep has finished.
 void restartFromCheckpoint(long checkpoint)
          Master can decide to restart from the last good checkpoint if a worker fails during a superstep.
 void setJobState(ApplicationState state, long applicationAttempt, long desiredSuperstep)
          If the master decides that this job doesn't have the resources to continue, it can fail the job.
 void setup()
          Setup (must be called prior to any other function)
 
Methods inherited from interface org.apache.giraph.bsp.CentralizedService
checkpointFrequencyMet, getRestartedSuperstep, getSuperstep, getWorkerInfoList
 

Method Detail

setup

void setup()
Setup (must be called prior to any other function)


becomeMaster

boolean becomeMaster()
Become the master.

Returns:
true if became the master, false if the application is done.

getMasterInfo

MasterInfo getMasterInfo()
Get master information

Returns:
Master information

createVertexInputSplits

int createVertexInputSplits()
Create the InputSplit objects from the index range based on the user-defined VertexInputFormat. The InputSplit objects will processed by the workers later on during the INPUT_SUPERSTEP.

Returns:
Number of splits. Returns -1 on failure to create valid input splits.

createEdgeInputSplits

int createEdgeInputSplits()
Create the InputSplit objects from the index range based on the user-defined EdgeInputFormat. The InputSplit objects will processed by the workers later on during the INPUT_SUPERSTEP.

Returns:
Number of splits. Returns -1 on failure to create valid input splits.

coordinateSuperstep

SuperstepState coordinateSuperstep()
                                   throws org.apache.zookeeper.KeeperException,
                                          InterruptedException
Master coordinates the superstep

Returns:
State of the application as a result of this superstep
Throws:
InterruptedException
org.apache.zookeeper.KeeperException

restartFromCheckpoint

void restartFromCheckpoint(long checkpoint)
Master can decide to restart from the last good checkpoint if a worker fails during a superstep.

Parameters:
checkpoint - Checkpoint to restart from

getLastGoodCheckpoint

long getLastGoodCheckpoint()
                           throws IOException
Get the last known good checkpoint

Returns:
Last good superstep number
Throws:
IOException

setJobState

void setJobState(ApplicationState state,
                 long applicationAttempt,
                 long desiredSuperstep)
If the master decides that this job doesn't have the resources to continue, it can fail the job. It can also designate what to do next. Typically this is mainly informative.

Parameters:
state - State of the application.
applicationAttempt - Attempt to start on
desiredSuperstep - Superstep to restart from (if applicable)

getAggregatorHandler

MasterAggregatorHandler getAggregatorHandler()
Get master aggregator handler

Returns:
Master aggregator handler

postSuperstep

void postSuperstep()
Superstep has finished.


postApplication

void postApplication()
Application has finished.


failureCleanup

void failureCleanup(Exception e)
Called when the job fails in order to let the Master do any cleanup.

Parameters:
e - Exception job failed from. May be null.

cleanup

void cleanup()
             throws IOException,
                    InterruptedException
Clean up the service (no calls may be issued after this)

Throws:
IOException
InterruptedException


Copyright © 2011-2013 The Apache Software Foundation. All Rights Reserved.