edu.isi.pegasus.planner.namespace

## Class Dagman

- java.lang.Object
- - edu.isi.pegasus.planner.namespace.Namespace
  - - edu.isi.pegasus.planner.namespace.Dagman

    public class Dagman
    extends Namespace

This profile namespace is the placeholder for the keys that go into the .dag file . Keys like RETRY that trigger retries in dagman in the event of a job failing would go in here. All the keys stored in it are in UPPERCASE irrespective of the case specified by the user in the various catalogs. To specify a post script or a pre script use POST and PRE keys.

Version:
  $Revision$
Author:
  Karan Vahi, Gaurang Mehta

### Nested Class Summary

### Nested classes/interfaces inherited from class edu.isi.pegasus.planner.namespace.Namespace

`Namespace.EmptyIterator`

### Field Summary

Fields
`static java.lang.String` `CATEGORY_KEY` The name of the key that determines the category to which the job belongs to.
`static java.lang.String` `DEFAULT_POST_SCRIPT_ARGUMENTS_KEY_VALUE` The default value for the arguments passed to postscript
`static java.lang.String` `DEFAULT_PRE_SCRIPT_ARGUMENTS_KEY_VALUE` The default value for the arguments passed to prescript
`static java.lang.String` `DEFAULT_RETRY_VALUE` The default value for the JOB Retries
`static java.lang.String` `DIRECTORY_EXTERNAL_KEY` The name of the key that indicates the directory in which the DAG has to be execute
`static java.lang.String` `JOB_KEY` The name of the key that indicates the path to the corresponding submit file for the job.
`static java.lang.String` `MAX_KEYS_PREFIX` The prefix for the max keys
`static java.lang.String` `MAXIDLE_KEY` The key name for max idle setting for dagman
`static java.lang.String` `MAXJOBS_KEY` The key name for max jobs setting for dagman
`static java.lang.String` `MAXPOST_KEY` The key name for max post setting for dagman
`static java.lang.String` `MAXPRE_KEY` The key name for max pre setting for dagman
`private java.lang.String` `mJobName` The name of the job (jobname) to which the profiles for this namespace belong.
`protected java.lang.String` `mNamespace` The name of the implementing namespace.
`static java.lang.String` `NAMESPACE_NAME` The name of the namespace that this class implements.
`static java.lang.String` `OUTPUT_KEY` The name of the key that determines the file on the submit host on which postscript is to be invoked.
`static java.lang.String` `POST_SCRIPT_ARGUMENTS_KEY` The name of the key that determines the arguments that need to be passed to the postscript.
`static java.lang.String` `POST_SCRIPT_KEY` The name of the key that determines what post script is to be invoked when the job completes.
`static java.lang.String` `POST_SCRIPT_PATH_PREFIX` The key prefix that determines the path to a postscript
`private static java.lang.String` `POST_SCRIPT_REPLACEMENT_KEY` The key name for the post script that is put in the .dag file.
`static java.lang.String` `POST_SCRIPT_SCOPE_KEY` The key prefix that determines the path to a postscript
`static java.lang.String` `PRE_SCRIPT_ARGUMENTS_KEY` The name of the key that determines the arguments that need to be passed to the postscript.
`static java.lang.String` `PRE_SCRIPT_KEY` The name of the key that determines what pre script is to be invoked when the job is run.
`private static java.lang.String` `PRE_SCRIPT_REPLACEMENT_KEY` The key name for the pre script that is put in the .dag file.
`static java.lang.String` `PRIORITY_KEY` The name of the key that determines the priority a job is assigned.
`static java.lang.String` `RETRY_KEY` The name of the key that determines how many times DAGMAN should be retrying the job.
`static java.lang.String` `SUBDAG_EXTERNAL_KEY` The name of the key that indicates the path to the external subdag

### Fields inherited from class edu.isi.pegasus.planner.namespace.Namespace

`DEPRECATED_KEY, EMPTY_KEY, MALFORMED_KEY, mLogger, mProfileMap, NOT_PERMITTED_KEY, UNKNOWN_KEY, VALID_KEY, VERSION`

### Constructor Summary

