public class CoordSubmitXCommand extends SubmitTransitionXCommand
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 <data-in> and <data-out> tags. 3. Validate the XML at runtime.
Modifier and Type | Field and Description |
---|---|
protected String |
bundleId |
protected org.apache.hadoop.conf.Configuration |
conf |
static String |
CONF_CHECK_MAX_FREQUENCY |
static String |
CONF_DEFAULT_CONCURRENCY |
static String |
CONF_DEFAULT_MAX_TIMEOUT
Default MAX timeout in minutes, after which coordinator input check will timeout
|
static String |
CONF_DEFAULT_THROTTLE |
static String |
CONF_DEFAULT_TIMEOUT_NORMAL
Default timeout for normal jobs, in minutes, after which coordinator input check will timeout
|
static String |
CONF_MAT_THROTTLING_FACTOR |
static String |
CONF_QUEUE_SIZE |
static String |
CONFIG_DEFAULT |
String |
COORD_INPUT_EVENTS |
String |
COORD_INPUT_EVENTS_DATA_IN |
String |
COORD_OUTPUT_EVENTS |
String |
COORD_OUTPUT_EVENTS_DATA_OUT |
static String |
COORDINATOR_XML_FILE |
protected CoordinatorJobBean |
coordJob |
protected String |
coordName |
protected boolean |
dryrun |
protected JPAService |
jpaService |
insertList, job, updateList
DEFAULT_LOCK_TIMEOUT, DEFAULT_REQUEUE_DELAY, eventService, instrumentation, INSTRUMENTATION_GROUP, LOG
Modifier | Constructor and Description |
---|---|
|
CoordSubmitXCommand(boolean dryrun,
org.apache.hadoop.conf.Configuration conf)
Constructor to create the Coordinator Submit Command.
|
|
CoordSubmitXCommand(org.apache.hadoop.conf.Configuration conf)
Constructor to create the Coordinator Submit Command.
|
protected |
CoordSubmitXCommand(org.apache.hadoop.conf.Configuration conf,
String bundleId,
String coordName)
Constructor to create the Coordinator Submit Command by bundle job.
|
Modifier and Type | Method and Description |
---|---|
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 |
getDryRun(CoordinatorJobBean coordJob)
Gets the dryrun output.
|
String |
getEntityKey()
Return the entity key for the command.
|
Job |
getJob()
Get the Job for the command.
|
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.
|
protected boolean |
isLockRequired()
Indicate if the the command requires locking.
|
protected void |
loadState()
Load the necessary state to perform the precondition check and to execute the command.
|
protected void |
mergeDefaultConfig()
Merge default configuration with user-defined configuration.
|
void |
notifyParent()
This will be used to notify the parent about the status of that perticular job.
|
void |
performWrites()
This will be used to perform atomically all the writes within this command.
|
protected void |
queueMaterializeTransitionXCommand(String jobId)
Queue MaterializeTransitionXCommand
|
protected String |
readAndValidateXml()
Read the application XML and validate against coordinator Schema
|
protected String |
readDefinition(String appPath)
Read coordinator definition.
|
protected org.jdom.Element |
resolveInitial(org.apache.hadoop.conf.Configuration conf,
String appXml,
CoordinatorJobBean coordJob)
Resolve basic entities using job Configuration.
|
protected String |
storeToDB(String appXML,
org.jdom.Element eJob,
CoordinatorJobBean coordJob)
Write a coordinator job into database
|
protected String |
submit()
Submit the job
|
protected String |
submitJob() |
void |
updateJob()
Update the parent job.
|
protected void |
verifyPrecondition()
Verify the precondition for the command after a lock has been obtain, just before executing the command.
|
execute, transitToNext
generateEvents, setJob
call, eagerLoadState, eagerVerifyPrecondition, executeInterrupts, getCreatedTime, getInstrumentation, getKey, getLockTimeOut, getLog, getName, getPriority, getRequeueDelay, getType, inInterruptMode, isReQueueRequired, queue, queue, resetUsed, setInterruptMode, setLogInfo, toString
protected org.apache.hadoop.conf.Configuration conf
protected boolean dryrun
protected JPAService jpaService
public static final String CONFIG_DEFAULT
public static final String COORDINATOR_XML_FILE
public final String COORD_INPUT_EVENTS
public final String COORD_OUTPUT_EVENTS
public final String COORD_INPUT_EVENTS_DATA_IN
public final String COORD_OUTPUT_EVENTS_DATA_OUT
protected CoordinatorJobBean coordJob
public static final String CONF_DEFAULT_TIMEOUT_NORMAL
public static final String CONF_DEFAULT_CONCURRENCY
public static final String CONF_DEFAULT_THROTTLE
public static final String CONF_MAT_THROTTLING_FACTOR
public static final String CONF_DEFAULT_MAX_TIMEOUT
public static final String CONF_QUEUE_SIZE
public static final String CONF_CHECK_MAX_FREQUENCY
public CoordSubmitXCommand(org.apache.hadoop.conf.Configuration conf)
conf
- : Configuration for Coordinator jobprotected CoordSubmitXCommand(org.apache.hadoop.conf.Configuration conf, String bundleId, String coordName)
conf
- : Configuration for Coordinator jobbundleId
- : bundle idcoordName
- : coord namepublic CoordSubmitXCommand(boolean dryrun, org.apache.hadoop.conf.Configuration conf)
dryrun
- : if dryrunconf
- : Configuration for Coordinator jobprotected String submit() throws CommandException
SubmitTransitionXCommand
submit
in class SubmitTransitionXCommand
CommandException
- thrown if unable to submitprotected String submitJob() throws CommandException
CommandException
protected String getDryRun(CoordinatorJobBean coordJob) throws Exception
coordJob
- the coordinatorJobBeanException
- the exceptionprotected void queueMaterializeTransitionXCommand(String jobId)
protected String readAndValidateXml() throws CoordinatorJobException
CoordinatorJobException
- thrown if unable to read or validate coordinator xmlprotected void mergeDefaultConfig() throws CommandException
CommandException
- thrown if failed to read or merge configurationspublic org.jdom.Element basicResolveAndIncludeDS(String appXml, org.apache.hadoop.conf.Configuration conf, CoordinatorJobBean coordJob) throws CoordinatorJobException, Exception
appXml
- : Original job XMLconf
- : Configuration of the jobcoordJob
- : Coordinator job bean to be populated.CoordinatorJobException
- thrown if failed to resolve basic entities or include referred datasetsException
- thrown if failed to resolve basic entities or include referred datasetsprotected void initEvaluators()
protected org.jdom.Element resolveInitial(org.apache.hadoop.conf.Configuration conf, String appXml, CoordinatorJobBean coordJob) throws CoordinatorJobException, Exception
conf
- :Job configurationappXml
- : Original job XMLcoordJob
- : Coordinator job bean to be populated.CoordinatorJobException
- thrown if failed to resolve basic entitiesException
- thrown if failed to resolve basic entitiesprotected void includeDataSets(org.jdom.Element resolvedXml, org.apache.hadoop.conf.Configuration conf) throws CoordinatorJobException
resolvedXml
- : Job XML element.conf
- : Job configurationCoordinatorJobException
- thrown if failed to include referred datasets into XMLprotected String readDefinition(String appPath) throws CoordinatorJobException
appPath
- application path.CoordinatorJobException
- thrown if the definition could not be read.protected String storeToDB(String appXML, org.jdom.Element eJob, CoordinatorJobBean coordJob) throws CommandException
appXML
- : Coordinator definition xmleJob
- : XML element of jobcoordJob
- : Coordinator job beanCommandException
- thrown if unable to save coordinator job to dbpublic String getEntityKey()
XCommand
getEntityKey
in interface XCallable<String>
getEntityKey
in class XCommand<String>
protected boolean isLockRequired()
XCommand
Subclasses should override this method if they require locking.
isLockRequired
in class XCommand<String>
true/false
protected void loadState() throws CommandException
XCommand
Subclasses must implement this method and load the state needed to do the precondition check and execute the command.
loadState
in class XCommand<String>
CommandException
protected void verifyPrecondition() throws CommandException
XCommand
verifyPrecondition
in class XCommand<String>
CommandException
- thrown if the precondition is not met.public void notifyParent() throws CommandException
TransitionXCommand
notifyParent
in class TransitionXCommand<String>
CommandException
public void updateJob() throws CommandException
TransitionXCommand
updateJob
in class TransitionXCommand<String>
CommandException
public Job getJob()
TransitionXCommand
getJob
in class TransitionXCommand<String>
public void performWrites() throws CommandException
TransitionXCommand
performWrites
in class TransitionXCommand<String>
CommandException
Copyright © 2016 Apache Software Foundation. All rights reserved.