edu.isi.pegasus.planner.visualize.nodeusage
Class NodeUsageCallback

java.lang.Object
  extended by edu.isi.pegasus.planner.visualize.nodeusage.NodeUsageCallback
All Implemented Interfaces:
Callback

public class NodeUsageCallback
extends Object
implements Callback

Implements callback interface to calculate node usage or number of jobs over time.

Version:
$Revision: 2587 $
Author:
Karan Vahi

Field Summary
static String GRIDSTART_MAINJOB_STATE
          The state in the jobstate that is taken to designate the GRIDSTART_MAINJOB time.
static String GRIDSTART_POSTJOB_STATE
          The state in the jobstate that is taken to designate the GRIDSTART_POSTJOB time.
static String GRIDSTART_PREJOB_STATE
          The state in the jobstate that is taken to designate the GRIDSTART_PREJOB time.
static String JOBSTATE_LOG
          The name of the tailstatd file.
private  String mDirectory
          The directory where all the files reside.
private  Map mJMStore
          A Map store that stores JobMeasurements objects indexed by the name of the jobs.
protected  JobMeasurements mJobMeasurements
          Stores all the space readings for the current invocation record.
protected  LogManager mLogger
          The handle to the logger.
protected  String mMainJob
          The main job whose record is being parsed.
private  Map mNumJobsStore
          The number of jobs executing at any given time per site.
protected  String mSite
          The logical site where the job was run.
protected  WorkflowMeasurements mWFMeasurements
          The WorkflowMeasurements object created during the callback construction.
 
Fields inherited from interface edu.isi.pegasus.planner.visualize.Callback
VERSION
 
Constructor Summary
NodeUsageCallback()
          The default constructor.
 
Method Summary
 void cbInputFile(String filename, StatInfo info)
          Callback function for when stat information for an input file is encountered.
 void cbInvocationEnd()
          Callback signalling that an invocation record has been parsed.
 void cbInvocationStart(String job, String resource)
          Callback for the starting of an invocation record.
 void cbMachine(Machine machine)
          Callback to pass the machine information on which the job is executed.
 void cbMetadata(Map metadata)
          Callback for the metadata retrieved from the kickstart record.
 void cbOutputFile(String filename, StatInfo info)
          Callback function for when stat information for an output file is encountered.
 void cbStdERR(List jobs, String data)
          Callback function for the data section of stderr.
 void cbStdIN(List jobs, String data)
          Callback function for the data section of stdin.
 void cbStdOut(List jobs, String data)
          Callback function for the data section of stdout.
 boolean cleanupJob(String name)
          Returns boolean indicating whether the job is a cleanup job or not.
 void done()
          Callback signalling that we are done with the parsing of the files.
 Object getConstructedObject()
          Returns the SpaceUsage store built.
private  int getCurrentNumOfJobs(String site)
          Returns the number of jobs that are executing for a particular site
private  int getEventType(String state)
          Returns the event type matching a particular job type
 void initialize(String directory, boolean useStatInfo)
          Initializes the callback.
protected  boolean validState(String state)
          Returns a boolean indicating whether the state is valid or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JOBSTATE_LOG

public static final String JOBSTATE_LOG
The name of the tailstatd file.

See Also:
Constant Field Values

GRIDSTART_PREJOB_STATE

public static final String GRIDSTART_PREJOB_STATE
The state in the jobstate that is taken to designate the GRIDSTART_PREJOB time.

See Also:
Constant Field Values

GRIDSTART_MAINJOB_STATE

public static final String GRIDSTART_MAINJOB_STATE
The state in the jobstate that is taken to designate the GRIDSTART_MAINJOB time.

See Also:
Constant Field Values

GRIDSTART_POSTJOB_STATE

public static final String GRIDSTART_POSTJOB_STATE
The state in the jobstate that is taken to designate the GRIDSTART_POSTJOB time.

See Also:
Constant Field Values

mSite

protected String mSite
The logical site where the job was run.


mWFMeasurements

protected WorkflowMeasurements mWFMeasurements
The WorkflowMeasurements object created during the callback construction.


mMainJob

protected String mMainJob
The main job whose record is being parsed.


mLogger

protected LogManager mLogger
The handle to the logger.


mJobMeasurements

