use of org.ow2.proactive.scheduler.common.exception.SubmissionClosedException in project scheduling by ow2-proactive.
the class SchedulerFrontendState method jobSubmitted.
synchronized void jobSubmitted(InternalJob job, UserIdentificationImpl ident) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException {
// put the job inside the frontend management list
jobs.put(job.getId(), new IdentifiedJob(job.getId(), ident, job.getGenericInformation()));
// increase number of submit for this user
ident.addSubmit();
// send update user event
usersUpdated(new NotificationData<UserIdentification>(SchedulerEvent.USERS_UPDATE, ident));
jlogger.info(job.getId(), "submitted: name '" + job.getName() + "', tasks '" + job.getTotalNumberOfTasks() + "', owner '" + job.getOwner() + "'");
try {
jlogger.info(job.getId(), job.display());
} catch (Exception e) {
jlogger.error(job.getId(), "Error while displaying the job :", e);
}
}
use of org.ow2.proactive.scheduler.common.exception.SubmissionClosedException in project scheduling by ow2-proactive.
the class SchedulerStateRest method submitFlat.
/**
* Submit job using flat command file
*
* @param sessionId
* valid session id
* @param commandFileContent
* content of a command file: endline separated native commands
* @param jobName
* name of the job to create
* @param selectionScriptContent
* content of a selection script, or null
* @param selectionScriptExtension
* extension of the selectionscript to determine script engine
* ("js", "py", "rb")
* @return Id of the submitted job
* @throws NotConnectedRestException
* @throws IOException
* @throws JobCreationRestException
* @throws PermissionRestException
* @throws SubmissionClosedRestException
*/
@Override
@POST
@Path("submitflat")
@Produces("application/json")
public JobIdData submitFlat(@HeaderParam("sessionid") String sessionId, @FormParam("commandFileContent") String commandFileContent, @FormParam("jobName") String jobName, @FormParam("selectionScriptContent") String selectionScriptContent, @FormParam("selectionScriptExtension") String selectionScriptExtension) throws NotConnectedRestException, IOException, JobCreationRestException, PermissionRestException, SubmissionClosedRestException {
Scheduler s = checkAccess(sessionId, "submitflat");
try {
File command = File.createTempFile("flatsubmit_commands_", ".txt");
command.deleteOnExit();
String selectionPath = null;
File selection = null;
if (selectionScriptContent != null && selectionScriptContent.trim().length() > 0) {
selection = File.createTempFile("flatsubmit_selection_", "." + selectionScriptExtension);
selection.deleteOnExit();
try (PrintWriter pw = new PrintWriter(new FileOutputStream(selection))) {
pw.print(selectionScriptContent);
}
selectionPath = selection.getAbsolutePath();
}
try (PrintWriter pw = new PrintWriter(new FileOutputStream(command))) {
pw.print(commandFileContent);
}
Job j = FlatJobFactory.getFactory().createNativeJobFromCommandsFile(command.getAbsolutePath(), jobName, selectionPath, null);
JobId id = s.submit(j);
command.delete();
if (selection != null) {
selection.delete();
}
return mapper.map(id, JobIdData.class);
} catch (IOException e) {
throw new IOException("I/O Error: " + e.getMessage(), e);
} catch (JobCreationException e) {
throw new JobCreationRestException(e);
} catch (NotConnectedException e) {
throw new NotConnectedRestException(e);
} catch (SubmissionClosedException e) {
throw new SubmissionClosedRestException(e);
} catch (PermissionException e) {
throw new PermissionRestException(e);
}
}
use of org.ow2.proactive.scheduler.common.exception.SubmissionClosedException in project scheduling by ow2-proactive.
the class SchedulerClient method submit.
@Override
public JobId submit(URL job, Map<String, String> variables, Map<String, String> genericInfos, Map<String, String> requestHeaderParams) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException {
JobIdData jobIdData = null;
try {
URLConnection urlConnection = job.openConnection();
if (requestHeaderParams != null) {
for (Map.Entry<String, String> requestHeaderEntry : requestHeaderParams.entrySet()) {
urlConnection.addRequestProperty(requestHeaderEntry.getKey(), requestHeaderEntry.getValue());
}
}
InputStream is = urlConnection.getInputStream();
jobIdData = restApiClient().submitXml(sid, is, variables, genericInfos);
} catch (Exception e) {
throwNCEOrPEOrSCEOrJCE(e);
}
return jobId(jobIdData);
}
use of org.ow2.proactive.scheduler.common.exception.SubmissionClosedException in project scheduling by ow2-proactive.
the class SchedulerClient method submitFromCatalog.
private JobId submitFromCatalog(HttpGet httpGet, Map<String, String> variables, Map<String, String> genericInfos) throws SubmissionClosedException, JobCreationException, NotConnectedException, PermissionException {
JobIdData jobIdData = null;
httpGet.addHeader("sessionid", sid);
try (CloseableHttpClient httpclient = getHttpClientBuilder().build();
CloseableHttpResponse response = httpclient.execute(httpGet)) {
jobIdData = restApiClient().submitXml(sid, response.getEntity().getContent(), variables, genericInfos);
} catch (Exception e) {
throwNCEOrPEOrSCEOrJCE(e);
}
return jobId(jobIdData);
}
use of org.ow2.proactive.scheduler.common.exception.SubmissionClosedException in project scheduling by ow2-proactive.
the class SchedulerClient method submitFromCatalog.
@Override
public JobId submitFromCatalog(String catalogRestURL, String calledWorkflow, Map<String, String> variables, Map<String, String> genericInfo) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException {
Optional<String> revision = getRevisionFromCalledWorkflow(calledWorkflow);
HttpGet httpGet = new HttpGet(catalogRestURL + "/buckets/" + getBucketFromCalledWorkflow(calledWorkflow) + "/resources/" + getNameFromCalledWorkflow(calledWorkflow) + revision.map(r -> "/revisions/" + r).orElse("") + "/raw");
return this.submitFromCatalog(httpGet, variables, genericInfo);
}
Aggregations