use of com.hashicorp.nomad.javasdk.EvaluationResponse in project incubator-heron by apache.
the class NomadScheduler method startJobs.
static void startJobs(NomadApiClient apiClient, Job... jobs) {
for (Job job : jobs) {
LOG.fine("Starting job " + job.getId());
LOG.fine("Job spec: " + job.toString());
try {
EvaluationResponse response = apiClient.getJobsApi().register(job);
LOG.fine("response: " + response);
} catch (IOException | NomadException e) {
String msg = "Failed to submit job " + job.getId() + " with error: " + e.getMessage();
LOG.log(Level.FINE, msg + " with job spec: " + job.toString());
throw new RuntimeException(msg, e);
}
}
}
use of com.hashicorp.nomad.javasdk.EvaluationResponse in project heron by twitter.
the class NomadScheduler method startJobs.
static void startJobs(NomadApiClient apiClient, Job... jobs) {
for (Job job : jobs) {
LOG.fine("Starting job " + job.getId());
LOG.fine("Job spec: " + job.toString());
try {
EvaluationResponse response = apiClient.getJobsApi().register(job);
LOG.fine("response: " + response);
} catch (IOException | NomadException e) {
String msg = "Failed to submit job " + job.getId() + " with error: " + e.getMessage();
LOG.log(Level.FINE, msg + " with job spec: " + job.toString());
throw new RuntimeException(msg, e);
}
}
}
use of com.hashicorp.nomad.javasdk.EvaluationResponse in project twister2 by DSC-SPIDAL.
the class NomadController method start.
@Override
public boolean start(JobAPI.Job job) {
String uri = NomadContext.nomadSchedulerUri(config);
NomadApiClient nomadApiClient = new NomadApiClient(new NomadApiConfiguration.Builder().setAddress(uri).build());
Job nomadJob = getJob(job);
try {
EvaluationResponse response = nomadApiClient.getJobsApi().register(nomadJob);
LOG.log(Level.INFO, "Submitted job to nomad: " + response);
} catch (IOException | NomadException e) {
LOG.log(Level.SEVERE, "Failed to submit the job: ", e);
} finally {
closeClient(nomadApiClient);
}
return false;
}
Aggregations