edu.isi.pegasus.planner.code.generator

## Class Braindump

- java.lang.Object
- - edu.isi.pegasus.planner.code.generator.Braindump

    public class Braindump
    extends java.lang.Object

Braindump file code generator that generates a Braindump file for the executable workflow in the submit directory. The following keys are generated in the braindump file.

     wf_uuid
     submit_hostname
     planner_arguments
     user
     grid_dn
     dax_label
     timestamp
     submit_dir
     planner_version
     type
     properties

Additionally, the following duplicate keys exist till pegasus-run is modified.

     old keyname -> new keyname
     =============================
     label --> dax_label
     pegasus_wf_time --> timestamp
     run --> submit_dir
     pegasus_version --> planner_version

Version:
  $Revision$
Author:
  Karan Vahi

### Field Summary

Fields
`static java.lang.String` `BRAINDUMP_FILE` The basename of the braindump file.
`static java.lang.String` `BUILD_KEY` The Key for the pegasus build.
`static java.lang.String` `DAX_INDEX_KEY` The dax index
`static java.lang.String` `DAX_LABEL_KEY` The DAX label.
`static java.lang.String` `DAX_VERRSION_KEY` The DAX version.
`static java.lang.String` `GENERATOR_TYPE_KEY` The Key designating type of Pegasus Code Generator.
`static java.lang.String` `GRID_DN_KEY` The Grid DN of the user.
`protected PegasusBag` `mBag` The bag of initialization objects.
`protected LogManager` `mLogger` The handle to the logging object.
`protected PlannerOptions` `mPOptions` The object containing the command line options specified to the planner at runtime.
`protected PegasusProperties` `mProps` The object holding all the properties pertaining to Pegasus.
`protected java.lang.String` `mSubmitFileDir` The directory where all the submit files are to be generated.
`static java.lang.String` `PLANNER_ARGUMENTS_KEY` The arguments passed to the planner.
`static java.lang.String` `PLANNER_VERSION_KEY` The Key for the planner version
`static java.lang.String` `PROPERTIES_KEY` The path to the pegasus properties file
`static java.lang.String` `ROOT_UUID_KEY` The key for UUID of the workflow.
`static java.lang.String` `SUBMIT_DIR_KEY` The submit directory for the workflow.
`static java.lang.String` `SUBMIT_HOSTNAME_KEY` The key for the submit hostname.
`static java.lang.String` `TIMESTAMP_KEY` The workflow timestamp.
`static java.lang.String` `USER_KEY` The user who submitted the workflow.
`static java.lang.String` `UUID_KEY` The key for UUID of the workflow.
`static java.lang.String` `VERSION_KEY` The Key for the version id.
`static java.lang.String` `WF_NAME_KEY` The Key for the flow id.
`static java.lang.String` `WF_TIME_KEY` The Key for the timestamp.
`static java.lang.String` `WF_TIMESTAMP_KEY` The Key for the timestamp.

### Constructor Summary

Constructors
Constructor and Description
`Braindump()`

### Method Summary

All Methods Instance Methods Concrete Methods
`java.util.Map<java.lang.String,java.lang.String>` `defaultBrainDumpEntries(ADag workflow)` Returns default braindump entries.
`java.util.Collection<java.io.File>` `generateCode(ADag dag)` Generates the code for the executable workflow in terms of a braindump file that contains workflow metadata useful for monitoring daemons etc.
`void` `generateCode(ADag dag, Job job)` Method not implemented.
`java.util.Collection<java.io.File>` `generateCode(ADag dag, java.util.Map<java.lang.String,java.lang.String> additionalEntries)` Generates the code for the executable workflow in terms of a braindump file that contains workflow metadata useful for monitoring daemons etc.
`protected java.lang.String` `getGridDN()` Returns the distinguished name from the proxy
`protected java.lang.String` `getSubmitHostname()` Returns the submit hostname
`void` `initialize(PegasusBag bag)` Initializes the Code Generator implementation.
`protected java.io.File` `writeOutBraindumpFile(java.util.Map<java.lang.String,java.lang.String> entries)` Writes out the braindump.txt file for a workflow in the submit directory.

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

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

### Field Detail

#### BRAINDUMP_FILE

    public static final java.lang.String BRAINDUMP_FILE

The basename of the braindump file.

See Also:
  Constant Field Values

#### GENERATOR_TYPE_KEY

    public static final java.lang.String GENERATOR_TYPE_KEY

The Key designating type of Pegasus Code Generator.

See Also:
  Constant Field Values

#### USER_KEY

    public static final java.lang.String USER_KEY

The user who submitted the workflow.

See Also:
  Constant Field Values

#### GRID_DN_KEY

    public static final java.lang.String GRID_DN_KEY

The Grid DN of the user.

See Also:
  Constant Field Values

#### PROPERTIES_KEY

    public static final java.lang.String PROPERTIES_KEY

The path to the pegasus properties file

See Also:
  Constant Field Values

#### SUBMIT_HOSTNAME_KEY

    public static final java.lang.String SUBMIT_HOSTNAME_KEY

The key for the submit hostname.

See Also:
  Constant Field Values

#### PLANNER_ARGUMENTS_KEY

    public static final java.lang.String PLANNER_ARGUMENTS_KEY

