public final class YarnTwillRunnerService extends Object implements TwillRunnerService
TwillRunnerService that runs application on a YARN cluster.TwillRunner.LiveInfo| Constructor and Description |
|---|
YarnTwillRunnerService(org.apache.hadoop.yarn.conf.YarnConfiguration config,
String zkConnect)
Creates an instance with a
FileContextLocationFactory created base on the given configuration with the
user home directory as the location factory namespace. |
YarnTwillRunnerService(org.apache.hadoop.yarn.conf.YarnConfiguration config,
String zkConnect,
LocationFactory locationFactory)
Creates an instance.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getJVMOptions()
Returns any extra JVM options that have been set.
|
Iterable<TwillController> |
lookup(String applicationName)
Gets an
Iterable of TwillController for all running instances of the given application. |
TwillController |
lookup(String applicationName,
RunId runId)
Gets a
TwillController for the given application and runId. |
Iterable<TwillRunner.LiveInfo> |
lookupLive()
Gets an
Iterable of TwillRunner.LiveInfo. |
TwillPreparer |
prepare(TwillApplication application)
Prepares to run the given
TwillApplication as specified by the application. |
TwillPreparer |
prepare(TwillRunnable runnable)
Prepares to run the given
TwillRunnable with ResourceSpecification.BASIC resource specification. |
TwillPreparer |
prepare(TwillRunnable runnable,
ResourceSpecification resourceSpecification)
Prepares to run the given
TwillRunnable with the given resource specification. |
Cancellable |
scheduleSecureStoreUpdate(SecureStoreUpdater updater,
long initialDelay,
long delay,
TimeUnit unit)
Schedules a periodic update of SecureStore.
|
void |
setJVMOptions(String options)
This methods sets the extra JVM options that will be passed to the java command line for every application
started through this
YarnTwillRunnerService instance. |
Cancellable |
setSecureStoreRenewer(SecureStoreRenewer renewer,
long initialDelay,
long delay,
long retryDelay,
TimeUnit unit)
Sets and schedules a periodic renewal of
SecureStore using a given SecureStoreRenewer. |
void |
start()
Starts the service.
|
void |
stop()
Stops the service.
|
public YarnTwillRunnerService(org.apache.hadoop.yarn.conf.YarnConfiguration config,
String zkConnect)
FileContextLocationFactory created base on the given configuration with the
user home directory as the location factory namespace.config - Configuration of the yarn clusterzkConnect - ZooKeeper connection stringpublic YarnTwillRunnerService(org.apache.hadoop.yarn.conf.YarnConfiguration config,
String zkConnect,
LocationFactory locationFactory)
config - Configuration of the yarn clusterzkConnect - ZooKeeper connection stringlocationFactory - Factory to create Location instances that are readable and writable by this servicepublic void start()
TwillRunnerServicestart in interface TwillRunnerServicepublic void stop()
TwillRunnerServicestop in interface TwillRunnerServicepublic void setJVMOptions(String options)
YarnTwillRunnerService instance. It only affects applications that are started
after options is set.
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.public String getJVMOptions()
setJVMOptions(String)public Cancellable scheduleSecureStoreUpdate(SecureStoreUpdater updater, long initialDelay, long delay, TimeUnit unit)
TwillRunnerSecureStoreUpdater will be made
after initialDelay, and subsequently with the given delay between completion of one update
and starting of the next. If exception is thrown on call
SecureStoreUpdater.update(String, RunId), the exception will only get logged
and won't suppress the next update call.scheduleSecureStoreUpdate in interface TwillRunnerupdater - A SecureStoreUpdater for creating new SecureStore.initialDelay - Delay before the first call to update method.delay - Delay between completion of one update call to the next one.unit - time unit for the initialDelay and delay.Cancellable for cancelling the scheduled update.public Cancellable setSecureStoreRenewer(SecureStoreRenewer renewer, long initialDelay, long delay, long retryDelay, TimeUnit unit)
TwillRunnerSecureStore using a given SecureStoreRenewer.
There is always only one active SecureStoreRenewer. Setting a new renewer will replace the old one
and setting up a new schedule.setSecureStoreRenewer in interface TwillRunnerrenewer - a SecureStoreRenewer for renewing SecureStore for all applications.initialDelay - delay before the first call to renew method.delay - the delay between successful completion of one renew call to the next one.retryDelay - the delay before the retrying the renewal if the call
to SecureStoreRenewer.renew(String, RunId, SecureStoreWriter) raised exception.unit - time unit for the initialDelay and period.public TwillPreparer prepare(TwillRunnable runnable)
TwillRunnerTwillRunnable with ResourceSpecification.BASIC resource specification.
The name for the runnable will be defaulted to runnable.getClass().getSimpleName()prepare in interface TwillRunnerrunnable - The runnable to run through Twill when TwillPreparer.start() is called.TwillPreparer for setting up runtime options.public TwillPreparer prepare(TwillRunnable runnable, ResourceSpecification resourceSpecification)
TwillRunnerTwillRunnable with the given resource specification. The name for the runnable
will be defaulted to runnable.getClass().getSimpleName()prepare in interface TwillRunnerrunnable - The runnable to run through Twill when TwillPreparer.start() is called.resourceSpecification - The resource specification for running the runnable.TwillPreparer for setting up runtime options.public TwillPreparer prepare(TwillApplication application)
TwillRunnerTwillApplication as specified by the application.prepare in interface TwillRunnerapplication - The application to run through Twill when TwillPreparer.start() is called.TwillPreparer for setting up runtime options.public TwillController lookup(String applicationName, RunId runId)
TwillRunnerTwillController for the given application and runId.lookup in interface TwillRunnerapplicationName - Name of the application.runId - The runId of the running application.TwillController to interact with the application or null if no such runId is found.public Iterable<TwillController> lookup(String applicationName)
TwillRunnerIterable of TwillController for all running instances of the given application.lookup in interface TwillRunnerapplicationName - Name of the application.Iterable that gives the latest TwillController set for all running
instances of the application when Iterable.iterator() is invoked.public Iterable<TwillRunner.LiveInfo> lookupLive()
TwillRunnerIterable of TwillRunner.LiveInfo.lookupLive in interface TwillRunnerIterable that gives the latest information on the set of applications that
have running instances when Iterable.iterator()} is invoked.Copyright © 2013-2016 The Apache Software Foundation. All rights reserved.