Constructors
Constructor and Description
`Dagman()` The default constructor.
`Dagman(java.util.Map mp)` The overloaded constructor.
`Dagman(java.util.Map mp, java.lang.String name)` The overloaded constructor.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected java.lang.StringBuffer` `append(java.lang.StringBuffer sb, java.lang.String key, java.lang.String name, java.lang.String value)`
`void` `assimilate(PegasusProperties properties, Profiles.NAMESPACES namespace)` Assimilate the profiles in the namespace in a controlled manner.
`static boolean` `categoryRelatedKey(java.lang.String key)` Determines whether a key is category related or not.
`int` `checkKey(java.lang.String key, java.lang.String value)` This checks whether the key passed by the user is valid in the current namespace or not.
`void` `checkKeyInNS(PegasusProperties properties, java.lang.String pool)` It puts in the namespace specific information specified in the properties file into the namespace.
`void` `checkKeyInNS(java.lang.String key, java.lang.String value)` This checks the whether a key value pair specified is valid in the current namespace or not by calling the checkKey function and then on the basis of the values returned puts them into the associated map in the class.
`java.lang.Object` `clone()` Returns a copy of the current namespace object.
`void` `construct(java.lang.String key, java.lang.String value)` Constructs a new element of the format (key=value).
`java.lang.String` `getPOSTScriptPath(java.lang.String type)` Returns the path to the postscript of a particular type
`private boolean` `ignore(java.lang.String key)` Helper method to decide whether a key has to be ignored or not.
`void` `merge(Namespace profiles)` Merge the profiles in the namespace in a controlled manner.
`java.lang.String` `namespaceName()` Returns the name of the namespace associated with the profile implementations.
`private java.lang.String` `replacementKey(java.lang.String key)` Returns the replacement key that needs to be printed in .dag file in lieu of the key.
`private java.lang.String` `replacementValue(java.lang.String key)` Returns the replacement value that needs to be printed in .dag file for a key.
`void` `setJobName(java.lang.String name)` It sets the name of the job that is associated with the profiles contained in this placeholder.
`java.lang.String` `toCondor()` Converts the contents of the map into the string that can be put in the Condor file for printing.
`java.lang.String` `toString(java.lang.String name)` Converts the contents of the map into the string that can be put in the Condor file for printing.

### Methods inherited from class edu.isi.pegasus.planner.namespace.Namespace

`checkKeyInNS, checkKeyInNS, checkKeyInNS, checkKeyInNS, containsKey, deprecatedKey, deprecatedTable, emptyKey, get, getProfileKeyIterator, isEmpty, isNamespaceValid, keySet, malformedKey, notPermitted, removeKey, toString, unknownKey`

### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### NAMESPACE_NAME

    public static final java.lang.String NAMESPACE_NAME

The name of the namespace that this class implements.

See Also:
  Constant Field Values

#### POST_SCRIPT_KEY

    public static final java.lang.String POST_SCRIPT_KEY

The name of the key that determines what post script is to be invoked when the job completes.

See Also:
  Constant Field Values

#### POST_SCRIPT_ARGUMENTS_KEY

    public static final java.lang.String POST_SCRIPT_ARGUMENTS_KEY

The name of the key that determines the arguments that need to be passed to the postscript.

See Also:
  Constant Field Values

#### POST_SCRIPT_PATH_PREFIX

    public static final java.lang.String POST_SCRIPT_PATH_PREFIX

The key prefix that determines the path to a postscript

See Also:
  Constant Field Values

#### POST_SCRIPT_SCOPE_KEY

    public static final java.lang.String POST_SCRIPT_SCOPE_KEY

The key prefix that determines the path to a postscript

See Also:
  Constant Field Values

#### DEFAULT_POST_SCRIPT_ARGUMENTS_KEY_VALUE

    public static final java.lang.String DEFAULT_POST_SCRIPT_ARGUMENTS_KEY_VALUE

The default value for the arguments passed to postscript

See Also:
  Constant Field Values

#### PRE_SCRIPT_KEY

    public static final java.lang.String PRE_SCRIPT_KEY

The name of the key that determines what pre script is to be invoked when the job is run.

See Also:
  Constant Field Values

#### PRE_SCRIPT_ARGUMENTS_KEY

    public static final java.lang.String PRE_SCRIPT_ARGUMENTS_KEY

The name of the key that determines the arguments that need to be passed to the postscript.

See Also:
  Constant Field Values

#### OUTPUT_KEY

    public static final java.lang.String OUTPUT_KEY

The name of the key that determines the file on the submit host on which postscript is to be invoked.

See Also:
  Constant Field Values

#### DEFAULT_PRE_SCRIPT_ARGUMENTS_KEY_VALUE

    public static final java.lang.String DEFAULT_PRE_SCRIPT_ARGUMENTS_KEY_VALUE

The default value for the arguments passed to prescript

See Also:
  Constant Field Values

#### RETRY_KEY

    public static final java.lang.String RETRY_KEY

The name of the key that determines how many times DAGMAN should be retrying the job.

See Also:
  Constant Field Values

#### DEFAULT_RETRY_VALUE

    public static final java.lang.String DEFAULT_RETRY_VALUE

The default value for the JOB Retries

See Also:
  Constant Field Values

#### CATEGORY_KEY

    public static final java.lang.String CATEGORY_KEY

The name of the key that determines the category to which the job belongs to.

See Also:
  Constant Field Values

#### PRIORITY_KEY

    public static final java.lang.String PRIORITY_KEY

The name of the key that determines the priority a job is assigned.

See Also:
  Constant Field Values

#### JOB_KEY

    public static final java.lang.String JOB_KEY

The name of the key that indicates the path to the corresponding submit file for the job.

See Also:
  Constant Field Values

#### SUBDAG_EXTERNAL_KEY

    public static final java.lang.String SUBDAG_EXTERNAL_KEY

The name of the key that indicates the path to the external subdag

See Also:
  Constant Field Values

#### DIRECTORY_EXTERNAL_KEY

    public static final java.lang.String DIRECTORY_EXTERNAL_KEY

The name of the key that indicates the directory in which the DAG has to be execute

See Also:
  Constant Field Values

#### POST_SCRIPT_REPLACEMENT_KEY

    private static final java.lang.String POST_SCRIPT_REPLACEMENT_KEY

The key name for the post script that is put in the .dag file.

See Also:
  Constant Field Values

#### PRE_SCRIPT_REPLACEMENT_KEY

    private static final java.lang.String PRE_SCRIPT_REPLACEMENT_KEY

The key name for the pre script that is put in the .dag file.

See Also:
  Constant Field Values

#### MAX_KEYS_PREFIX

    public static final java.lang.String MAX_KEYS_PREFIX

The prefix for the max keys

See Also:
  Constant Field Values

#### MAXPRE_KEY

    public static final java.lang.String MAXPRE_KEY

The key name for max pre setting for dagman

See Also:
  Constant Field Values

#### MAXPOST_KEY

    public static final java.lang.String MAXPOST_KEY

The key name for max post setting for dagman

See Also:
  Constant Field Values

#### MAXIDLE_KEY

    public static final java.lang.String MAXIDLE_KEY

The key name for max idle setting for dagman

See Also:
  Constant Field Values

#### MAXJOBS_KEY

    public static final java.lang.String MAXJOBS_KEY

The key name for max jobs setting for dagman

See Also:
  Constant Field Values

#### mJobName

    private java.lang.String mJobName

The name of the job (jobname) to which the profiles for this namespace belong.

See Also:
  `org.griphyn.cPlanner.classes.SubInfo#jobName`

