Search in sources :

Example 6 with Connection

use of es.bsc.comm.Connection in project compss by bsc-wdc.

the class NIOWorker method tryNofiyDataReceived.

private boolean tryNofiyDataReceived(CommandDataReceived cdr) {
    Connection c = TM.startConnection(masterNode);
    c.sendCommand(cdr);
    c.finishConnection();
    return true;
}
Also used : Connection(es.bsc.comm.Connection)

Example 7 with Connection

use of es.bsc.comm.Connection in project compss by bsc-wdc.

the class NIOAgent method requestTransfers.

/**
 * Check if receive slots available
 */
public void requestTransfers() {
    DataRequest dr = null;
    synchronized (pendingRequests) {
        if (!pendingRequests.isEmpty() && tryAcquireReceiveSlot()) {
            dr = pendingRequests.remove();
        }
    }
    while (dr != null) {
        Data source = dr.getSource();
        NIOURI uri = source.getFirstURI();
        if (NIOTracer.isActivated()) {
            NIOTracer.emitDataTransferEvent(source.getName());
        }
        NIONode nn = uri.getHost();
        if (nn.getIp() == null) {
            nn = masterNode;
        }
        Connection c = null;
        try {
            c = TM.startConnection(nn);
            LOGGER.debug("Connection " + c.hashCode() + " will be used to acquire data " + dr.getTarget() + " stored in " + nn + " with name " + dr.getSource().getName());
            Data remoteData = new Data(source.getName(), uri);
            CommandDataDemand cdd = new CommandDataDemand(this, remoteData, tracingID);
            ongoingTransfers.put(c, dr.getSource().getName());
            c.sendCommand(cdd);
            if (NIOTracer.isActivated()) {
                c.receive();
            }
            if (dr.getType() == DataType.FILE_T) {
                c.receiveDataFile(dr.getTarget());
            } else {
                c.receiveDataObject();
            }
        } catch (Exception e) {
            e.printStackTrace(System.err);
        } finally {
            if (c != null) {
                c.finishConnection();
            }
        }
        synchronized (pendingRequests) {
            if (!pendingRequests.isEmpty() && tryAcquireReceiveSlot()) {
                dr = pendingRequests.remove();
            } else {
                dr = null;
            }
        }
        if (NIOTracer.isActivated()) {
            NIOTracer.emitDataTransferEvent(NIOTracer.TRANSFER_END);
        }
    }
}
Also used : NIONode(es.bsc.comm.nio.NIONode) CommandDataDemand(es.bsc.compss.nio.commands.CommandDataDemand) Connection(es.bsc.comm.Connection) DataRequest(es.bsc.compss.nio.dataRequest.DataRequest) Data(es.bsc.compss.nio.commands.Data) SerializedObjectException(es.bsc.compss.nio.exceptions.SerializedObjectException) IOException(java.io.IOException)

Example 8 with Connection

use of es.bsc.comm.Connection 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 9 with Connection

use of es.bsc.comm.Connection in project compss by bsc-wdc.

the class NIOWorkerNode method generatePackage.

@Override
public boolean generatePackage() {
    if (started) {
        LOGGER.debug("Sending command to generated tracing package for " + this.getHost());
        if (node == null) {
            LOGGER.error("ERROR: Package generation for " + this.getHost() + " has failed.");
            return false;
        } else {
            Connection c = NIOAgent.getTransferManager().startConnection(node);
            CommandGeneratePackage cmd = new CommandGeneratePackage();
            c.sendCommand(cmd);
            c.receive();
            c.finishConnection();
            commManager.waitUntilTracingPackageGenerated();
            LOGGER.debug("Tracing Package generated");
            return true;
        }
    } else {
        LOGGER.debug("Worker " + this.getHost() + " not started. No tracing package generated");
        return false;
    }
}
Also used : CommandGeneratePackage(es.bsc.compss.nio.commands.tracing.CommandGeneratePackage) Connection(es.bsc.comm.Connection)

Aggregations

Connection (es.bsc.comm.Connection)9 UnstartedNodeException (es.bsc.compss.exceptions.UnstartedNodeException)3 SerializedObjectException (es.bsc.compss.nio.exceptions.SerializedObjectException)2 IOException (java.io.IOException)2 CommException (es.bsc.comm.exceptions.CommException)1 NIONode (es.bsc.comm.nio.NIONode)1 NIOTask (es.bsc.compss.nio.NIOTask)1 NIOTaskResult (es.bsc.compss.nio.NIOTaskResult)1 CommandCheckWorker (es.bsc.compss.nio.commands.CommandCheckWorker)1 CommandDataDemand (es.bsc.compss.nio.commands.CommandDataDemand)1 CommandExecutorShutdown (es.bsc.compss.nio.commands.CommandExecutorShutdown)1 CommandNewTask (es.bsc.compss.nio.commands.CommandNewTask)1 CommandShutdown (es.bsc.compss.nio.commands.CommandShutdown)1 CommandTaskDone (es.bsc.compss.nio.commands.CommandTaskDone)1 Data (es.bsc.compss.nio.commands.Data)1 CommandGeneratePackage (es.bsc.compss.nio.commands.tracing.CommandGeneratePackage)1 CommandGenerateWorkerDebugFiles (es.bsc.compss.nio.commands.workerFiles.CommandGenerateWorkerDebugFiles)1 DataRequest (es.bsc.compss.nio.dataRequest.DataRequest)1 InitializationException (es.bsc.compss.nio.worker.exceptions.InitializationException)1 InvalidMapException (es.bsc.compss.nio.worker.exceptions.InvalidMapException)1