Search in sources :

Example 1 with NIOTask

use of es.bsc.compss.nio.NIOTask in project compss by bsc-wdc.

the class NIOJob method prepareJob.

public NIOTask prepareJob() {
    AbstractMethodImplementation absMethodImpl = (AbstractMethodImplementation) this.impl;
    // This is a workarround for Python
    if (absMethodImpl.getMethodType().equals(MethodType.METHOD)) {
        MethodImplementation mImpl = (MethodImplementation) absMethodImpl;
        String methodName = mImpl.getAlternativeMethodName();
        if (methodName == null || methodName.isEmpty()) {
            mImpl.setAlternativeMethodName(taskParams.getName());
        }
    }
    boolean hasTarget = taskParams.hasTargetObject();
    boolean hasReturn = taskParams.hasReturnValue();
    LinkedList<NIOParam> params = addParams();
    MethodResourceDescription reqs = absMethodImpl.getRequirements();
    int numParams = params.size();
    if (taskParams.hasReturnValue()) {
        numParams--;
    }
    // Create NIOTask
    NIOTask nt = new NIOTask(LANG, debug, absMethodImpl, hasTarget, hasReturn, params, numParams, reqs, this.slaveWorkersNodeNames, this.taskId, this.taskParams.getId(), this.jobId, this.history, this.transferId);
    return nt;
}
Also used : AbstractMethodImplementation(es.bsc.compss.types.implementations.AbstractMethodImplementation) MethodImplementation(es.bsc.compss.types.implementations.MethodImplementation) AbstractMethodImplementation(es.bsc.compss.types.implementations.AbstractMethodImplementation) NIOTask(es.bsc.compss.nio.NIOTask) MethodResourceDescription(es.bsc.compss.types.resources.MethodResourceDescription) NIOParam(es.bsc.compss.nio.NIOParam)

Example 2 with NIOTask

use of es.bsc.compss.nio.NIOTask in project compss by bsc-wdc.

the class NIOWorkerNode method submitTask.

public void submitTask(NIOJob job, List<String> obsolete) throws UnstartedNodeException {
    if (node == null) {
        throw new UnstartedNodeException();
    }
    NIOTask t = job.prepareJob();
    CommandNewTask cmd = new CommandNewTask(t, obsolete);
    Connection c = NIOAgent.getTransferManager().startConnection(node);
    c.sendCommand(cmd);
    c.finishConnection();
}
Also used : NIOTask(es.bsc.compss.nio.NIOTask) UnstartedNodeException(es.bsc.compss.exceptions.UnstartedNodeException) Connection(es.bsc.comm.Connection) CommandNewTask(es.bsc.compss.nio.commands.CommandNewTask)

Example 3 with NIOTask

use of es.bsc.compss.nio.NIOTask in project compss by bsc-wdc.

the class Executor method processRequests.

private void processRequests() {
    NIOTask nt;
    while (true) {
        // Get tasks until there are no more tasks pending
        nt = queue.dequeue();
        if (nt == null) {
            LOGGER.debug("Dequeued job is null");
            break;
        }
        if (WORKER_DEBUG) {
            LOGGER.debug("Dequeuing job " + nt.getJobId());
        }
        boolean success = executeTask(nt);
        if (WORKER_DEBUG) {
            LOGGER.debug("Job " + nt.getJobId() + " finished (success: " + success + ")");
        }
        nw.sendTaskDone(nt, success);
    }
}
Also used : NIOTask(es.bsc.compss.nio.NIOTask)

Aggregations

NIOTask (es.bsc.compss.nio.NIOTask)3 Connection (es.bsc.comm.Connection)1 UnstartedNodeException (es.bsc.compss.exceptions.UnstartedNodeException)1 NIOParam (es.bsc.compss.nio.NIOParam)1 CommandNewTask (es.bsc.compss.nio.commands.CommandNewTask)1 AbstractMethodImplementation (es.bsc.compss.types.implementations.AbstractMethodImplementation)1 MethodImplementation (es.bsc.compss.types.implementations.MethodImplementation)1 MethodResourceDescription (es.bsc.compss.types.resources.MethodResourceDescription)1