org.apache.oozie.command.coord
Class CoordSubmitCommand

java.lang.Object
  extended by org.apache.oozie.command.Command<T,CoordinatorStore>
      extended by org.apache.oozie.command.coord.CoordinatorCommand<String>
          extended by org.apache.oozie.command.coord.CoordSubmitCommand
All Implemented Interfaces:
Callable<String>, XCallable<String>

public class CoordSubmitCommand
extends CoordinatorCommand<String>

This class provides the functionalities to resolve a coordinator job XML and write the job information into a DB table.

Specifically it performs the following functions: 1. Resolve all the variables or properties using job configurations. 2. Insert all datasets definition as part of the and tags. 3. Validate the XML at runtime.


Field Summary
static String CONF_DEFAULT_TIMEOUT_NORMAL
          Default timeout for normal jobs, in minutes, after which coordinator input check will timeout
static String CONFIG_DEFAULT
           
static String COORDINATOR_XML_FILE
           
 
Fields inherited from class org.apache.oozie.command.Command
instrumentation, LOCK_FAILURE_REQUEUE_INTERVAL
 
Constructor Summary
CoordSubmitCommand(boolean dryrun, org.apache.hadoop.conf.Configuration conf, String authToken)
           
CoordSubmitCommand(org.apache.hadoop.conf.Configuration conf, String authToken)
          Constructor to create the Coordinator Submit Command.
 
Method Summary
 org.jdom.Element basicResolveAndIncludeDS(String appXml, org.apache.hadoop.conf.Configuration conf, CoordinatorJobBean coordJob)
          The method resolve all the variables that are defined in configuration.
protected  String call(CoordinatorStore store)
          DagCallable subclasses must implement this method to perform their task.
protected  void includeDataSets(org.jdom.Element resolvedXml, org.apache.hadoop.conf.Configuration conf)
          Include referred Datasets into XML.
protected  void initEvaluators()
          Initialize all the required EL Evaluators.
static void main(String[] args)
          For unit-testing only.
protected  void mergeDefaultConfig()
          Merge default configuration with user-defined configuration.
protected  String readDefinition(String appPath)
          Read workflow definition.
protected  org.jdom.Element resolveInitial(org.apache.hadoop.conf.Configuration conf, String appXml, CoordinatorJobBean coordJob)
          Resolve basic entities using job Configuration.
 
Methods inherited from class org.apache.oozie.command.coord.CoordinatorCommand
getStoreClass
 
Methods inherited from class org.apache.oozie.command.Command
call, execute, getCreatedTime, getInstrumentation, getKey, getName, getPriority, getType, incrCommandCounter, incrJobCounter, incrJobCounter, lock, logQueueCallableFalse, queueCallable, queueCallable, queueCallable, queueCallableForException, resetLogInfoAction, resetLogInfoWorkflow, setLogInfo, setLogInfo, setLogInfo, setLogInfo, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONFIG_DEFAULT

public static final String CONFIG_DEFAULT
See Also:
Constant Field Values

COORDINATOR_XML_FILE

public static final String COORDINATOR_XML_FILE
See Also:
Constant Field Values

CONF_DEFAULT_TIMEOUT_NORMAL

public static final String CONF_DEFAULT_TIMEOUT_NORMAL
Default timeout for normal jobs, in minutes, after which coordinator input check will timeout

See Also:
Constant Field Values
Constructor Detail

CoordSubmitCommand

public CoordSubmitCommand(org.apache.hadoop.conf.Configuration conf,
                          String authToken)
Constructor to create the Coordinator Submit Command.

Parameters:
conf - : Configuration for Coordinator job
authToken - : To be used for authentication

CoordSubmitCommand

public CoordSubmitCommand(boolean dryrun,
                          org.apache.hadoop.conf.Configuration conf,
                          String authToken)
Method Detail

call

protected String call(CoordinatorStore store)
               throws StoreException,
                      CommandException
Description copied from class: Command
DagCallable subclasses must implement this method to perform their task.

The workflow store works in transactional mode. The transaction is committed only if this method ends successfully. Otherwise the transaction is rolledback.

Specified by:
call in class Command<String,CoordinatorStore>
Parameters:
store - the workflow store instance for the callable, null if the callable does not use a store.
Returns:
the return value of the callable.
Throws:
StoreException - thrown if the workflow store could not perform an operation.
CommandException - thrown if the command could not perform its operation.

mergeDefaultConfig

protected void mergeDefaultConfig()
                           throws CommandException
Merge default configuration with user-defined configuration.

Throws:
CommandException

basicResolveAndIncludeDS

public org.jdom.Element basicResolveAndIncludeDS(String appXml,
                                                 org.apache.hadoop.conf.Configuration conf,
                                                 CoordinatorJobBean coordJob)
                                          throws CoordinatorJobException,
                                                 Exception
The method resolve all the variables that are defined in configuration. It also include the data set definition from dataset file into XML.

Parameters:
appXml - : Original job XML
conf - : Configuration of the job
coordJob - : Coordinator job bean to be populated.
Returns:
: Resolved and modified job XML element.
Throws:
Exception
CoordinatorJobException

initEvaluators

protected void initEvaluators()
Initialize all the required EL Evaluators.


resolveInitial

protected org.jdom.Element resolveInitial(org.apache.hadoop.conf.Configuration conf,
                                          String appXml,
                                          CoordinatorJobBean coordJob)
                                   throws CoordinatorJobException,
                                          Exception
Resolve basic entities using job Configuration.

Parameters:
conf - :Job configuration
appXml - : Original job XML
coordJob - : Coordinator job bean to be populated.
Returns:
Resolved job XML element.
Throws:
Exception
CoordinatorJobException

includeDataSets

protected void includeDataSets(org.jdom.Element resolvedXml,
                               org.apache.hadoop.conf.Configuration conf)
                        throws CoordinatorJobException
Include referred Datasets into XML.

Parameters:
resolvedXml - : Job XML element.
conf - : Job configuration
Throws:
CoordinatorJobException

readDefinition

protected String readDefinition(String appPath)
                         throws CoordinatorJobException
Read workflow definition.

Parameters:
appPath - application path.
user - user name.
group - group name.
autToken - authentication token.
Returns:
workflow definition.
Throws:
WorkflowException - thrown if the definition could not be read.
CoordinatorJobException

main

public static void main(String[] args)
                 throws Exception
For unit-testing only. Will ultimately go away

Parameters:
args -
Throws:
Exception
org.jdom.JDOMException


Copyright © 2012 Apache Software Foundation. All Rights Reserved.