Class Abstract
- java.lang.Object
-
- edu.isi.pegasus.planner.code.generator.Abstract
-
- All Implemented Interfaces:
CodeGenerator
- Direct Known Subclasses:
CondorGenerator,PBS,PMC,Shell,Stork
public abstract class Abstract extends java.lang.Object implements CodeGenerator
An Abstract Base class implementing the CodeGenerator interface. Introduces helper methods for determining basenames of files, that contain concrete job descriptions.- Version:
- $Revision$
- Author:
- Karan Vahi, Gaurang Mehta
-
-
Field Summary
Fields Modifier and Type Field Description protected PegasusBagmBagThe bag of initialization objects.protected LogManagermLoggerThe LogManager object which is used to log all the messages.protected PlannerOptionsmPOptionsThe object containing the command line options specified to the planner at runtime.protected PegasusPropertiesmPropsThe object holding all the properties pertaining to Pegasus.protected java.lang.StringmSubmitFileDirThe directory where all the submit files are to be generated.-
Fields inherited from interface edu.isi.pegasus.planner.code.CodeGenerator
VERSION
-
-
Constructor Summary
Constructors Constructor Description Abstract()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.util.Map<java.lang.String,java.lang.String>getAdditionalBraindumpEntries(ADag workflow)Returns a Map containing additional metrics entries that are specific to a Code Generatorprotected java.lang.StringgetDAGFilename(ADag dag, java.lang.String suffix)Returns the name of the file on the basis of the metadata associated with the DAG.static java.lang.StringgetDAGFilename(PlannerOptions options, java.lang.String name, java.lang.String index, java.lang.String suffix)Returns the name of the file on the basis of the metadata associated with the DAG.java.lang.StringgetFileBaseName(Job job)Returns the basename of the file to which the job is written to.java.io.PrintWritergetWriter(Job job)Returns an open stream to the file that is used for writing out the job information for the job.voidinitialize(PegasusBag bag)Initializes the Code Generator implementation.voidreset()Resets the Code Generator implementation.booleanstartMonitoring()Starts monitoring of the workflow by invoking a workflow monitor daemon.protected voidwriteOutBraindump(ADag workflow)Writes out the metrics file for the workflowprotected voidwriteOutDAXReplicaStore(ADag workflow)Writes out the DAX replica storeprotected voidwriteOutNotifications(ADag workflow)Writes out the generator input file for the work-flow.protected voidwriteOutStampedeEvents(ADag workflow)Writes out the stampedeEventGenerator events for the workflow.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.isi.pegasus.planner.code.CodeGenerator
generateCode, generateCode
-
-
-
-
Field Detail
-
mBag
protected PegasusBag mBag
The bag of initialization objects.
-
mSubmitFileDir
protected java.lang.String mSubmitFileDir
The directory where all the submit files are to be generated.
-
mProps
protected PegasusProperties mProps
The object holding all the properties pertaining to Pegasus.
-
mPOptions
protected PlannerOptions mPOptions
The object containing the command line options specified to the planner at runtime.
-
mLogger
protected LogManager mLogger
The LogManager object which is used to log all the messages.
-
-
Method Detail
-
getDAGFilename
protected java.lang.String getDAGFilename(ADag dag, java.lang.String suffix)
Returns the name of the file on the basis of the metadata associated with the DAG. In case of Condor dagman, it is the name of the .dag file that is written out. The basename of the .dag file is dependant on whether the basename prefix has been specified at runtime or not by command line options.- Parameters:
dag- the dag for which the .dag file has to be created.suffix- the suffix to be applied at the end.- Returns:
- the name of the dagfile.
-
getDAGFilename
public static java.lang.String getDAGFilename(PlannerOptions options, java.lang.String name, java.lang.String index, java.lang.String suffix)
Returns the name of the file on the basis of the metadata associated with the DAG. In case of Condor dagman, it is the name of the .dag file that is written out. The basename of the .dag file is dependant on whether the basename prefix has been specified at runtime or not by command line options.- Parameters:
options- the options passed to the planner.name- the name attribute in daxindex- the index attribute in dax.suffix- the suffix to be applied at the end.- Returns:
- the name of the dagfile.
-
initialize
public void initialize(PegasusBag bag) throws CodeGeneratorException
Initializes the Code Generator implementation.- Specified by:
initializein interfaceCodeGenerator- Parameters:
bag- the bag of initialization objects.- Throws:
CodeGeneratorException- in case of any error occuring code generation.
-
startMonitoring
public boolean startMonitoring()
Starts monitoring of the workflow by invoking a workflow monitor daemon. The monitoring should start only after the output files have been generated. FIXME: It should actually happen after the workflow has been submitted. Eventually should be a separate monitor interface, and submit writers should be loaded by an AbstractFactory.- Specified by:
startMonitoringin interfaceCodeGenerator- Returns:
- boolean indicating whether could successfully start the monitor daemon or not.
-
writeOutStampedeEvents
protected void writeOutStampedeEvents(ADag workflow) throws CodeGeneratorException
Writes out the stampedeEventGenerator events for the workflow.- Parameters:
workflow- the workflow whose metrics file needs to be generated.- Throws:
CodeGeneratorException
-
writeOutBraindump
protected void writeOutBraindump(ADag workflow)
Writes out the metrics file for the workflow- Parameters:
workflow- the workflow whose metrics file needs to be generated.
-
writeOutDAXReplicaStore
protected void writeOutDAXReplicaStore(ADag workflow)
Writes out the DAX replica store- Parameters:
workflow- the work-flow
-
writeOutNotifications
protected void writeOutNotifications(ADag workflow)
Writes out the generator input file for the work-flow.- Parameters:
workflow- the work-flow whose generator files needs to be generated.
-
getAdditionalBraindumpEntries
public abstract java.util.Map<java.lang.String,java.lang.String> getAdditionalBraindumpEntries(ADag workflow)
Returns a Map containing additional metrics entries that are specific to a Code Generator- Parameters:
workflow- the workflow whose metrics file needs to be generated.- Returns:
- Map
-
reset
public void reset() throws CodeGeneratorExceptionResets the Code Generator implementation.- Specified by:
resetin interfaceCodeGenerator- Throws:
CodeGeneratorException- in case of any error occuring code generation.
-
getWriter
public java.io.PrintWriter getWriter(Job job) throws java.io.IOException
Returns an open stream to the file that is used for writing out the job information for the job.- Parameters:
job- the job whose job information needs to be written.- Returns:
- the writer to the open file.
- Throws:
java.io.IOException- if unable to open a write handle to the file.
-
getFileBaseName
public java.lang.String getFileBaseName(Job job)
Returns the basename of the file to which the job is written to.- Parameters:
job- the job whose job information needs to be written.- Returns:
- the basename of the file.
-
-