Search in sources :

Example 1 with SubmissionClosedException

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);
    }
}
Also used : IdentifiedJob(org.ow2.proactive.scheduler.job.IdentifiedJob) UserIdentification(org.ow2.proactive.scheduler.common.job.UserIdentification) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) JobAlreadyFinishedException(org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException) SubmissionClosedException(org.ow2.proactive.scheduler.common.exception.SubmissionClosedException) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) AlreadyConnectedException(org.ow2.proactive.scheduler.common.exception.AlreadyConnectedException) UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException) IOException(java.io.IOException) SchedulerException(org.ow2.proactive.scheduler.common.exception.SchedulerException)

Example 2 with SubmissionClosedException

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);
    }
}
Also used : PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) Scheduler(org.ow2.proactive.scheduler.common.Scheduler) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) NotConnectedRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException) IOException(java.io.IOException) SubmissionClosedException(org.ow2.proactive.scheduler.common.exception.SubmissionClosedException) JobCreationRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.JobCreationRestException) PermissionRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException) FileOutputStream(java.io.FileOutputStream) SubmissionClosedRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.SubmissionClosedRestException) Job(org.ow2.proactive.scheduler.common.job.Job) File(java.io.File) JobId(org.ow2.proactive.scheduler.common.job.JobId) PrintWriter(java.io.PrintWriter) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 3 with SubmissionClosedException

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);
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) TaskStatus.statusesToString(org.ow2.proactive.scheduler.common.task.TaskStatus.statusesToString) Map(java.util.Map) HashMap(java.util.HashMap) AbstractMap(java.util.AbstractMap) URLConnection(java.net.URLConnection) KeyStoreException(java.security.KeyStoreException) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) KeyManagementException(java.security.KeyManagementException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException) IOException(java.io.IOException) SchedulerException(org.ow2.proactive.scheduler.common.exception.SchedulerException) TimeoutException(java.util.concurrent.TimeoutException) JobAlreadyFinishedException(org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException) SubmissionClosedException(org.ow2.proactive.scheduler.common.exception.SubmissionClosedException) SignalApiException(org.ow2.proactive.scheduler.signal.SignalApiException)

Example 4 with SubmissionClosedException

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);
}
Also used : CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse) KeyStoreException(java.security.KeyStoreException) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) KeyManagementException(java.security.KeyManagementException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException) IOException(java.io.IOException) SchedulerException(org.ow2.proactive.scheduler.common.exception.SchedulerException) TimeoutException(java.util.concurrent.TimeoutException) JobAlreadyFinishedException(org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException) SubmissionClosedException(org.ow2.proactive.scheduler.common.exception.SubmissionClosedException) SignalApiException(org.ow2.proactive.scheduler.signal.SignalApiException)

Example 5 with SubmissionClosedException

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);
}
Also used : HttpGet(org.apache.http.client.methods.HttpGet) TaskStatus.statusesToString(org.ow2.proactive.scheduler.common.task.TaskStatus.statusesToString)

Aggregations

JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)9 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)9 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)8 SubmissionClosedException (org.ow2.proactive.scheduler.common.exception.SubmissionClosedException)8 JobAlreadyFinishedException (org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException)6 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)6 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)6 IOException (java.io.IOException)5 SchedulerException (org.ow2.proactive.scheduler.common.exception.SchedulerException)5 SignalApiException (org.ow2.proactive.scheduler.signal.SignalApiException)4 KeyManagementException (java.security.KeyManagementException)3 KeyStoreException (java.security.KeyStoreException)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3 TimeoutException (java.util.concurrent.TimeoutException)3 Job (org.ow2.proactive.scheduler.common.job.Job)3 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 ImmediateService (org.objectweb.proactive.annotation.ImmediateService)2