#### mNamespace

    protected java.lang.String mNamespace

The name of the implementing namespace. It should be one of the valid namespaces always.

See Also:
  `Namespace.isNamespaceValid(String)`

### Constructor Detail

#### Dagman

    public Dagman()

The default constructor. We always initialize the map, as the map is guarenteed to store at least the postscript value for a job.

#### Dagman

    public Dagman(java.util.Map mp)

The overloaded constructor.

Parameters:
  `mp` - the initial map containing the profile keys for this namespace.

#### Dagman

    public Dagman(java.util.Map mp,
                  java.lang.String name)

The overloaded constructor.

Parameters:
  `mp` - the initial map containing the profile keys for this namespace.
  `name` - name of the job with which these profile keys are associated.

### Method Detail

#### categoryRelatedKey

    public static boolean categoryRelatedKey(java.lang.String key)

Determines whether a key is category related or not.

Parameters:
  `key` - the key in question
Returns:

#### namespaceName

    public java.lang.String namespaceName()

Returns the name of the namespace associated with the profile implementations.

Specified by:
  `namespaceName` in class `Namespace`
Returns:
  the namespace name.
See Also:
  `NAMESPACE_NAME`

#### setJobName

    public void setJobName(java.lang.String name)

It sets the name of the job that is associated with the profiles contained in this placeholder.

