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

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

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

origin: apache/incubator-slider

/**
 * Find a cluster in the instance list; biased towards live instances
 * @param instances list of instances
 * @param appname application name
 * @return the first found instance, else a failed/finished instance, or null
 * if there are none of those
 */
public ApplicationReport findClusterInInstanceList(List<ApplicationReport> instances,
                          String appname) {
 Preconditions.checkArgument(instances != null, "Null instances list");
 Preconditions.checkArgument(StringUtils.isNotEmpty(appname),
   "Null/empty application name");
 // sort by most recent
 SliderUtils.sortApplicationsByMostRecent(instances);
 ApplicationReport found = null;
 for (ApplicationReport app : instances) {
  if (app.getName().equals(appname)) {
   if (isApplicationLive(app)) {
    return app;
   }
   // set the found value if not set
   found = found != null ? found : app;
  }
 }
 return found;
}
origin: org.apache.slider/slider-core

/**
 * Find a cluster in the instance list; biased towards live instances
 * @param instances list of instances
 * @param appname application name
 * @return the first found instance, else a failed/finished instance, or null
 * if there are none of those
 */
public ApplicationReport findClusterInInstanceList(List<ApplicationReport> instances,
                          String appname) {
 Preconditions.checkArgument(instances != null, "Null instances list");
 Preconditions.checkArgument(StringUtils.isNotEmpty(appname),
   "Null/empty application name");
 // sort by most recent
 SliderUtils.sortApplicationsByMostRecent(instances);
 ApplicationReport found = null;
 for (ApplicationReport app : instances) {
  if (app.getName().equals(appname)) {
   if (isApplicationLive(app)) {
    return app;
   }
   // set the found value if not set
   found = found != null ? found : app;
  }
 }
 return found;
}
origin: org.apache.slider/slider-core

SliderUtils.sortApplicationsByMostRecent(rmInstances);
Map<String, ApplicationReport> reportMap =
  SliderUtils.buildApplicationReportMap(rmInstances, minAppState,
origin: apache/incubator-slider

SliderUtils.sortApplicationsByMostRecent(rmInstances);
Map<String, ApplicationReport> reportMap =
  SliderUtils.buildApplicationReportMap(rmInstances, minAppState,
origin: apache/incubator-slider

sortApplicationsByMostRecent(instances);
Map<String, ApplicationReport> reportMap =
  buildApplicationReportMap(instances, min, max);
origin: org.apache.slider/slider-core

sortApplicationsByMostRecent(instances);
Map<String, ApplicationReport> reportMap =
  buildApplicationReportMap(instances, min, max);
origin: org.apache.slider/slider-core

@Test
public void testApplicationReportComparison() {
 List<ApplicationReport> instances = getApplicationReports();
 SliderUtils.sortApplicationsByMostRecent(instances);
 Assert.assertEquals(1000, instances.get(0).getStartTime());
 Assert.assertEquals(1000, instances.get(1).getStartTime());
 Assert.assertEquals(1000, instances.get(2).getStartTime());
 Assert.assertEquals(1000, instances.get(3).getStartTime());
 instances = getApplicationReports();
 SliderUtils.sortApplicationReport(instances);
 Assert.assertEquals(1000, instances.get(0).getStartTime());
 Assert.assertEquals(1000, instances.get(1).getStartTime());
 Assert.assertEquals(1000, instances.get(2).getStartTime());
 Assert.assertEquals(1000, instances.get(3).getStartTime());
 Assert.assertTrue(instances.get(0).getYarnApplicationState() == YarnApplicationState.ACCEPTED ||
          instances.get(0).getYarnApplicationState() == YarnApplicationState.RUNNING);
 Assert.assertTrue(instances.get(1).getYarnApplicationState() == YarnApplicationState.ACCEPTED ||
          instances.get(1).getYarnApplicationState() == YarnApplicationState.RUNNING);
 Assert.assertTrue(instances.get(2).getYarnApplicationState() == YarnApplicationState.ACCEPTED ||
          instances.get(2).getYarnApplicationState() == YarnApplicationState.RUNNING);
 Assert.assertTrue(instances.get(3).getYarnApplicationState() == YarnApplicationState.KILLED);
}
origin: apache/incubator-slider

@Test
public void testApplicationReportComparison() {
 List<ApplicationReport> instances = getApplicationReports();
 SliderUtils.sortApplicationsByMostRecent(instances);
 Assert.assertEquals(1000, instances.get(0).getStartTime());
 Assert.assertEquals(1000, instances.get(1).getStartTime());
 Assert.assertEquals(1000, instances.get(2).getStartTime());
 Assert.assertEquals(1000, instances.get(3).getStartTime());
 instances = getApplicationReports();
 SliderUtils.sortApplicationReport(instances);
 Assert.assertEquals(1000, instances.get(0).getStartTime());
 Assert.assertEquals(1000, instances.get(1).getStartTime());
 Assert.assertEquals(1000, instances.get(2).getStartTime());
 Assert.assertEquals(1000, instances.get(3).getStartTime());
 Assert.assertTrue(instances.get(0).getYarnApplicationState() == YarnApplicationState.ACCEPTED ||
          instances.get(0).getYarnApplicationState() == YarnApplicationState.RUNNING);
 Assert.assertTrue(instances.get(1).getYarnApplicationState() == YarnApplicationState.ACCEPTED ||
          instances.get(1).getYarnApplicationState() == YarnApplicationState.RUNNING);
 Assert.assertTrue(instances.get(2).getYarnApplicationState() == YarnApplicationState.ACCEPTED ||
          instances.get(2).getYarnApplicationState() == YarnApplicationState.RUNNING);
 Assert.assertTrue(instances.get(3).getYarnApplicationState() == YarnApplicationState.KILLED);
}
org.apache.slider.common.toolsSliderUtilssortApplicationsByMostRecent

Javadoc

Sorts the given list of application reports, most recently started or finished instance first.

Popular methods of SliderUtils

  • buildEnvMap
  • isSet
  • extractDomainNameFromFQDN
  • extractFirstLine
    Extract the first line of a multi-line string. This is typically used to prune the stack trace appen
  • 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
  • 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

  • Reactive rest calls using spring rest template
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • startActivity (Activity)
  • findViewById (Activity)
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Permission (java.security)
    Legacy security code; do not use.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • From CI to AI: The AI layer in your organization
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