The arguments passed to the planner.

See Also:
  Constant Field Values

#### ROOT_UUID_KEY

    public static final java.lang.String ROOT_UUID_KEY

The key for UUID of the workflow.

See Also:
  Constant Field Values

#### UUID_KEY

    public static final java.lang.String UUID_KEY

The key for UUID of the workflow.

See Also:
  Constant Field Values

#### DAX_LABEL_KEY

    public static final java.lang.String DAX_LABEL_KEY

The DAX label.

See Also:
  Constant Field Values

#### DAX_INDEX_KEY

    public static final java.lang.String DAX_INDEX_KEY

The dax index

See Also:
  Constant Field Values

#### DAX_VERRSION_KEY

    public static final java.lang.String DAX_VERRSION_KEY

The DAX version.

See Also:
  Constant Field Values

#### TIMESTAMP_KEY

    public static final java.lang.String TIMESTAMP_KEY

The workflow timestamp.

See Also:
  Constant Field Values

#### SUBMIT_DIR_KEY

    public static final java.lang.String SUBMIT_DIR_KEY

The submit directory for the workflow.

See Also:
  Constant Field Values

#### VERSION_KEY

    public static final java.lang.String VERSION_KEY

The Key for the version id.

See Also:
  `org.griphyn.cPlanner.classes.DagInfo#releaseVersion`, Constant Field Values

#### PLANNER_VERSION_KEY

    public static final java.lang.String PLANNER_VERSION_KEY

The Key for the planner version

See Also:
  Constant Field Values

#### BUILD_KEY

    public static final java.lang.String BUILD_KEY

The Key for the pegasus build.

See Also:
  Constant Field Values

#### WF_NAME_KEY

    public static final java.lang.String WF_NAME_KEY

The Key for the flow id.

See Also:
  `org.griphyn.cPlanner.classes.DagInfo#flowIDName`, Constant Field Values

#### WF_TIME_KEY

    public static final java.lang.String WF_TIME_KEY

The Key for the timestamp.

See Also:
  `org.griphyn.cPlanner.classes.DagInfo#mFlowTimestamp`, Constant Field Values

#### WF_TIMESTAMP_KEY

    public static final java.lang.String WF_TIMESTAMP_KEY

The Key for the timestamp.

See Also:
  `org.griphyn.cPlanner.classes.DagInfo#mFlowTimestamp`, Constant Field Values

#### 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 handle to the logging object.

### Constructor Detail

#### Braindump

    public Braindump()

### Method Detail

#### initialize

    public void initialize(PegasusBag bag)
                    throws CodeGeneratorException

Initializes the Code Generator implementation.

Parameters:
  `bag` - the bag of initialization objects.
Throws:
  `CodeGeneratorException` - in case of any error occuring code generation.

#### defaultBrainDumpEntries

    public java.util.Map<java.lang.String,java.lang.String> defaultBrainDumpEntries(ADag workflow)
                                                                             throws CodeGeneratorException

Returns default braindump entries.

Returns:
  default entries
Throws:
  `CodeGeneratorException`

#### generateCode

    public java.util.Collection<java.io.File> generateCode(ADag dag)
                                                    throws CodeGeneratorException

Generates the code for the executable workflow in terms of a braindump file that contains workflow metadata useful for monitoring daemons etc.

Parameters:
  `dag` - the concrete workflow.
Returns:
  the Collection of `File` objects for the files written out.
Throws:
  `CodeGeneratorException` - in case of any error occuring code generation.

#### generateCode

    public java.util.Collection<java.io.File> generateCode(ADag dag,
                                                           java.util.Map<java.lang.String,java.lang.String> additionalEntries)
                                                    throws CodeGeneratorException

Generates the code for the executable workflow in terms of a braindump file that contains workflow metadata useful for monitoring daemons etc.

Parameters:
  `dag` - the concrete workflow.
  `additionalEntries` - additional entries to go in the braindump file, overwriting the default entries.
Returns:
  the Collection of `File` objects for the files written out.
Throws:
  `CodeGeneratorException` - in case of any error occuring code generation.

#### generateCode

    public void generateCode(ADag dag,
                             Job job)
                      throws CodeGeneratorException

Method not implemented. Throws an exception.

Parameters:
  `dag` - the workflow
  `job` - the job for which the code is to be generated.
Throws:
  `CodeGeneratorException`

#### writeOutBraindumpFile

    protected java.io.File writeOutBraindumpFile(java.util.Map<java.lang.String,java.lang.String> entries)
                                          throws java.io.IOException

Writes out the braindump.txt file for a workflow in the submit directory. The braindump.txt file is used for passing to the tailstatd daemon that monitors the state of execution of the workflow.

Parameters:
  `entries` - the Map containing the entries going into the braindump file.
Returns:
  the absolute path to the braindump file.txt written in the directory.
Throws:
  `java.io.IOException` - in case of error while writing out file.

#### getSubmitHostname

    protected java.lang.String getSubmitHostname()
                                          throws CodeGeneratorException

Returns the submit hostname

Returns:
  hostname
Throws:
  `CodeGeneratorException`

#### getGridDN

    protected java.lang.String getGridDN()

Returns the distinguished name from the proxy

Returns:
  the DN else null if proxy file not found.