/** * Queries RM for the list of applications with the given tag that have started * after the given timestamp. */ private Set<ApplicationId> getYarnChildJobs(String tag, long timestamp) { Set<ApplicationId> childYarnJobs = new HashSet<ApplicationId>(); LOG.info(String.format("Querying RM for tag = %s, starting with ts = %s", tag, timestamp)); GetApplicationsRequest gar = GetApplicationsRequest.newInstance(); gar.setScope(ApplicationsRequestScope.OWN); gar.setStartRange(timestamp, System.currentTimeMillis()); gar.setApplicationTags(Collections.singleton(tag)); try { ApplicationClientProtocol proxy = ClientRMProxy.createRMProxy(conf, ApplicationClientProtocol.class); GetApplicationsResponse apps = proxy.getApplications(gar); List<ApplicationReport> appsList = apps.getApplicationList(); for(ApplicationReport appReport : appsList) { childYarnJobs.add(appReport.getApplicationId()); } } catch (IOException ioe) { throw new RuntimeException("Exception occurred while finding child jobs", ioe); } catch (YarnException ye) { throw new RuntimeException("Exception occurred while finding child jobs", ye); } return childYarnJobs; } }
@Private @Unstable public static GetApplicationsResponse newInstance( List<ApplicationReport> applications) { GetApplicationsResponse response = Records.newRecord(GetApplicationsResponse.class); response.setApplicationList(applications); return response; }
@Override public GetApplicationsResponse getApplications(GetApplicationsRequest request) throws YarnException, IOException { GetApplicationsResponse response = GetApplicationsResponse.newInstance(new ArrayList<ApplicationReport>( history.getApplications(request.getLimit()).values())); return response; }
@Private @Unstable public static GetApplicationsResponse newInstance( List<ApplicationReport> applications) { GetApplicationsResponse response = Records.newRecord(GetApplicationsResponse.class); response.setApplicationList(applications); return response; }
@Override public GetApplicationsResponse getApplications(GetApplicationsRequest request) throws YarnException, IOException { GetApplicationsResponse response = GetApplicationsResponse.newInstance(new ArrayList<ApplicationReport>( history.getApplications(request.getLimit()).values())); return response; }
public static Set<ApplicationId> getChildYarnJobs(Configuration conf, String tag) throws IOException, YarnException { Set<ApplicationId> childYarnJobs = new HashSet<ApplicationId>(); GetApplicationsRequest gar = GetApplicationsRequest.newInstance(); gar.setScope(ApplicationsRequestScope.OWN); gar.setApplicationTags(Collections.singleton(tag)); ApplicationClientProtocol proxy = ClientRMProxy.createRMProxy(conf, ApplicationClientProtocol.class); GetApplicationsResponse apps = proxy.getApplications(gar); List<ApplicationReport> appsList = apps.getApplicationList(); for(ApplicationReport appReport : appsList) { if (isAdmin() || appReport.getApplicationTags().contains(QueryState.USERID_TAG + "=" + SessionState.get() .getUserName())) { childYarnJobs.add(appReport.getApplicationId()); } } if (childYarnJobs.isEmpty()) { LOG.info("No child applications found"); } else { LOG.info("Found child YARN applications: " + StringUtils.join(childYarnJobs, ",")); } return childYarnJobs; }
@Private @Unstable public static GetApplicationsResponse newInstance( List<ApplicationReport> applications) { GetApplicationsResponse response = Records.newRecord(GetApplicationsResponse.class); response.setApplicationList(applications); return response; }
@Override public GetApplicationsResponse getApplications(GetApplicationsRequest request) throws YarnException, IOException { validateRunning(); return GetApplicationsResponse.newInstance(null); }
@Override public Collection<ApplicationReport> run() throws Exception { return appBaseProt.getApplications(request).getApplicationList(); } });
@Private @Unstable public static GetApplicationsResponse newInstance( List<ApplicationReport> applications) { GetApplicationsResponse response = Records.newRecord(GetApplicationsResponse.class); response.setApplicationList(applications); return response; }
@Override public GetApplicationsResponse getApplications(GetApplicationsRequest request) throws YarnException, IOException { long startedBegin = request.getStartRange() == null ? 0L : request.getStartRange() .getMinimum(); long startedEnd = request.getStartRange() == null ? Long.MAX_VALUE : request .getStartRange().getMaximum(); GetApplicationsResponse response = GetApplicationsResponse.newInstance(new ArrayList<ApplicationReport>( history.getApplications(request.getLimit(), startedBegin, startedEnd) .values())); return response; }
@Override public List<ApplicationReport> getApplications( GetApplicationsRequest request) throws YarnException, IOException { GetApplicationsResponse response = rmClient.getApplications(request); return response.getApplicationList(); }
response.setApplicationList(reports); return response;
@Override public Collection<ApplicationReport> run() throws Exception { return appBaseProt.getApplications(request).getApplicationList(); } });
GetApplicationsResponse response = recordFactory.newRecordInstance(GetApplicationsResponse.class); response.setApplicationList(reports); return response;
@Override public Collection<ApplicationReport> run() throws Exception { return appBaseProt.getApplications(request) .getApplicationList(); } });
response.setApplicationList(reports); return response;
@Override public Collection<ApplicationReport> run() throws Exception { return appBaseProt.getApplications(request) .getApplicationList(); } });
applications.add(getApplicationReport(YarnApplicationState.FAILED, FinalApplicationStatus.FAILED)); allApplicationsResponse.setApplicationList(applications); Mockito.when( applicationsManager.getApplications(Mockito
@Override public Collection<ApplicationReport> run() throws Exception { return appBaseProt.getApplications(request).getApplicationList(); } });