public class GridStartFactory extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ALL_POST_SCRIPT_SCOPE
The postscript mode in which post scripts are added only for all
jobs.
|
static String |
DEFAULT_PACKAGE_NAME
The package name where the implementations of this interface reside
by default.
|
static String |
ESSENTIAL_POST_SCRIPT_SCOPE
The postscript mode in which post scripts are added only for essential
jobs.
|
static String[] |
GRIDSTART_IMPLEMENTING_CLASSES
The known gridstart implementations.
|
static String[] |
GRIDSTART_SHORT_NAMES
The corresponding short names for the implementations.
|
static int |
KICKSTART_INDEX
The index in the constant arrays for NoGridStart.
|
private PegasusBag |
mBag
The bag of objects used for initialization.
|
private ADag |
mDAG
The workflow object.
|
private Map |
mGridStartImplementationTable
A table that maps short names of
GridStart implementations
with the implementations themselves. |
private boolean |
mInitialized
A boolean indicating that the factory has been initialized.
|
private Map |
mPOSTScriptImplementationTable
A table that maps short names of
POSTScript implementations
with the implementations themselves. |
private PegasusProperties |
mProps
The properties object holding all the properties.
|
private String |
mSubmitDir
The submit directory where the submit files are being generated for
the workflow.
|
static int |
NO_GRIDSTART_INDEX
The index in the constant arrays for NoGridStart.
|
private static Map |
POSTSCRIPT_IMPLEMENTING_CLASS_TABLE
A table that associates POSTScript implementing classes with their
SHORT_NAMES.
|
static int |
SEQEXEC_INDEX
The index in constant arrays for SeqExec
|
Constructor and Description |
---|
GridStartFactory()
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
private static void |
associate(POSTScript ps)
Associates a shortname with the classname.
|
private static void |
associate(String shortName,
String className)
Associates a shortname with the classname.
|
private GridStart |
gridStart(String name)
Returns the cached implementation of GridStart from the implementing
class table.
|
private static String |
implementingPOSTScriptClass(String shortName)
Returns the name of the implementing POSTSCript class.
|
void |
initialize(PegasusBag bag,
ADag dag)
Initializes the factory with known GridStart implementations.
|
GridStart |
loadGridStart(Job job,
String gridStartPath)
Loads the appropriate gridstart implementation for a job on the basis of
the value of the GRIDSTART_KEY in the Pegasus namepsace.
|
private GridStart |
loadGridStart(PegasusBag bag,
ADag dag,
String className)
Loads the implementing class corresponding to the class.
|
POSTScript |
loadPOSTScript(Job job,
GridStart gridStart)
Loads the appropriate POST Script implementation for a job on the basis of
the value of the Pegasus profile GRIDSTART_KEY, and the DAGMan profile
POST_SCRIPT_KEY in the Pegasus namepsace.
|
private POSTScript |
loadPOSTScript(PegasusProperties properties,
String submitDir,
String path,
String className)
Loads the implementing class corresponding to the class.
|
private POSTScript |
postScript(String type)
Returns the cached implementation of
POSTScript
from the implementing class table. |
private void |
registerGridStart(String name,
GridStart implementation)
Inserts an entry into the implementing class table.
|
private void |
registerPOSTScript(String name,
POSTScript implementation)
Inserts an entry into the implementing class table.
|
public static final String DEFAULT_PACKAGE_NAME
public static String[] GRIDSTART_SHORT_NAMES
public static final int KICKSTART_INDEX
public static final int NO_GRIDSTART_INDEX
public static final int SEQEXEC_INDEX
public static final String ESSENTIAL_POST_SCRIPT_SCOPE
public static final String ALL_POST_SCRIPT_SCOPE
public static String[] GRIDSTART_IMPLEMENTING_CLASSES
private static Map POSTSCRIPT_IMPLEMENTING_CLASS_TABLE
private Map mPOSTScriptImplementationTable
POSTScript
implementations
with the implementations themselves.private Map mGridStartImplementationTable
GridStart
implementations
with the implementations themselves.private PegasusBag mBag
private PegasusProperties mProps
private String mSubmitDir
private ADag mDAG
private boolean mInitialized
private static void associate(POSTScript ps)
ps
- the POSTScript
implementation.private static void associate(String shortName, String className)
shortName
- the shortName for the POSTScript implementationclassName
- the fully qualified className of the implementing class.private static String implementingPOSTScriptClass(String shortName)
shortName
- the shortName for the POSTScript implementationpublic void initialize(PegasusBag bag, ADag dag)
bag
- the bag of objects that is used for initialization.dag
- the concrete dag so far.public GridStart loadGridStart(Job job, String gridStartPath) throws GridStartFactoryException
job
- the job for which we want the gridstart handle.gridStartPath
- the path to the gridstart from the site catalog.GridStartFactoryException
- that nests any error that
might occur during the instantiation of the implementation.org.griphyn.cPlanner.namespace.Pegasus#GRIDSTART_KEY
,
org.griphyn.cPlanner.common.PegasusProperties#getGridStart()
public POSTScript loadPOSTScript(Job job, GridStart gridStart) throws GridStartFactoryException
job
- the job for which we want the gridstart handle.gridStart
- the GridStart
for which we want to load
the POSTSCRIPT implementation.GridStartFactoryException
- that nests any error that
might occur during the instantiation of the implementation.org.griphyn.cPlanner.namespace.Pegasus#GRIDSTART_KEY
,
org.griphyn.cPlanner.namespace.Dagman#POST_SCRIPT_KEY
,
org.griphyn.cPlanner.common.PegasusProperties#getGridStart()
private GridStart loadGridStart(PegasusBag bag, ADag dag, String className) throws GridStartFactoryException
bag
- the bag of initialization objectsdag
- the concrete dag so far.className
- the name of the class that implements the mode. It is the
name of the class, not the complete name with package. That
is added by itself.GridStartFactoryException
- that nests any error that
might occur during the instantiation of the implementation.DEFAULT_PACKAGE_NAME
private POSTScript loadPOSTScript(PegasusProperties properties, String submitDir, String path, String className) throws GridStartFactoryException
properties
- the PegasusProperties
object containing all
the properties required by Pegasus.submitDir
- the submit directory where the submit file for the job
has to be generated.path
- the path to the postscript on the submit host.className
- the name of the class that implements the mode. It is the
name of the class, not the complete name with package. That
is added by itself.GridStartFactoryException
- that nests any error that
might occur during the instantiation of the implementation.DEFAULT_PACKAGE_NAME
private POSTScript postScript(String type)
POSTScript
from the implementing class table.type
- the short name for a POSTScript
implementationprivate void registerPOSTScript(String name, POSTScript implementation)
name
- the short name for a POSTScript
implementationimplementation
- the object of the class implementing that style.private GridStart gridStart(String name)
name
- the short name for a GridStart implementationprivate void registerGridStart(String name, GridStart implementation)
name
- the short name for a GridStart implementationimplementation
- the object of the class implementing that style.