protected JobMeasurements mJobMeasurements
Stores all the space readings for the current invocation record.


mJMStore

private Map mJMStore
A Map store that stores JobMeasurements objects indexed by the name of the jobs.


mDirectory

private String mDirectory
The directory where all the files reside.


mNumJobsStore

private Map mNumJobsStore
The number of jobs executing at any given time per site.

Constructor Detail

NodeUsageCallback

public NodeUsageCallback()
The default constructor.

Method Detail

initialize

public void initialize(String directory,
                       boolean useStatInfo)
Initializes the callback.

Specified by:
initialize in interface Callback
Parameters:
directory - the directory where all the files reside.
useStatInfo - boolean indicating whether to use stat info or not.

cbInvocationStart

public void cbInvocationStart(String job,
                              String resource)
Description copied from interface: Callback
Callback for the starting of an invocation record.

Specified by:
cbInvocationStart in interface Callback
Parameters:
job - the job/file being parsed.
resource - the site id where the job was executed.

cbStdIN

public void cbStdIN(List jobs,
                    String data)
Description copied from interface: Callback
Callback function for the data section of stdin. Since the jobs ( setup, prejob, main, postjob, cleanup) do not have separate stdout etc, all are passed.

Specified by:
cbStdIN in interface Callback
Parameters:
jobs - all the jobs specified in the kickstart record.
data - the data contents as String.

cbStdOut

public void cbStdOut(List jobs,
                     String data)
Description copied from interface: Callback
Callback function for the data section of stdout. Since the jobs ( setup, prejob, main, postjob, cleanup) do not have separate stdout etc, all are passed.

Specified by:
cbStdOut in interface Callback
Parameters:
jobs - all the jobs specified in the kickstart record.
data - the data contents as String.

cbStdERR

public void cbStdERR(List jobs,
                     String data)
Description copied from interface: Callback
Callback function for the data section of stderr. Since the jobs ( setup, prejob, main, postjob, cleanup) do not have separate stdout etc, all are passed.

Specified by:
cbStdERR in interface Callback
Parameters:
jobs - all the jobs specified in the kickstart record.
data - the data contents as String.

getCurrentNumOfJobs

private int getCurrentNumOfJobs(String site)
Returns the number of jobs that are executing for a particular site

Parameters:
site - the name of the site.
Returns:
number of jobs

cbInputFile

public void cbInputFile(String filename,
                        StatInfo info)
Callback function for when stat information for an input file is encountered. Empty for time being.

Specified by:
cbInputFile in interface Callback
Parameters:
filename - the name of the file.
info - the StatInfo about the file.

cbOutputFile

public void cbOutputFile(String filename,
                         StatInfo info)
Callback function for when stat information for an output file is encountered. The size of the file is computed and stored.

Specified by:
cbOutputFile in interface Callback
Parameters:
filename - the name of the file.
info - the StatInfo about the file.

cbInvocationEnd

public void cbInvocationEnd()
Callback signalling that an invocation record has been parsed. Stores the total compute size, somewhere in the space structure for the jobs.

Specified by:
cbInvocationEnd in interface Callback

getConstructedObject

public Object getConstructedObject()
Returns the SpaceUsage store built.

Specified by:
getConstructedObject in interface Callback
Returns:
SpaceUsage

done

public void done()
Callback signalling that we are done with the parsing of the files.

Specified by:
done in interface Callback

validState

protected boolean validState(String state)
Returns a boolean indicating whether the state is valid or not.

Parameters:
state - the state
Returns:
boolean

getEventType

private int getEventType(String state)
Returns the event type matching a particular job type

Parameters:
state - the state of the job
Returns:
the corresponding event type

cleanupJob

public boolean cleanupJob(String name)
Returns boolean indicating whether the job is a cleanup job or not. Does it on the basis of the name of the job.

Parameters:
name - the name of the job.
Returns:
boolean

cbMetadata

public void cbMetadata(Map metadata)
Callback for the metadata retrieved from the kickstart record.

Specified by:
cbMetadata in interface Callback
Parameters:
metadata -

cbMachine

public void cbMachine(Machine machine)
Callback to pass the machine information on which the job is executed.

Specified by:
cbMachine in interface Callback
Parameters:
machine -


Copyright © 2011 The University of Southern California. All Rights Reserved.