Codota Logo
AbortOnTimeoutEventHandler
Code IndexAdd Codota to your IDE (free)

How to use
AbortOnTimeoutEventHandler
in
co.cask.cdap.common.twill

Best Java code snippets using co.cask.cdap.common.twill.AbortOnTimeoutEventHandler (Showing top 15 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: cdapio/cdap

@Override
public void aborted() {
 super.aborted();
 programStateWriterWithHeartBeat.error(
  new Exception(String.format("No containers for %s. Abort the application", programRunId)));
}
origin: cdapio/cdap

@Override
public void containerLaunched(String runnableName, int instanceId, String containerId) {
 super.containerLaunched(runnableName, instanceId, containerId);
 if (runningPublished.compareAndSet(false, true)) {
  // The program is marked as running when the first container for the program is launched
  programStateWriterWithHeartBeat.running(twillRunId.getId());
 }
}
origin: cdapio/cdap

@Override
protected Map<String, String> getConfigs() {
 Map<String, String> configs = new HashMap<>(super.getConfigs());
 configs.put("programRunId", GSON.toJson(programRunId));
 return configs;
}
origin: cdapio/cdap

@Override
public void completed() {
 super.completed();
 // On normal AM completion, based on the last container failure to publish the state
 if (lastContainerFailure == null) {
  programStateWriterWithHeartBeat.completed();
 } else {
  lastContainerFailure.writeError(programStateWriterWithHeartBeat);
 }
}
origin: cdapio/cdap

@Override
public void killed() {
 super.killed();
 // The AM is stopped explicitly, always record the state as killed.
 programStateWriterWithHeartBeat.killed();
}
origin: cdapio/cdap

@Override
public void containerStopped(String runnableName, int instanceId, String containerId, int exitStatus) {
 super.containerStopped(runnableName, instanceId, containerId, exitStatus);
 // Let the completed() method handle when a container has completed with no error
 if (exitStatus == 0) {
  return;
 }
 switch(programRunId.getType()) {
  case WORKFLOW:
  case SPARK:
  case MAPREDUCE:
   // For workflow, MapReduce, and spark, if there is an error, the program state is failure
   // We defer the actual publish to one of the completion methods (killed, completed, aborted)
   // as we need to know under what condition the container failed.
   lastContainerFailure = new ContainerFailure(runnableName, instanceId, containerId, exitStatus);
   break;
  default:
   // For other programs, the container will be re-launched - the program state will continue to be RUNNING
   // TODO Workers should be configured via runtime args
   // to support both retrying on failure, or just failing and not retrying.
   break;
 }
}
origin: cdapio/cdap

@Override
public void initialize(EventHandlerContext context) {
 super.initialize(context);
origin: cdapio/cdap

@Override
public TwillSpecification configure() {
 // It is always present in cdap-default.xml
 final long noContainerTimeout = cConf.getLong(Constants.CFG_TWILL_NO_CONTAINER_TIMEOUT, Long.MAX_VALUE);
 TwillSpecification.Builder.RunnableSetter runnableSetter =
  addMessaging(
   addDatasetOpExecutor(
    addLogSaverService(
     addTransactionService(
      addMetricsProcessor (
       addMetricsService(
        TwillSpecification.Builder.with().setName(NAME).withRunnable()
       )
      )
     )
    )
   )
  );
 if (cConf.getBoolean(Constants.Explore.EXPLORE_ENABLED)) {
  LOG.info("Adding explore runnable.");
  runnableSetter = addExploreService(runnableSetter);
 } else {
  LOG.info("Explore module disabled - will not launch explore runnable.");
 }
 return runnableSetter
   .withOrder()
    .begin(Constants.Service.MESSAGING_SERVICE, Constants.Service.TRANSACTION, Constants.Service.DATASET_EXECUTOR)
   .withEventHandler(new AbortOnTimeoutEventHandler(noContainerTimeout))
   .build();
}
origin: co.cask.cdap/cdap-app-fabric

@Override
public void completed() {
 super.completed();
 // On normal AM completion, based on the last container failure to publish the state
 if (lastContainerFailure == null) {
  programStateWriterWithHeartBeat.completed();
 } else {
  lastContainerFailure.writeError(programStateWriterWithHeartBeat);
 }
}
origin: co.cask.cdap/cdap-app-fabric

@Override
public void killed() {
 super.killed();
 // The AM is stopped explicitly, always record the state as killed.
 programStateWriterWithHeartBeat.killed();
}
origin: co.cask.cdap/cdap-app-fabric

@Override
public void containerStopped(String runnableName, int instanceId, String containerId, int exitStatus) {
 super.containerStopped(runnableName, instanceId, containerId, exitStatus);
 // Let the completed() method handle when a container has completed with no error
 if (exitStatus == 0) {
  return;
 }
 switch(programRunId.getType()) {
  case WORKFLOW:
  case SPARK:
  case MAPREDUCE:
   // For workflow, MapReduce, and spark, if there is an error, the program state is failure
   // We defer the actual publish to one of the completion methods (killed, completed, aborted)
   // as we need to know under what condition the container failed.
   lastContainerFailure = new ContainerFailure(runnableName, instanceId, containerId, exitStatus);
   break;
  default:
   // For other programs, the container will be re-launched - the program state will continue to be RUNNING
   // TODO Workers should be configured via runtime args
   // to support both retrying on failure, or just failing and not retrying.
   break;
 }
}
origin: co.cask.cdap/cdap-app-fabric

@Override
public void initialize(EventHandlerContext context) {
 super.initialize(context);
origin: co.cask.cdap/cdap-app-fabric

@Override
protected Map<String, String> getConfigs() {
 Map<String, String> configs = new HashMap<>(super.getConfigs());
 configs.put("programRunId", GSON.toJson(programRunId));
 return configs;
}
origin: co.cask.cdap/cdap-app-fabric

@Override
public void aborted() {
 super.aborted();
 programStateWriterWithHeartBeat.error(
  new Exception(String.format("No containers for %s. Abort the application", programRunId)));
}
origin: co.cask.cdap/cdap-app-fabric

@Override
public void containerLaunched(String runnableName, int instanceId, String containerId) {
 super.containerLaunched(runnableName, instanceId, containerId);
 if (runningPublished.compareAndSet(false, true)) {
  // The program is marked as running when the first container for the program is launched
  programStateWriterWithHeartBeat.running(twillRunId.getId());
 }
}
co.cask.cdap.common.twillAbortOnTimeoutEventHandler

Javadoc

A Twill EventHandler that abort the application if for some runnable it cannot provision container for too long.

Most used methods

  • <init>
    Constructs an instance of AbortOnTimeoutEventHandler that abort the application if some runnable has
  • aborted
  • completed
  • containerLaunched
  • containerStopped
  • getConfigs
  • initialize
  • killed

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onRequestPermissionsResult (Fragment)
  • getContentResolver (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now