Search in sources :

Example 6 with RequestID

use of edu.iu.dsc.tws.api.net.request.RequestID in project twister2 by DSC-SPIDAL.

the class JMDriverAgent method sendToDriver.

@Override
public boolean sendToDriver(Message message) {
    JobMasterAPI.WorkerMessage workerMessage = JobMasterAPI.WorkerMessage.newBuilder().setData(Any.pack(message).toByteString()).setWorkerID(workerID).build();
    RequestID requestID = rrClient.sendRequest(workerMessage);
    if (requestID == null) {
        LOG.severe("Could not send WorkerToDriver message.");
        return false;
    }
    LOG.fine("Sent WorkerToDriver message: \n" + workerMessage);
    return true;
}
Also used : JobMasterAPI(edu.iu.dsc.tws.proto.jobmaster.JobMasterAPI) RequestID(edu.iu.dsc.tws.api.net.request.RequestID)

Example 7 with RequestID

use of edu.iu.dsc.tws.api.net.request.RequestID in project twister2 by DSC-SPIDAL.

the class JMWorkerHandler method sendListWorkersResponseToWaitList.

private void sendListWorkersResponseToWaitList() {
    List<JobMasterAPI.WorkerInfo> workerList = workerMonitor.getWorkerInfoList();
    JobMasterAPI.ListWorkersResponse response = JobMasterAPI.ListWorkersResponse.newBuilder().setNumberOfWorkers(workerList.size()).addAllWorker(workerList).build();
    for (RequestID requestID : waitList) {
        rrServer.sendResponse(requestID, response);
    }
    waitList.clear();
}
Also used : JobMasterAPI(edu.iu.dsc.tws.proto.jobmaster.JobMasterAPI) RequestID(edu.iu.dsc.tws.api.net.request.RequestID)

Example 8 with RequestID

use of edu.iu.dsc.tws.api.net.request.RequestID in project twister2 by DSC-SPIDAL.

the class FamilyInitHandler method scheduleResponse.

public boolean scheduleResponse(int workerId, RequestID requestID) {
    if (this.pause) {
        LOG.info("Handler is in paused mode, due to cluster instability. " + "Ignored a request from " + workerId);
        this.sendRejectedResponse(requestID);
        return false;
    }
    RequestID previousRequest = this.pendingResponses.put(workerId, requestID);
    if (previousRequest != null) {
        LOG.warning("Duplicate request received for " + this.family + " from worker : " + workerId + ". Workers might be coming after a failure.");
    }
    if (this.pendingResponses.size() == count) {
        for (RequestID pendingRespons : this.pendingResponses.values()) {
            this.rrServer.sendResponse(pendingRespons, Checkpoint.FamilyInitializeResponse.newBuilder().setFamily(this.family).setVersion(this.familyVersion).build());
        }
        this.pendingResponses.clear();
        return true;
    } else {
        return false;
    }
}
Also used : RequestID(edu.iu.dsc.tws.api.net.request.RequestID)

Aggregations

RequestID (edu.iu.dsc.tws.api.net.request.RequestID)8 JobMasterAPI (edu.iu.dsc.tws.proto.jobmaster.JobMasterAPI)3 BlockingSendException (edu.iu.dsc.tws.api.exceptions.net.BlockingSendException)2 TCPMessage (edu.iu.dsc.tws.common.net.tcp.TCPMessage)2 Message (com.google.protobuf.Message)1 Tuple (edu.iu.dsc.tws.api.comms.structs.Tuple)1 JobFaultyException (edu.iu.dsc.tws.api.exceptions.JobFaultyException)1 TimeoutException (edu.iu.dsc.tws.api.exceptions.TimeoutException)1 ByteBuffer (java.nio.ByteBuffer)1 SocketChannel (java.nio.channels.SocketChannel)1