org.apache.hama.bsp
Class BSPJobClient

java.lang.Object
  extended by org.apache.hadoop.conf.Configured
      extended by org.apache.hama.bsp.BSPJobClient
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable, org.apache.hadoop.util.Tool

public class BSPJobClient
extends org.apache.hadoop.conf.Configured
implements org.apache.hadoop.util.Tool

BSPJobClient is the primary interface for the user-job to interact with the BSPMaster. BSPJobClient provides facilities to submit jobs, track their progress, access component-tasks' reports/logs, get the BSP cluster status information etc.


Nested Class Summary
static class BSPJobClient.TaskStatusFilter
           
 
Constructor Summary
BSPJobClient()
           
BSPJobClient(org.apache.hadoop.conf.Configuration conf)
           
 
Method Summary
 void close()
          Close the JobClient.
 JobStatus[] getAllJobs()
          Gets the jobs that are submitted.
 ClusterStatus getClusterStatus(boolean detailed)
          Get status information about the BSP cluster
 org.apache.hadoop.fs.FileSystem getFs()
          Get a filesystem handle.
 org.apache.hadoop.fs.Path getSystemDir()
          Grab the bspmaster system directory path where job-specific files are to be placed.
 void init(org.apache.hadoop.conf.Configuration conf)
           
 JobStatus[] jobsToComplete()
          Gets the jobs that are not completed and not failed.
static void main(java.lang.String[] args)
           
 boolean monitorAndPrintJob(BSPJob job, RunningJob info)
          Monitor a job and print status in real-time as progress is made and tasks fail.
 int run(java.lang.String[] args)
           
static void runJob(BSPJob job)
           
 RunningJob submitJob(BSPJob job)
          Submit a job to the BSP system.
 RunningJob submitJobInternal(BSPJob job)
           
 
Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
 

Constructor Detail

BSPJobClient

public BSPJobClient(org.apache.hadoop.conf.Configuration conf)
             throws java.io.IOException
Throws:
java.io.IOException

BSPJobClient

public BSPJobClient()
Method Detail

init

public void init(org.apache.hadoop.conf.Configuration conf)
          throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Close the JobClient.

Throws:
java.io.IOException

getFs

public org.apache.hadoop.fs.FileSystem getFs()
                                      throws java.io.IOException
Get a filesystem handle. We need this to prepare jobs for submission to the BSP system.

Returns:
the filesystem handle.
Throws:
java.io.IOException

getAllJobs

public JobStatus[] getAllJobs()
                       throws java.io.IOException
Gets the jobs that are submitted.

Returns:
array of JobStatus for the submitted jobs.
Throws:
java.io.IOException

jobsToComplete

public JobStatus[] jobsToComplete()
                           throws java.io.IOException
Gets the jobs that are not completed and not failed.

Returns:
array of JobStatus for the running/to-be-run jobs.
Throws:
java.io.IOException

submitJob

public RunningJob submitJob(BSPJob job)
                     throws java.io.FileNotFoundException,
                            java.io.IOException
Submit a job to the BSP system. This returns a handle to the RunningJob which can be used to track the running-job.

Parameters:
job - the job configuration.
Returns:
a handle to the RunningJob which can be used to track the running-job.
Throws:
java.io.FileNotFoundException
java.io.IOException

submitJobInternal

public RunningJob submitJobInternal(BSPJob job)
                             throws java.io.IOException
Throws:
java.io.IOException

monitorAndPrintJob

public boolean monitorAndPrintJob(BSPJob job,
                                  RunningJob info)
                           throws java.io.IOException,
                                  java.lang.InterruptedException
Monitor a job and print status in real-time as progress is made and tasks fail.

Parameters:
job -
info -
Returns:
true, if job is successful
Throws:
java.io.IOException
java.lang.InterruptedException

getSystemDir

public org.apache.hadoop.fs.Path getSystemDir()
Grab the bspmaster system directory path where job-specific files are to be placed.

Returns:
the system directory where job-specific files are to be placed.

runJob

public static void runJob(BSPJob job)
                   throws java.io.FileNotFoundException,
                          java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

getClusterStatus

public ClusterStatus getClusterStatus(boolean detailed)
                               throws java.io.IOException
Get status information about the BSP cluster

Parameters:
detailed - if true then get a detailed status including the groomserver names
Returns:
the status information about the BSP cluster as an object of ClusterStatus.
Throws:
java.io.IOException

run

public int run(java.lang.String[] args)
        throws java.lang.Exception
Specified by:
run in interface org.apache.hadoop.util.Tool
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


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