use of com.hashicorp.nomad.javasdk.NomadException 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