Search in sources :

Example 1 with ListWorkersResponse

use of io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListWorkersResponse in project mantis by Netflix.

the class JobActor method onListActiveWorkers.

/**
 * Responds with {@link ListWorkersResponse} object containing data about all active workers.
 *
 * @param listWorkersRequest
 */
public void onListActiveWorkers(ListWorkersRequest listWorkersRequest) {
    ActorRef sender = getSender();
    List<IMantisWorkerMetadata> activeWorkers = this.workerManager.getActiveWorkers(listWorkersRequest.getLimit());
    sender.tell(new ListWorkersResponse(listWorkersRequest.requestId, SUCCESS, "", Collections.unmodifiableList(activeWorkers)), getSelf());
}
Also used : ActorRef(akka.actor.ActorRef) IMantisWorkerMetadata(io.mantisrx.master.jobcluster.job.worker.IMantisWorkerMetadata) ListWorkersResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListWorkersResponse)

Example 2 with ListWorkersResponse

use of io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListWorkersResponse in project mantis by Netflix.

the class JobClusterActor method onListActiveWorkers.

public void onListActiveWorkers(final ListWorkersRequest r) {
    if (logger.isTraceEnabled()) {
        logger.trace("Enter JobClusterActor:onListActiveWorkers {}", r);
    }
    Optional<JobInfo> jobInfo = jobManager.getJobInfoForNonTerminalJob(r.getJobId());
    if (jobInfo.isPresent()) {
        jobInfo.get().jobActor.forward(r, getContext());
    } else {
        logger.warn("No such active job {} ", r.getJobId());
        getSender().tell(new ListWorkersResponse(r.requestId, CLIENT_ERROR, "No such active job " + r.getJobId(), Lists.newArrayList()), getSelf());
    }
    if (logger.isTraceEnabled()) {
        logger.trace("Exit JobClusterActor:onListActiveWorkers {}", r);
    }
}
Also used : ListWorkersResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListWorkersResponse)

Aggregations

ListWorkersResponse (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListWorkersResponse)2 ActorRef (akka.actor.ActorRef)1 IMantisWorkerMetadata (io.mantisrx.master.jobcluster.job.worker.IMantisWorkerMetadata)1