Parameters:
  `name` - name of the job with which these profile keys are associated.

#### construct

    public void construct(java.lang.String key,
                          java.lang.String value)

Constructs a new element of the format (key=value). The underlying map is allocated memory in the constructors always. All the keys are converted to UPPER CASE before storing.

Overrides:
  `construct` in class `Namespace`
Parameters:
  `key` - is the left-hand-side
  `value` - is the right hand side

#### checkKeyInNS

    public void checkKeyInNS(java.lang.String key,
                             java.lang.String value)

This checks the whether a key value pair specified is valid in the current namespace or not by calling the checkKey function and then on the basis of the values returned puts them into the associated map in the class.

Overrides:
  `checkKeyInNS` in class `Namespace`
Parameters:
  `key` - key that needs to be checked in the namespace for validity.
  `value` - value of the key

#### checkKey

    public int checkKey(java.lang.String key,
                        java.lang.String value)

This checks whether the key passed by the user is valid in the current namespace or not. All keys are assumed valid currently.

Specified by:
  `checkKey` in class `Namespace`
Parameters:
  `key` - (left hand side)
  `value` - (right hand side)
Returns:
  Namespace.VALID_KEY

#### getPOSTScriptPath

    public java.lang.String getPOSTScriptPath(java.lang.String type)

Returns the path to the postscript of a particular type

Parameters:
  `type` - type of postscript
Returns:
  the path

#### checkKeyInNS

    public void checkKeyInNS(PegasusProperties properties,
                             java.lang.String pool)

It puts in the namespace specific information specified in the properties file into the namespace. The profile information is populated only if the corresponding key does not exist in the object already.

Specified by:
  `checkKeyInNS` in class `Namespace`
Parameters:
  `properties` - the `PegasusProperties` object containing all the properties that the user specified at various places (like .chimerarc, properties file, command line).
  `pool` - the pool name where the job is scheduled to run.

#### assimilate

    public void assimilate(PegasusProperties properties,
                           Profiles.NAMESPACES namespace)

Assimilate the profiles in the namespace in a controlled manner. During assimilation all category related keys are ignored.

Overrides:
  `assimilate` in class `Namespace`
Parameters:
  `profiles` - the `Namespace` object containing the profiles.
  `namespace` - the namespace for which the profiles need to be assimilated.

#### merge

    public void merge(Namespace profiles)

Merge the profiles in the namespace in a controlled manner. In case of intersection, the new profile value overrides, the existing profile value.

Specified by:
  `merge` in class `Namespace`
Parameters:
  `profiles` - the `Namespace` object containing the profiles.

#### toCondor

    public java.lang.String toCondor()

Converts the contents of the map into the string that can be put in the Condor file for printing.

Specified by:
  `toCondor` in class `Namespace`
Returns:
  the the textual description.

#### toString

    public java.lang.String toString(java.lang.String name)

Converts the contents of the map into the string that can be put in the Condor file for printing.

Parameters:
  `name` - the name of the condor job that contains these variables.
Returns:
  the textual description.

#### append

    protected java.lang.StringBuffer append(java.lang.StringBuffer sb,
                                            java.lang.String key,
                                            java.lang.String name,
                                            java.lang.String value)

#### ignore

    private boolean ignore(java.lang.String key)

Helper method to decide whether a key has to be ignored or not.

Parameters:
  `key` - the key
Returns:
  boolean

#### replacementKey

    private java.lang.String replacementKey(java.lang.String key)

Returns the replacement key that needs to be printed in .dag file in lieu of the key.

Parameters:
  `key` - the key
Returns:
  the replacement key.

#### replacementValue

    private java.lang.String replacementValue(java.lang.String key)

Returns the replacement value that needs to be printed in .dag file for a key. This helps us tie the post script path to the arguments, and same for prescript.

Parameters:
  `key` - the key
Returns:
  the replacement value

#### clone

    public java.lang.Object clone()

Returns a copy of the current namespace object.

Overrides:
  `clone` in class `Namespace`
Returns:
  the Cloned object