public abstract class ProcessHadoopScriptHandler extends ExecutionScriptHandlerBase implements HadoopScriptHandler
HadoopScriptHandler
.
This handler just launches a command with following arguments in its tail.
Additionally, the handler lanuches a command if hadoop.cleanup
is true.
CLEANUP_STAGE_CLASS
batch-id
flow-id
execution-id
batch-arguments
# <position> = 0, 1, 2, ...
# <prefix command token> can contain "@[position],"
# this will be replaced as original command tokens (0-origin position)
hadoop = <this class name>
hadoop.env.ASAKUSA_HOME = ${ASAKUSA_HOME}
hadoop.command.<position> = $<prefix command token>
hadoop.cleanup = whether enables cleanup
hadoop.env.<key> = $<extra environment variables>
hadoop.prop.<key> = $<extra Hadoop properties>
Modifier and Type | Field and Description |
---|---|
static String |
CLEANUP_STAGE_CLASS
The class name of cleanup stage client.
|
static String |
KEY_CLEANUP
(sub) key name of cleanup enabled.
|
static String |
KEY_WORKING_DIRECTORY
Deprecated.
cleanup is obsoleted
|
static String |
PATH_EXECUTE
The path to the Hadoop execution executable file (relative path from Asakusa home).
|
static String |
VAR_BATCH_ID
Variable name of batch ID.
|
static String |
VAR_EXECUTION_ID
Variable name of execution ID.
|
static String |
VAR_FLOW_ID
Variable name of flow ID.
|
DEFAULT_RESOURCE_ID, ENV_EXTENSION_PREFIX, KEY_ENV_PREFIX, KEY_PROP_PREFIX, KEY_RESOURCE
Constructor and Description |
---|
ProcessHadoopScriptHandler() |
Modifier and Type | Method and Description |
---|---|
void |
cleanUp(ExecutionMonitor monitor,
ExecutionContext context)
Cleanup the target environment.
|
protected abstract void |
configureExtension(ServiceProfile<?> profile)
Configures this handler internally (extension point).
|
protected void |
doConfigure(ServiceProfile<?> profile,
Map<String,String> desiredProperties,
Map<String,String> desiredEnvironmentVariables)
Configures this handler internally (extention point).
|
void |
execute(ExecutionMonitor monitor,
ExecutionContext context,
HadoopScript script)
Executes the specified script.
|
protected abstract ProcessExecutor |
getCommandExecutor()
Returns command executor for this handler (extension point).
|
protected String |
getPathSegmentSeparator()
Returns the path segment separator.
|
configure, getEnvironmentVariables, getHandlerId, getProperties, getResourceId, setUp, voidCleanUp, voidSetUp
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEnvironmentVariables, getHandlerId, getProperties, getResourceId, setUp
public static final String CLEANUP_STAGE_CLASS
@Deprecated public static final String KEY_WORKING_DIRECTORY
public static final String KEY_CLEANUP
public static final String PATH_EXECUTE
public static final String VAR_BATCH_ID
public static final String VAR_FLOW_ID
public static final String VAR_EXECUTION_ID
protected final void doConfigure(ServiceProfile<?> profile, Map<String,String> desiredProperties, Map<String,String> desiredEnvironmentVariables) throws InterruptedException, IOException
ExecutionScriptHandlerBase
doConfigure
in class ExecutionScriptHandlerBase
profile
- the profile of this servicedesiredProperties
- the current desired system/hadoop properties (configurable)desiredEnvironmentVariables
- the current desired environment variables (configurable)InterruptedException
- if interrupted in configurationIOException
- if failed to configure this serviceprotected abstract void configureExtension(ServiceProfile<?> profile) throws InterruptedException, IOException
profile
- the profile of this serviceInterruptedException
- if interrupted in configurationIOException
- if failed to configure this serviceprotected abstract ProcessExecutor getCommandExecutor()
public final void execute(ExecutionMonitor monitor, ExecutionContext context, HadoopScript script) throws InterruptedException, IOException
ExecutionScriptHandler
execute
in interface ExecutionScriptHandler<HadoopScript>
monitor
- the progress monitor of the executioncontext
- current execution contextscript
- target scriptInterruptedException
- if the execution was interruptedIOException
- if execution was failedpublic void cleanUp(ExecutionMonitor monitor, ExecutionContext context) throws InterruptedException, IOException
ExecutionScriptHandlerBase
cleanUp
in interface ExecutionScriptHandler<HadoopScript>
cleanUp
in class ExecutionScriptHandlerBase
monitor
- the progress monitor of the operationcontext
- the current execution contextInterruptedException
- if this operation is interruptedIOException
- if failed to setup the target environmentprotected String getPathSegmentSeparator()
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.