(TWILL-181) allow setting the maximum number of retries per runnable

Patch by @serranom

Each runnable can have a configured number of max retries. If not set, then retries are unlimited as before. Retries are scaled according to the number of instances for each Runnable.
add withMaxTries(runnableName, int) to TwillPreparer
add withMaxTries(runnableName, int) to YarnTwillPreparer. This stores a map from runnableName to maxRetries.
this map becomes part of the twillRuntimeSpecification and RuntimeSpecification interface and is added to TwillRuntimeSpecificationCodec
ApplicationMasterService.initRunningContainers is updated to pass a map of runnables to maxretries.
updated RunningContainers so that it keeps count of the number of retries per runnable and uses this in handleCompleted() to determine if it should retry. Since every instance is the same as any other, if I'm starting 10 instances of a Runnable, and wanted a max retry count of 3, then that would scale the total number of retries to 30. Each instance gets (on average) 3 tries. Since the instances are interchangeable, there is no concept of a discrete instance being retried.
updated logging to not have anything special if max wasn't set and to log the number of retries left and when they have been exhausted.

This closes #23 from Github

Signed-off-by: Henry Saputra <hsaputra@apache.org>
9 files changed
tree: 1c5d89e4a0c07409c821c8c69a559f29851b7512
  1. twill-api/
  2. twill-common/
  3. twill-core/
  4. twill-discovery-api/
  5. twill-discovery-core/
  6. twill-examples/
  7. twill-ext/
  8. twill-java8-test/
  9. twill-yarn/
  10. twill-zookeeper/
  11. .gitignore
  12. .reviewboardrc
  13. .travis.yml
  14. checkstyle.xml
  15. LICENSE
  16. NOTICE
  17. pom.xml
  18. README.md
README.md

What is Apache Twill?

Twill is an abstraction over Apache Hadoop® YARN that reduces the complexity of developing distributed applications, allowing developers to focus more on their business logic. Twill allows you to use YARN’s distributed capabilities with a programming model that is similar to running threads.

Getting Started

You can build and install the Apache Twill by:

    git clone https://git-wip-us.apache.org/repos/asf/twill.git
    cd twill
    mvn install

After the maven installation completes, you can include the artifact org.apache.twill:twill-yarn as a dependency on your other projects.

Export Control

This distribution includes cryptographic software. The country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check your country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted. See http://www.wassenaar.org/ for more information.

The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has classified this software as Export Commodity Control Number (ECCN) 5D002.C.1, which includes information security software using or performing cryptographic functions with asymmetric algorithms. The form and manner of this Apache Software Foundation distribution makes it eligible for export under the License Exception ENC Technology Software Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Section 740.13) for both object code and source code.

The following provides more details on the included cryptographic software:

Apache Twill uses the built-in java cryptography libraries for unique ID generation. See http://www.oracle.com/us/products/export/export-regulations-345813.html for more details on Java's cryptography features.