use of com.hashicorp.nomad.apimodel.JobListStub in project heron by twitter.
the class NomadScheduler method getTopologyJobs.
static List<Job> getTopologyJobs(NomadApiClient apiClient, String topologyName) {
List<JobListStub> jobs = getJobList(apiClient);
List<Job> ret = new LinkedList<>();
for (JobListStub job : jobs) {
Job jobActual;
try {
jobActual = apiClient.getJobsApi().info(job.getId()).getValue();
} catch (IOException | NomadException e) {
String msg = "Failed to retrieve job info for job " + job.getId() + " part of topology " + topologyName;
LOG.log(Level.SEVERE, msg, e);
throw new RuntimeException(msg, e);
}
Map<String, String> metaData = jobActual.getMeta();
if (metaData != null && metaData.containsKey(NomadConstants.NOMAD_TOPOLOGY_NAME)) {
if (metaData.get(NomadConstants.NOMAD_TOPOLOGY_NAME).equals(topologyName)) {
ret.add(jobActual);
}
}
}
return ret;
}
use of com.hashicorp.nomad.apimodel.JobListStub in project incubator-heron by apache.
the class NomadScheduler method getTopologyJobs.
static List<Job> getTopologyJobs(NomadApiClient apiClient, String topologyName) {
List<JobListStub> jobs = getJobList(apiClient);
List<Job> ret = new LinkedList<>();
for (JobListStub job : jobs) {
Job jobActual;
try {
jobActual = apiClient.getJobsApi().info(job.getId()).getValue();
} catch (IOException | NomadException e) {
String msg = "Failed to retrieve job info for job " + job.getId() + " part of topology " + topologyName;
LOG.log(Level.SEVERE, msg, e);
throw new RuntimeException(msg, e);
}
Map<String, String> metaData = jobActual.getMeta();
if (metaData != null && metaData.containsKey(NomadConstants.NOMAD_TOPOLOGY_NAME)) {
if (metaData.get(NomadConstants.NOMAD_TOPOLOGY_NAME).equals(topologyName)) {
ret.add(jobActual);
}
}
}
return ret;
}
Aggregations