Search in sources :

Example 36 with Type

use of org.ow2.proactive_grid_cloud_portal.cli.json.FieldMetaDataView.Type in project scheduling by ow2-proactive.

the class SchedulerFrontendState method jobStateUpdated.

@Override
public synchronized void jobStateUpdated(String owner, NotificationData<JobInfo> notification) {
    ClientJobState js = jobsMap.get(notification.getData().getJobId());
    synchronized (js) {
        js.update(notification.getData());
        switch(notification.getEventType()) {
            case JOB_PENDING_TO_RUNNING:
                sState.pendingToRunning(js);
                break;
            case JOB_PAUSED:
            case JOB_IN_ERROR:
            case JOB_RESUMED:
            case JOB_RESTARTED_FROM_ERROR:
            case JOB_CHANGE_PRIORITY:
            case TASK_REPLICATED:
            case TASK_SKIPPED:
                break;
            case JOB_PENDING_TO_FINISHED:
                sState.pendingToFinished(js);
                // set this job finished, user can get its result
                jobs.get(notification.getData().getJobId()).setFinished(true);
                break;
            case JOB_RUNNING_TO_FINISHED:
                sState.runningToFinished(js);
                // set this job finished, user can get its result
                jobs.get(notification.getData().getJobId()).setFinished(true);
                break;
            case JOB_REMOVE_FINISHED:
                // removing jobs from the global list : this job is no more managed
                sState.removeFinished(js);
                jobsMap.remove(js.getId());
                jobs.remove(notification.getData().getJobId());
                logger.debug("HOUSEKEEPING removed the finished job " + js.getId() + " from the SchedulerFrontEndState");
                break;
            default:
                logger.warn("**WARNING** - Unconsistent update type received from Scheduler Core : " + notification.getEventType());
                return;
        }
        dispatchJobStateUpdated(owner, notification);
        new JobEmailNotification(js, notification).checkAndSend();
    }
}
Also used : ClientJobState(org.ow2.proactive.scheduler.job.ClientJobState)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)7 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)7 File (java.io.File)6 XMLStreamException (javax.xml.stream.XMLStreamException)6 VerifierConfigurationException (org.iso_relax.verifier.VerifierConfigurationException)6 JobValidationException (org.ow2.proactive.scheduler.common.exception.JobValidationException)6 HashMap (java.util.HashMap)4 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 GET (javax.ws.rs.GET)3 FileObject (org.apache.commons.vfs2.FileObject)3 GZIP (org.jboss.resteasy.annotations.GZIP)3 Scheduler (org.ow2.proactive.scheduler.common.Scheduler)3 SchedulerEventListener (org.ow2.proactive.scheduler.common.SchedulerEventListener)3 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)3 KeyException (java.security.KeyException)2