edu.isi.pegasus.planner.provenance
Class NetloggerCallback

java.lang.Object
  extended by edu.isi.pegasus.planner.provenance.NetloggerCallback
All Implemented Interfaces:
Callback

public class NetloggerCallback
extends Object
implements Callback

Implements callback interface to calculate space usage.

Version:
1.0
Author:
not attributable

Field Summary
protected  int counter
          The counter to track the number of invocation records.
static String MACHINE_INFO_PREFIX
          The prefix for machine information keys
protected  List<Map<String,String>> mInvocationList
          List of Invocation maps.
protected  Map<String,String> mInvocationMap
          The Map of key value pairs that are to be logged via Netlogger.
protected  LogManager mLogger
          The handle to the logger.
protected  String mMainJob
          The main job whose record is being parsed.
protected  String mSite
          The logical site where the job was run.
 
Fields inherited from interface edu.isi.pegasus.planner.visualize.Callback
VERSION
 
Constructor Summary
NetloggerCallback()
          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.
 void done()
          Callback signalling that we are done with the parsing of the files.
 Object getConstructedObject()
          Returns a List of Map objects where each map captures information in one invocation record.
private  String getListValueFromMetadata(Map m, String key)
          Returns the first value from the List values for a key
 void initialize(String directory, boolean useStatInfo)
          Initializes the callback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MACHINE_INFO_PREFIX

public static final String MACHINE_INFO_PREFIX
The prefix for machine information keys

See Also:
Constant Field Values

mSite

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


mMainJob

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


mLogger

protected LogManager mLogger
The handle to the logger.


mInvocationMap

protected Map<String,String> mInvocationMap
The Map of key value pairs that are to be logged via Netlogger.


mInvocationList

protected List<Map<String,String>> mInvocationList
List of Invocation maps.


counter

protected int counter
The counter to track the number of invocation records.

Constructor Detail

NetloggerCallback

public NetloggerCallback()
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)
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.

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 a List of Map objects where each map captures information in one invocation record.

Specified by:
getConstructedObject in interface Callback
Returns:
List>

done

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

Specified by:
done in interface Callback

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. Iterates through the machine info objects and puts the keys and values in internal map.

Specified by:
cbMachine in interface Callback
Parameters:
machine -

getListValueFromMetadata

private String getListValueFromMetadata(Map m,
                                        String key)
Returns the first value from the List values for a key

Parameters:
m -
key -
Returns:
the first value.


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