Tabnine Logo
SliderUtils.extractFirstLine
Code IndexAdd Tabnine to your IDE (free)

How to use
extractFirstLine
method
in
org.apache.slider.common.tools.SliderUtils

Best Java code snippets using org.apache.slider.common.tools.SliderUtils.extractFirstLine (Showing top 6 results out of 315)

origin: org.apache.slider/slider-core

@Override //AMRMClientAsync
public void onError(Throwable e) {
 if (e instanceof InvalidResourceRequestException) {
  // stop the cluster
  LOG_YARN.error("AMRMClientAsync.onError() received {}", e, e);
  ActionStopSlider stopSlider = new ActionStopSlider("stop",
    EXIT_EXCEPTION_THROWN, FinalApplicationStatus.FAILED,
    SliderUtils.extractFirstLine(e.getLocalizedMessage()));
  stopSlider.setExitReason(SliderExitReason.APP_ERROR);
  signalAMComplete(stopSlider);
 } else if (e instanceof InvalidApplicationMasterRequestException) {
  // halt the AM
  LOG_YARN.error("AMRMClientAsync.onError() received {}", e, e);
  queue(new ActionHalt(EXIT_EXCEPTION_THROWN,
    SliderUtils.extractFirstLine(e.getLocalizedMessage())));
 } else {
  // ignore and log
  LOG_YARN.info("Ignoring AMRMClientAsync.onError() received {}", e);
 }
}
origin: apache/incubator-slider

@Override //AMRMClientAsync
public void onError(Throwable e) {
 if (e instanceof InvalidResourceRequestException) {
  // stop the cluster
  LOG_YARN.error("AMRMClientAsync.onError() received {}", e);
  ActionStopSlider stopSlider = new ActionStopSlider("stop",
    EXIT_EXCEPTION_THROWN, FinalApplicationStatus.FAILED,
    SliderUtils.extractFirstLine(e.getLocalizedMessage()));
  stopSlider.setExitReason(SliderExitReason.APP_ERROR);
  signalAMComplete(stopSlider);
 } else if (e instanceof InvalidApplicationMasterRequestException) {
  // halt the AM
  LOG_YARN.error("AMRMClientAsync.onError() received {}", e, e);
  queue(new ActionHalt(EXIT_EXCEPTION_THROWN,
    SliderUtils.extractFirstLine(e.getLocalizedMessage())));
 } else {
  // ignore and log
  LOG_YARN.info("Ignoring AMRMClientAsync.onError() received {}", e);
 }
}
origin: apache/incubator-slider

/**
 * Handle any exception in a thread. If the exception provides an exit
 * code, that is the one that will be used.
 * @param thread thread throwing the exception
 * @param exception exception
 */
public void onExceptionInThread(Thread thread, Throwable exception) {
 log.error("Exception in {}: {}", thread.getName(), exception, exception);
 // if there is a teardown in progress, ignore it
 if (amCompletionFlag.get()) {
  log.info("Ignoring exception: shutdown in progress");
 } else {
  int exitCode = EXIT_EXCEPTION_THROWN;
  if (exception instanceof ExitCodeProvider) {
   exitCode = ((ExitCodeProvider) exception).getExitCode();
  }
  ActionStopSlider stopSlider = new ActionStopSlider("stop", exitCode,
    FinalApplicationStatus.FAILED,
    SliderUtils.extractFirstLine(exception.getLocalizedMessage()));
  stopSlider.setExitReason(SliderExitReason.SLIDER_AM_ERROR);
  signalAMComplete(stopSlider);
 }
}
origin: org.apache.slider/slider-core

/**
 * Handle any exception in a thread. If the exception provides an exit
 * code, that is the one that will be used.
 * @param thread thread throwing the exception
 * @param exception exception
 */
public void onExceptionInThread(Thread thread, Throwable exception) {
 log.error("Exception in {}: {}", thread.getName(), exception, exception);
 // if there is a teardown in progress, ignore it
 if (amCompletionFlag.get()) {
  log.info("Ignoring exception: shutdown in progress");
 } else {
  int exitCode = EXIT_EXCEPTION_THROWN;
  if (exception instanceof ExitCodeProvider) {
   exitCode = ((ExitCodeProvider) exception).getExitCode();
  }
  ActionStopSlider stopSlider = new ActionStopSlider("stop", exitCode,
    FinalApplicationStatus.FAILED,
    SliderUtils.extractFirstLine(exception.getLocalizedMessage()));
  stopSlider.setExitReason(SliderExitReason.SLIDER_AM_ERROR);
  signalAMComplete(stopSlider);
 }
}
origin: apache/incubator-slider

@Test
public void testExtractFirstLine() {
 String firstLine = "hello";
 String msg = firstLine + "\n2nd line\n3rd line";
 Assert.assertEquals("Should be first line only", firstLine,
   SliderUtils.extractFirstLine(msg));
 msg = "";
 Assert.assertEquals("Should be empty", msg,
   SliderUtils.extractFirstLine(msg));
 msg = "   ";
 Assert.assertEquals("Should contain spaces only", msg,
   SliderUtils.extractFirstLine(msg));
 msg = null;
 Assert.assertEquals("Should be null", msg,
   SliderUtils.extractFirstLine(msg));
}
origin: org.apache.slider/slider-core

 @Test
 public void testExtractFirstLine() {
  String firstLine = "hello";
  String msg = firstLine + "\n2nd line\n3rd line";
  Assert.assertEquals("Should be first line only", firstLine,
    SliderUtils.extractFirstLine(msg));
  msg = "";
  Assert.assertEquals("Should be empty", msg,
    SliderUtils.extractFirstLine(msg));
  msg = "   ";
  Assert.assertEquals("Should contain spaces only", msg,
    SliderUtils.extractFirstLine(msg));
  msg = null;
  Assert.assertEquals("Should be null", msg,
    SliderUtils.extractFirstLine(msg));
 }
}
org.apache.slider.common.toolsSliderUtilsextractFirstLine

Javadoc

Extract the first line of a multi-line string. This is typically used to prune the stack trace appended to the end of exception messages returned by YARN in AMRMClientAsync callbacks.

Popular methods of SliderUtils

  • buildEnvMap
  • isSet
  • extractDomainNameFromFQDN
  • getApplicationResourceInputStream
  • getHdpVersion
    Retrieve the HDP version if it is an HDP cluster, or null otherwise. It first checks if system prope
  • isHdp
    Query to find if it is an HDP cluster
  • listDir
    List a directory in the local filesystem
  • sortApplicationsByMostRecent
    Sorts the given list of application reports, most recently started or finished instance first.
  • truncate
    Truncate the given string to a maximum length provided with a pad (...) added to the end if expected
  • write
    Write bytes to a file
  • addBuildInfo
    Add the cluster build information; this will include Hadoop details too
  • appReportToString
  • addBuildInfo,
  • appReportToString,
  • appendToURL,
  • buildApplicationReportMap,
  • buildClasspath,
  • checkCredentialCacheFile,
  • checkForRequiredNativeLibraries,
  • checkPort,
  • collectionToStringList

Popular in Java

  • Reading from database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSharedPreferences (Context)
  • setScale (BigDecimal)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now