Search in sources :

Example 6 with ImmediateService

use of org.objectweb.proactive.annotation.ImmediateService in project scheduling by ow2-proactive.

the class RMProxyActiveObject method cleanCallBack.

/**
 * Called when a script has returned (call is made as an active object call)
 * <p>
 * Check the nodes to release and release the one that have to (clean script has returned)
 * Take care when renaming this method, method name is linked to
 * {@link #handleCleaningScript(NodeSet, Script, VariablesMap, Map, TaskId, Credentials)}
 */
@ImmediateService
public synchronized void cleanCallBack(Future<ScriptResult<?>> future, NodeSet nodes) {
    String nodeUrl = nodes.get(0).getNodeInformation().getURL();
    ScriptResult<?> sResult = null;
    TaskId taskId = nodesTaskId.get(nodes);
    try {
        sResult = future.get();
    } catch (Exception e) {
        logger.error("Exception occurred while executing cleaning script on node " + nodeUrl + ":", e);
    }
    printCleaningScriptInformations(nodes, sResult, taskId);
    releaseNodes(nodes);
}
Also used : TaskId(org.ow2.proactive.scheduler.common.task.TaskId) LoginException(javax.security.auth.login.LoginException) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Example 7 with ImmediateService

use of org.objectweb.proactive.annotation.ImmediateService in project scheduling by ow2-proactive.

the class SchedulerFrontend method getJobServerLogs.

@Override
@ImmediateService
public String getJobServerLogs(String jobId) throws UnknownJobException, NotConnectedException, PermissionException {
    JobId id = JobIdImpl.makeJobId(jobId);
    frontendState.checkPermissions("getJobServerLogs", frontendState.getIdentifiedJob(id), YOU_DO_NOT_HAVE_PERMISSIONS_TO_GET_THE_LOGS_OF_THIS_JOB);
    return ServerJobAndTaskLogs.getJobLog(JobIdImpl.makeJobId(jobId), frontendState.getJobTasks(id));
}
Also used : JobId(org.ow2.proactive.scheduler.common.job.JobId) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Example 8 with ImmediateService

use of org.objectweb.proactive.annotation.ImmediateService in project scheduling by ow2-proactive.

the class SchedulerFrontend method getTaskResultsByTag.

@Override
@ImmediateService
public List<TaskResult> getTaskResultsByTag(JobId jobId, String taskTag) throws NotConnectedException, UnknownJobException, PermissionException {
    frontendState.checkPermission("getTaskResultByTag", YOU_DO_NOT_HAVE_PERMISSION_TO_GET_THE_TASK_RESULT_OF_THIS_JOB);
    List<TaskState> taskStates = getJobState(jobId).getTasksByTag(taskTag);
    ArrayList<TaskResult> results = new ArrayList<TaskResult>(taskStates.size());
    for (TaskState currentState : taskStates) {
        String taskName = currentState.getTaskInfo().getName();
        try {
            TaskResult currentResult = getTaskResult(jobId, taskName);
            results.add(currentResult);
        } catch (UnknownTaskException ex) {
            // never occurs because tasks are filtered by tag so they cannot
            // be unknown.
            logger.warn("Unknown task.", ex);
        }
    }
    return results;
}
Also used : UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException) ArrayList(java.util.ArrayList) TaskResult(org.ow2.proactive.scheduler.common.task.TaskResult) TaskState(org.ow2.proactive.scheduler.common.task.TaskState) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Example 9 with ImmediateService

use of org.objectweb.proactive.annotation.ImmediateService in project scheduling by ow2-proactive.

the class SchedulerFrontend method getJobResult.

/**
 * {@inheritDoc}
 */
@Override
@ImmediateService
public JobResult getJobResult(final JobId jobId) throws NotConnectedException, PermissionException, UnknownJobException {
    // checking permissions
    IdentifiedJob ij = frontendState.getIdentifiedJob(jobId);
    frontendState.checkPermissions("getJobResult", ij, YOU_DO_NOT_HAVE_PERMISSION_TO_GET_THE_RESULT_OF_THIS_JOB);
    if (!ij.isFinished()) {
        jlogger.info(jobId, "is not finished");
        jlogger.info(jobId, "Job state: " + frontendState.getJobState(jobId).getStatus());
        return null;
    }
    jlogger.info(jobId, "trying to get the job result");
    JobResult result = dbManager.loadJobResult(jobId);
    if (result == null) {
        throw new UnknownJobException(jobId);
    }
    if (!result.getJobInfo().isToBeRemoved() && SCHEDULER_REMOVED_JOB_DELAY > 0) {
        // remember that this job is to be removed
        dbManager.jobSetToBeRemoved(jobId);
        schedulingService.scheduleJobRemove(jobId, System.currentTimeMillis() + SCHEDULER_REMOVED_JOB_DELAY);
        jlogger.info(jobId, "will be removed in " + (SCHEDULER_REMOVED_JOB_DELAY / 1000) + "sec");
    }
    return result;
}
Also used : JobResult(org.ow2.proactive.scheduler.common.job.JobResult) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) IdentifiedJob(org.ow2.proactive.scheduler.job.IdentifiedJob) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Example 10 with ImmediateService

use of org.objectweb.proactive.annotation.ImmediateService in project scheduling by ow2-proactive.

the class SchedulerFrontend method restartInErrorTask.

/**
 * {@inheritDoc}
 */
@Override
@ImmediateService
public boolean restartInErrorTask(String jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException {
    // checking permissions
    final JobId jobIdObject = JobIdImpl.makeJobId(jobId);
    frontendState.checkPermissions("restartTaskOnError", frontendState.getIdentifiedJob(jobIdObject), YOU_DO_NOT_HAVE_PERMISSION_TO_RESTART_THIS_TASK);
    return schedulingService.restartInErrorTask(jobIdObject, taskName);
}
Also used : JobId(org.ow2.proactive.scheduler.common.job.JobId) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Aggregations

ImmediateService (org.objectweb.proactive.annotation.ImmediateService)12 JobId (org.ow2.proactive.scheduler.common.job.JobId)5 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)4 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)3 TaskState (org.ow2.proactive.scheduler.common.task.TaskState)3 DatabaseManagerException (org.ow2.proactive.db.DatabaseManagerException)2 TaskCouldNotRestartException (org.ow2.proactive.scheduler.common.exception.TaskCouldNotRestartException)2 TaskCouldNotStartException (org.ow2.proactive.scheduler.common.exception.TaskCouldNotStartException)2 TaskSkippedException (org.ow2.proactive.scheduler.common.exception.TaskSkippedException)2 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)2 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)2 UserIdentificationImpl (org.ow2.proactive.scheduler.job.UserIdentificationImpl)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 KeyException (java.security.KeyException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LoginException (javax.security.auth.login.LoginException)1 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)1 AlreadyConnectedException (org.ow2.proactive.scheduler.common.exception.AlreadyConnectedException)1 JobAlreadyFinishedException (org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException)1