public interface TwillPreparer
Modifier and Type | Method and Description |
---|---|
TwillPreparer |
addJVMOptions(String options)
This methods adds extra JVM options that will be passed to the java command line for every runnable
of the application started through this
TwillPreparer instance. |
TwillPreparer |
addLogHandler(LogHandler handler)
Adds a
LogHandler for receiving an application log. |
TwillPreparer |
addSecureStore(SecureStore secureStore)
Adds security credentials for the runtime environment to gives application access to resources.
|
TwillPreparer |
enableDebugging(boolean doSuspend,
String... runnables)
Enable debugging for runnables.
|
TwillPreparer |
enableDebugging(String... runnables)
Enable debugging for runnables, without suspending the virtual machine to wait for the debugger.
|
TwillPreparer |
setClassLoader(String classLoaderClassName)
Sets the class name of the
ClassLoader to be used for loading twill and application classes for
all containers. |
TwillPreparer |
setJVMOptions(String options)
This methods sets the extra JVM options that will be passed to the java command line for every runnable
of the application started through this
TwillPreparer instance. |
TwillPreparer |
setJVMOptions(String runnableName,
String options)
This methods sets the extra JVM options that will be passed to the java command line for the given runnable
of the application started through this
TwillPreparer instance. |
TwillPreparer |
setLogLevel(LogEntry.Level logLevel)
Deprecated.
Use
setLogLevels(Map) with key Logger.ROOT_LOGGER_NAME instead. |
TwillPreparer |
setLogLevels(Map<String,LogEntry.Level> logLevels)
Set the log levels for requested logger names for Twill applications running in a container.
|
TwillPreparer |
setLogLevels(String runnableName,
Map<String,LogEntry.Level> logLevelsForRunnable)
Set the log levels for requested logger names for a
TwillRunnable . |
TwillPreparer |
setSchedulerQueue(String name)
Sets the name of the scheduler queue to use.
|
TwillPreparer |
setUser(String user)
Deprecated.
This method will be removed in future version.
|
TwillController |
start()
Starts the application.
|
TwillController |
start(long timeout,
TimeUnit timeoutUnit)
Starts the application.
|
TwillPreparer |
withApplicationArguments(Iterable<String> args)
Sets the list of arguments that will be passed to the application.
|
TwillPreparer |
withApplicationArguments(String... args)
Sets the list of arguments that will be passed to the application.
|
TwillPreparer |
withApplicationClassPaths(Iterable<String> classPaths)
Adds the set of paths to the classpath on the target machine for ApplicationMaster and all runnables.
|
TwillPreparer |
withApplicationClassPaths(String... classPaths)
Adds the set of paths to the classpath on the target machine for ApplicationMaster and all runnables.
|
TwillPreparer |
withArguments(String runnableName,
Iterable<String> args)
Sets the list of arguments that will be passed to the
TwillRunnable identified by the given name. |
TwillPreparer |
withArguments(String runnableName,
String... args)
Sets the list of arguments that will be passed to the
TwillRunnable identified by the given name. |
TwillPreparer |
withBundlerClassAcceptor(ClassAcceptor classAcceptor)
Uses
ClassAcceptor to determine the classes to include in the bundle jar for
ApplicationMaster and all runnables. |
TwillPreparer |
withClassPaths(Iterable<String> classPaths)
Adds the set of paths to the classpath on the target machine for all runnables.
|
TwillPreparer |
withClassPaths(String... classPaths)
Adds the set of paths to the classpath on the target machine for all runnables.
|
TwillPreparer |
withConfiguration(Map<String,String> config)
Overrides the default configuration with the given set of configurations.
|
TwillPreparer |
withConfiguration(String runnableName,
Map<String,String> config)
Overrides the default configuration with the given set of configurations for the given runnable only.
|
TwillPreparer |
withDependencies(Class<?>... classes)
Adds extra classes that the application is dependent on and is not traceable from the application itself.
|
TwillPreparer |
withDependencies(Iterable<Class<?>> classes)
Adds extra classes that the application is dependent on and is not traceable from the application itself.
|
TwillPreparer |
withEnv(Map<String,String> env)
Adds the set of environment variables that will be set as container environment variables for all runnables.
|
TwillPreparer |
withEnv(String runnableName,
Map<String,String> env)
Adds the set of environment variables that will be set as container environment variables for the given runnable.
|
TwillPreparer |
withMaxRetries(String runnableName,
int maxRetries)
Sets the maximum number of times (per instance) a runnable will be retried if it exits without success.
|
TwillPreparer |
withResources(Iterable<URI> resources)
Adds resources that will be available through the ClassLoader of the
runnables . |
TwillPreparer |
withResources(URI... resources)
Adds resources that will be available through the ClassLoader of the
runnables . |
TwillPreparer withConfiguration(Map<String,String> config)
config
- set of configurations to overrideTwillPreparer
TwillPreparer withConfiguration(String runnableName, Map<String,String> config)
Configs.Keys.JAVA_RESERVED_MEMORY_MB
and Configs.Keys.HEAP_RESERVED_MIN_RATIO
.runnableName
- Name of the TwillRunnable
.config
- set of configurations to overrideTwillPreparer
TwillPreparer addLogHandler(LogHandler handler)
LogHandler
for receiving an application log.handler
- The LogHandler
.TwillPreparer
.@Deprecated TwillPreparer setUser(String user)
"user.name"
by calling
System.getProperty(String)
.user
- User nameTwillPreparer
.TwillPreparer setSchedulerQueue(String name)
name
- Name of the scheduler queueTwillPreparer
.TwillPreparer setJVMOptions(String options)
TwillPreparer
instance.
This is intended for advance usage. All options will be passed unchanged to the java command line. Invalid
options could cause application not able to start.options
- extra JVM options.TwillPreparer setJVMOptions(String runnableName, String options)
TwillPreparer
instance.
The options set for the given runnable will be appended to any global options set through the
setJVMOptions(String)
or addJVMOptions(String)
method.
This is intended for advance usage. All options will be passed unchanged to the java command line. Invalid
options could cause application not able to start.options
- extra JVM options.TwillPreparer addJVMOptions(String options)
TwillPreparer
instance.
This is intended for advance usage. All options will be passed unchanged to the java command line. Invalid
options could cause application not able to start.options
- extra JVM options.TwillPreparer enableDebugging(String... runnables)
runnables
- the names of runnables to enable for debugging. If empty, it means all runnables.TwillPreparer enableDebugging(boolean doSuspend, String... runnables)
doSuspend
- whether the virtual machines should be supended until the debugger connects. This
option allows to debug a container from the very beginning. Note that in that case,
the container cannot notify the controller of its debug port until the debugger is
attached - you must figure out where it is running using the YARN console or APIs.runnables
- the names of runnables to enable for debugging. If empty, it means all runnables.TwillPreparer withApplicationArguments(String... args)
TwillContext.getApplicationArguments()
.args
- Array of arguments.TwillPreparer
.TwillPreparer withApplicationArguments(Iterable<String> args)
TwillContext.getApplicationArguments()
.args
- Iterable of arguments.TwillPreparer
.TwillPreparer withArguments(String runnableName, String... args)
TwillRunnable
identified by the given name.
The arguments can be retrieved from TwillContext.getArguments()
.runnableName
- Name of the TwillRunnable
.args
- Array of arguments.TwillPreparer
.TwillPreparer withArguments(String runnableName, Iterable<String> args)
TwillRunnable
identified by the given name.
The arguments can be retrieved from TwillContext.getArguments()
.runnableName
- Name of the TwillRunnable
.args
- Iterable of arguments.TwillPreparer
.TwillPreparer withDependencies(Class<?>... classes)
TwillPreparer
.withDependencies(Iterable)
TwillPreparer withDependencies(Iterable<Class<?>> classes)
Class.forName(String)
.classes
- set of classes to add to dependency list for generating the deployment jar.TwillPreparer
.TwillPreparer withResources(URI... resources)
runnables
.TwillPreparer
.withResources(Iterable)
TwillPreparer withResources(Iterable<URI> resources)
runnables
.
Useful for adding extra resource files or libraries that are not traceable from the application itself.
If the URI is a jar file, classes inside would be loadable by the ClassLoader. If the URI is a directory,
everything underneath would be available.resources
- Set of URI to the resources.TwillPreparer
.TwillPreparer withClassPaths(String... classPaths)
TwillPreparer
withClassPaths(Iterable)
TwillPreparer withClassPaths(Iterable<String> classPaths)
classPaths
- Set of classpathsTwillPreparer
TwillPreparer withEnv(Map<String,String> env)
env
- set of environment variablesTwillPreparer
TwillPreparer withEnv(String runnableName, Map<String,String> env)
withEnv(Map)
if there is a key clash.runnableName
- Name of the TwillRunnable
.env
- set of environment variablesTwillPreparer
TwillPreparer withApplicationClassPaths(String... classPaths)
TwillPreparer
TwillPreparer withApplicationClassPaths(Iterable<String> classPaths)
TwillPreparer
TwillPreparer withBundlerClassAcceptor(ClassAcceptor classAcceptor)
ClassAcceptor
to determine the classes to include in the bundle jar for
ApplicationMaster and all runnables.classAcceptor
- to specify which classes to include in the bundle jarTwillPreparer
TwillPreparer withMaxRetries(String runnableName, int maxRetries)
runnableName
- Name of the TwillRunnable
.maxRetries
- maximum number of retries per instanceTwillPreparer
TwillPreparer addSecureStore(SecureStore secureStore)
secureStore
- Contains security token available for the runtime environment.TwillPreparer
.@Deprecated TwillPreparer setLogLevel(LogEntry.Level logLevel)
setLogLevels(Map)
with key Logger.ROOT_LOGGER_NAME
instead.logLevel
- the LogEntry.Level
that should be set.
The level match the Logback
levels.TwillPreparer
.TwillPreparer setLogLevels(Map<String,LogEntry.Level> logLevels)
null
, if there is null
value, a IllegalArgumentException
will be thrown.logLevels
- The Map
contains the requested logger names and log levels that need to be set.TwillPreparer
.TwillPreparer setLogLevels(String runnableName, Map<String,LogEntry.Level> logLevelsForRunnable)
TwillRunnable
. The log level of any logger cannot be
null
, if there is null
value, a IllegalArgumentException
will be thrown.runnableName
- The name of the runnable to set the log level.logLevelsForRunnable
- The Map
contains the requested logger names and log levels that need to be set.TwillPreparer
.TwillPreparer setClassLoader(String classLoaderClassName)
ClassLoader
to be used for loading twill and application classes for
all containers. The ClassLoader
class should have a public constructor that takes two parameters in the
form of (URL[] urls, ClassLoader parentClassLoader)
.
The first parameter is an array of URL
that contains the list of URL
for loading classes and
resources; the second parameter is the parent ClassLoader
.classLoaderClassName
- name of the ClassLoader
class.TwillPreparer
.TwillController start()
start(long, TimeUnit)
with timeout of 60 seconds.TwillController
for controlling the running application.TwillController start(long timeout, TimeUnit timeoutUnit)
timeout
- maximum time to wait for the application to starttimeoutUnit
- unit for the timeoutTwillController
for controlling the running application.Copyright © 2013-2016 The Apache Software Foundation. All rights reserved.