Spring for Apache Hadoop

org.springframework.yarn.client
Class CommandLineClientRunner

java.lang.Object
  extended by org.springframework.yarn.launch.AbstractCommandLineRunner<YarnClient>
      extended by org.springframework.yarn.client.CommandLineClientRunner

public class CommandLineClientRunner
extends AbstractCommandLineRunner<YarnClient>

A simple client runner executing a bean named "yarnClient".

Author:
Janne Valkealahti

Field Summary
static java.lang.String ARG_APPLICATION_ID
           
static java.lang.String OPT_KILL
           
static java.lang.String OPT_LIST
           
static java.lang.String OPT_SUBMIT
           
 
Constructor Summary
CommandLineClientRunner()
           
 
Method Summary
protected  java.lang.String getDefaultBeanIdentifier()
          Gets a default bean id which is used to resolve the instance from an Application Context.
protected  java.util.List<java.lang.String> getValidOpts()
          Gets the list of valid option arguments.
protected  ExitStatus handleBeanRun(YarnClient bean, java.lang.String[] parameters, java.util.Set<java.lang.String> opts)
          Handles the execution of a bean after Application Context(s) has been initialized.
static void main(java.lang.String[] args)
           
protected  org.apache.hadoop.yarn.api.records.ApplicationId queryApplicationId(YarnClient client, java.lang.String applicationId)
          Query application id.
 
Methods inherited from class org.springframework.yarn.launch.AbstractCommandLineRunner
doMain, exit, getApplicationContext, getChildApplicationContext, getChildContextConfigPath, getContextConfigPath, getErrorMessage, presetSystemExiter, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPT_SUBMIT

public static final java.lang.String OPT_SUBMIT
See Also:
Constant Field Values

OPT_KILL

public static final java.lang.String OPT_KILL
See Also:
Constant Field Values

OPT_LIST

public static final java.lang.String OPT_LIST
See Also:
Constant Field Values

ARG_APPLICATION_ID

public static final java.lang.String ARG_APPLICATION_ID
See Also:
Constant Field Values
Constructor Detail

CommandLineClientRunner

public CommandLineClientRunner()
Method Detail

handleBeanRun

protected ExitStatus handleBeanRun(YarnClient bean,
                                   java.lang.String[] parameters,
                                   java.util.Set<java.lang.String> opts)
Description copied from class: AbstractCommandLineRunner
Handles the execution of a bean after Application Context(s) has been initialized. This is considered to be a main entry point what the application will do after initialization.

It is implementors responsibility to decide what to do with the given bean since this class only knows the typed bean instance.

Specified by:
handleBeanRun in class AbstractCommandLineRunner<YarnClient>
Parameters:
bean - the bean instance
parameters - the parameters
opts - the options
Returns:
the exit status

getDefaultBeanIdentifier

protected java.lang.String getDefaultBeanIdentifier()
Description copied from class: AbstractCommandLineRunner
Gets a default bean id which is used to resolve the instance from an Application Context.

Specified by:
getDefaultBeanIdentifier in class AbstractCommandLineRunner<YarnClient>
Returns:
the id of the bean

getValidOpts

protected java.util.List<java.lang.String> getValidOpts()
Description copied from class: AbstractCommandLineRunner
Gets the list of valid option arguments. Default implementation returns null thus not allowing any options exist on a command line.

When overriding valid options make sure that options doesn't match anything else planned to be used in a command line. i.e. usually it's advised to prefix options with '-' character.

Overrides:
getValidOpts in class AbstractCommandLineRunner<YarnClient>
Returns:
the list of option arguments

queryApplicationId

protected org.apache.hadoop.yarn.api.records.ApplicationId queryApplicationId(YarnClient client,
                                                                              java.lang.String applicationId)
Query application id.

Parameters:
client - the yarn client
applicationId - the application id
Returns:
the application id if exists, NULL otherwise

main

public static void main(java.lang.String[] args)

Spring for Apache Hadoop