Search in sources :

Example 1 with TransferringTask

use of es.bsc.compss.nio.dataRequest.WorkerDataRequest.TransferringTask in project compss by bsc-wdc.

the class NIOWorker method receivedNewTask.

@Override
public void receivedNewTask(NIONode master, NIOTask task, List<String> obsoleteFiles) {
    WORKER_LOGGER.info("Received Job " + task);
    if (NIOTracer.isActivated()) {
        NIOTracer.emitEvent(NIOTracer.Event.WORKER_RECEIVED_NEW_TASK.getId(), NIOTracer.Event.WORKER_RECEIVED_NEW_TASK.getType());
    }
    // Remove obsolete
    if (obsoleteFiles != null) {
        removeObsolete(obsoleteFiles);
    }
    // Demand files
    WORKER_LOGGER.info("Checking parameters");
    TransferringTask tt = new TransferringTask(task);
    int i = 0;
    for (NIOParam param : task.getParams()) {
        i++;
        if (param.getData() != null) {
            // Parameter has associated data
            WORKER_LOGGER.debug("- Checking transfers for data of parameter " + (String) param.getValue());
            switch(param.getType()) {
                case OBJECT_T:
                    askForObject(param, i, tt);
                    break;
                case PSCO_T:
                    askForPSCO(param);
                    break;
                case EXTERNAL_OBJECT_T:
                    // Nothing to do since external parameters send their ID directly
                    break;
                case FILE_T:
                    askForFile(param, i, tt);
                    break;
                default:
                    // In any case, there is nothing to do for these type of parameters
                    break;
            }
        } else {
            // OUT parameter. Has no associated data. Decrease the parameter counter (we already have it)
            tt.decreaseParams();
        }
    }
    // Request the transfers
    if (NIOTracer.isActivated()) {
        NIOTracer.emitEvent(tt.getTask().getTaskId(), NIOTracer.getTaskTransfersType());
    }
    requestTransfers();
    if (NIOTracer.isActivated()) {
        NIOTracer.emitEvent(NIOTracer.EVENT_END, NIOTracer.getTaskTransfersType());
    }
    if (tt.getParams() == 0) {
        executeTask(tt.getTask());
    }
    if (NIOTracer.isActivated()) {
        NIOTracer.emitEvent(NIOTracer.EVENT_END, NIOTracer.Event.WORKER_RECEIVED_NEW_TASK.getType());
    }
}
Also used : TransferringTask(es.bsc.compss.nio.dataRequest.WorkerDataRequest.TransferringTask) NIOParam(es.bsc.compss.nio.NIOParam)

Aggregations

NIOParam (es.bsc.compss.nio.NIOParam)1 TransferringTask (es.bsc.compss.nio.dataRequest.WorkerDataRequest.TransferringTask)1