use of io.mantisrx.master.api.akka.route.proto.JobClusterProtoAdapter.JobIdInfo in project mantis by Netflix.
the class JobClusterActor method onJobIdList.
@Override
public void onJobIdList(final ListJobIdsRequest request) {
if (logger.isTraceEnabled()) {
logger.trace("Entering JCA:onJobIdList");
}
final ActorRef sender = getSender();
Set<JobId> jobIdsFilteredByLabelsSet = new HashSet<>();
// If labels criterion is given prefilter by labels
if (!request.getCriteria().getMatchingLabels().isEmpty()) {
jobIdsFilteredByLabelsSet = jobManager.getJobsMatchingLabels(request.getCriteria().getMatchingLabels(), request.getCriteria().getLabelsOperand());
// Found no matching jobs for given labels exit
if (jobIdsFilteredByLabelsSet.isEmpty()) {
sender.tell(new ListJobIdsResponse(request.requestId, SUCCESS, "No JobIds match given Label criterion", new ArrayList<>()), sender);
if (logger.isTraceEnabled()) {
logger.trace("Exit JCA:onJobIdList");
}
return;
}
}
// Found jobs matching labels or no labels criterion given.
List<JobIdInfo> jobIdList;
// Apply additional filtering to non terminal jobs
jobIdList = getFilteredNonTerminalJobIdList(request.filters, jobIdsFilteredByLabelsSet);
if (!request.getCriteria().getActiveOnly().orElse(true)) {
jobIdList.addAll(getFilteredTerminalJobIdList(request.filters, jobIdsFilteredByLabelsSet));
}
sender.tell(new ListJobIdsResponse(request.requestId, SUCCESS, "", jobIdList), sender);
if (logger.isTraceEnabled()) {
logger.trace("Exit JCA:onJobIdList");
}
}
Aggregations