org.griphyn.cPlanner.simulator
Class DAX2Sim

java.lang.Object
  extended byorg.griphyn.cPlanner.simulator.DAX2Sim

public class DAX2Sim
extends Object

This is a simple helper class that parses the abstract workflow in DAX format and writes out another xml based workflow that is understood by the simulator developed by Jaskaran that is used to model the various planning techniques.

Version:
$Revision: 1.10 $
Author:
Karan Vahi, Jaskaran Singh

Field Summary
static double COMPUTE_MUL_FACTOR
           
static int DATA_MUL_FACTOR
           
 ADag mDag
          The object holding the abstract workflow that is referred to in the dax file supplied.
 String mOutputFile
          The name of the output file that is to be generated.
 FileWriter mWriteHandle
          The write handle to the output xml file.
 
Constructor Summary
DAX2Sim(ADag dag, String outputFile)
          The overloaded constructor.
 
Method Summary
private  void close()
          Closes the file descriptor.
 void convert2XML()
          This is the method the converts the ADag object to the xml output file.
 void generateNSInputFile(ADag dag, int numSites, String outputFile)
          This generates the ns simulator file, that is required for the prepopulation of the input files that are normally gotten through RLS.
 double getEstimatedExecTime(String logicalName)
          Returns the estimated execution time for a job.
 NameValue getInputFileSize(String logicalName)
          Returns the estimated input filesize for a job.
private  String getNSLine(String ipFile, int numSites)
          Gets the corresponding ns configuration line, that is required to set up that input file in the simulator.
 NameValue getOutputFileSize(String logicalName)
          Returns the estimated output filesize for a job.
private  int getSimUnits(String units)
           
 NameValue getSizeOfFileInMB(String file)
          Returns the filesize of a given in MB.
 String getXMLHeader()
          Returns the xml header for the output xml file.
private  void initializeWriteFileHandle(String outputFile)
          Initialisez the write file handle.
 boolean inputFileValid(String file)
          Whether the input file is valid for Montage domain or not.
static void main(String[] args)
          The main method of the client.
 String PCRelation2XML(PCRelation pcrel)
          Returns the xml description of the PCRelation object , in the form of an xml element that is used for the construction of the xml file that is read by the simulator.
 String PegasusFile2XML(PegasusFile pf, NameValue size, int type)
          Returns the xml description of the PegasusFile object , in the form of an xml element that is used for the construction of the xml file that is read by the simulator.
 String SubInfo2XML(SubInfo sub)
          Returns the xml description of the job that is understood by the simulator.
private  void writeString(String st)
          Writes a string to the associated write handle with the class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPUTE_MUL_FACTOR

public static double COMPUTE_MUL_FACTOR

DATA_MUL_FACTOR

public static int DATA_MUL_FACTOR

mDag

public ADag mDag
The object holding the abstract workflow that is referred to in the dax file supplied.


mOutputFile

public String mOutputFile
The name of the output file that is to be generated.


mWriteHandle

public FileWriter mWriteHandle
The write handle to the output xml file.

Constructor Detail

DAX2Sim

public DAX2Sim(ADag dag,
               String outputFile)
The overloaded constructor.

Parameters:
dag - the dag object containing the abstract workflow corresponding to the dax file.
outputFile - the name of the output file that is generated for the simulator.
Method Detail

initializeWriteFileHandle

private void initializeWriteFileHandle(String outputFile)
Initialisez the write file handle.

Parameters:
outputFile - the name of the file that has to be generated.

convert2XML

public void convert2XML()
This is the method the converts the ADag object to the xml output file.


SubInfo2XML

public String SubInfo2XML(SubInfo sub)
Returns the xml description of the job that is understood by the simulator.

Parameters:
sub - the SubInfo object containing the job description.
Returns:
String containing the xml element for the job.

PegasusFile2XML

public String PegasusFile2XML(PegasusFile pf,
                              NameValue size,
                              int type)
Returns the xml description of the PegasusFile object , in the form of an xml element that is used for the construction of the xml file that is read by the simulator.

Parameters:
pf - the PegasusFile object to be converted.
size - size of the file .
type - 0 -> an input file 1 -> output file
Returns:
the String containing the xml element.

PCRelation2XML

public String PCRelation2XML(PCRelation pcrel)
Returns the xml description of the PCRelation object , in the form of an xml element that is used for the construction of the xml file that is read by the simulator. It contains the parent child relationships of the workflow.

Parameters:
pcrel - the PCRelation object to be converted.
Returns:
the String containing the xml element.

writeString

private void writeString(String st)
Writes a string to the associated write handle with the class


close

private void close()
Closes the file descriptor.


getEstimatedExecTime

public double getEstimatedExecTime(String logicalName)
Returns the estimated execution time for a job. Ideally this should be got from a provenance catalog. In our case it is a simple mapping.

Parameters:
logicalName - the logical name of the job
Returns:
the estimated execution time in seconds

getInputFileSize

public NameValue getInputFileSize(String logicalName)
Returns the estimated input filesize for a job. Ideally this should be got from a transformation catalog. In our case it is a simple mapping.

Parameters:
logicalName - the logical name of the file
Returns:
NameValuepair where name refers to the value and key to units.

getOutputFileSize

public NameValue getOutputFileSize(String logicalName)
Returns the estimated output filesize for a job. Ideally this should be got from a transformation catalog. In our case it is a simple mapping.

Parameters:
logicalName - the logical name of file
Returns:
NameValuepair where name refers to the value and key to units.

getXMLHeader

public String getXMLHeader()
Returns the xml header for the output xml file.


generateNSInputFile

public void generateNSInputFile(ADag dag,
                                int numSites,
                                String outputFile)
This generates the ns simulator file, that is required for the prepopulation of the input files that are normally gotten through RLS. It determines the root nodes of the graph and allocates their input files randomly amongst the sites.

Parameters:
dag - the ADag object that contains the things.
numSites - the number of sites around which they need to be distributed.
outputFile - the name of the output file that has to be generated.

getNSLine

private String getNSLine(String ipFile,
                         int numSites)
Gets the corresponding ns configuration line, that is required to set up that input file in the simulator.

Parameters:
ipFile - the logical name of the input file.
numSites - the number of execute sites.
Returns:
String

getSimUnits

private int getSimUnits(String units)

inputFileValid

public boolean inputFileValid(String file)
Whether the input file is valid for Montage domain or not.

Parameters:
file - the logical name of the file.
Returns:
true the file is valid. false the file is invalid.

getSizeOfFileInMB

public NameValue getSizeOfFileInMB(String file)
Returns the filesize of a given in MB.

Parameters:
file - the logical name of the file.
Returns:
NameValuepair where name refers to the value and key to units.

main

public static void main(String[] args)
The main method of the client.

Parameters:
args - The arguments to the client. arg[0] the name of the dax file arg[1] the name of the output xml file used by the simulator


Copyright © 2003 The University of Chicago and The University of Southern California. All Rights Reserved.