[ 
https://issues.apache.org/jira/browse/SLIDER-752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14297140#comment-14297140
 ] 

Steve Loughran commented on SLIDER-752:
---------------------------------------

This is what I've added —will it work?

in {{SliderClientAPI}}
{code}
  /**
   * Enumerate slider instances for the current user, and the
   * most recent app report, where available.
   * @param listOnlyInState boolean to indicate that the instances should
   * only include those in a YARN state
   * <code> minAppState &lt;= currentState &lt;= maxAppState </code>
   *
   * @param minAppState minimum application state to include in enumeration.
   * @param maxAppState maximum application state to include
   * @return a map of application instance name to description
   * @throws IOException Any IO problem
   * @throws YarnException YARN problems
   */
  @Override
  public Map<String, SliderInstanceDescription> enumSliderInstances(
      boolean listOnlyInState,
      YarnApplicationState minAppState,
      YarnApplicationState maxAppState)
      throws IOException, YarnException {
    return yarnAppListClient.enumSliderInstances(listOnlyInState,
        minAppState,
        maxAppState);
  }
{code}

it lets you enum all, and filter by state if you want. The latest App report of 
any instance is included in a description type returned:
{code}
public class SliderInstanceDescription {

  public final String name;
  public final Path path;
  public final ApplicationReport applicationReport;
{code}

Having the cluster name in the key of the map returned and every value is a bit 
overkill —I did that in case we ever want to pass the 
{{SliderInstanceDescription}} around outside of a map.

> No easy way to get list of applications via API from SliderClient
> -----------------------------------------------------------------
>
>                 Key: SLIDER-752
>                 URL: https://issues.apache.org/jira/browse/SLIDER-752
>             Project: Slider
>          Issue Type: Bug
>          Components: core
>    Affects Versions: Slider 0.61
>            Reporter: Srimanth Gunturi
>            Assignee: Steve Loughran
>             Fix For: Slider 0.70
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Slider-View is trying to list applications launched by Slider. However there 
> is no API friendly call to get the list of apps. The method 
> [SliderClient#actionList()|https://git-wip-us.apache.org/repos/asf?p=incubator-slider.git;a=blob;f=slider-core/src/main/java/org/apache/slider/client/SliderClient.java;h=59d317eea73a9a14caa7f2479a5ffc95c748516f;hb=develop#l2023]
>  directly gets applications and prints output.
> We need an API to get the list of applications, and it should be the same as 
> the CLI invocation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to