Search in sources :

Example 1 with JobHistory

use of es.bsc.compss.types.job.Job.JobHistory in project compss by bsc-wdc.

the class NIOAdaptor method receivedTaskDone.

@Override
public void receivedTaskDone(Connection c, NIOTaskResult tr, boolean successful) {
    int taskId = tr.getTaskId();
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Received Task done message for Task " + taskId);
    }
    // Update running jobs
    NIOJob nj = RUNNING_JOBS.remove(taskId);
    // Update information
    List<DataType> taskResultTypes = tr.getParamTypes();
    for (int i = 0; i < taskResultTypes.size(); ++i) {
        DataType newType = taskResultTypes.get(i);
        switch(newType) {
            case PSCO_T:
            case EXTERNAL_OBJECT_T:
                String pscoId = (String) tr.getParamValue(i);
                DependencyParameter dp = (DependencyParameter) nj.getTaskParams().getParameters()[i];
                updateParameter(newType, pscoId, dp);
                break;
            default:
                // We only update information about PSCOs or EXTERNAL_OBJECTS
                break;
        }
    }
    // Update NIO Job
    if (nj != null) {
        // Mark task as finished and release waiters
        JobHistory prevJobHistory = nj.getHistory();
        nj.taskFinished(successful);
        // Retrieve files if required
        if (WORKER_DEBUG || !successful) {
            String jobOut = JOBS_DIR + "job" + nj.getJobId() + "_" + prevJobHistory + ".out";
            String jobErr = JOBS_DIR + "job" + nj.getJobId() + "_" + prevJobHistory + ".err";
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Requesting JobOut " + jobOut + " for Task " + taskId);
                LOGGER.debug("Requesting JobErr " + jobErr + " for Task " + taskId);
            }
            c.receiveDataFile(jobOut);
            c.receiveDataFile(jobErr);
        }
    /*if (!successful) {
                String jobOut = JOBS_DIR + "job" + nj.getJobId() + "_" + newJobHistory + ".out";
                String jobErr = JOBS_DIR + "job" + nj.getJobId() + "_" + newJobHistory + ".err";
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Requesting JobOut " + jobOut + " for Task " + taskId);
                    LOGGER.debug("Requesting JobErr " + jobErr + " for Task " + taskId);
                }
                c.receiveDataFile(jobOut);
                c.receiveDataFile(jobErr);
            }*/
    }
    // Close connection
    c.finishConnection();
}
Also used : JobHistory(es.bsc.compss.types.job.Job.JobHistory) DataType(es.bsc.compss.types.annotations.parameter.DataType) DependencyParameter(es.bsc.compss.types.parameter.DependencyParameter)

Aggregations

DataType (es.bsc.compss.types.annotations.parameter.DataType)1 JobHistory (es.bsc.compss.types.job.Job.JobHistory)1 DependencyParameter (es.bsc.compss.types.parameter.DependencyParameter)1