Search in sources :

Example 1 with GetLatestJobDiscoveryInfoResponse

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

the class JobActor method onGetLatestJobDiscoveryInfo.

@Override
public void onGetLatestJobDiscoveryInfo(GetLatestJobDiscoveryInfoRequest r) {
    LOGGER.trace("Entering onGetLatestJobDiscoveryInfo {}", r);
    ActorRef sender = getSender();
    if (r.getJobCluster().equals(this.jobId.getCluster())) {
        JobSchedulingInfo schedulingInfo = workerManager.getJobStatusSubject().getValue();
        if (schedulingInfo != null) {
            sender.tell(new GetLatestJobDiscoveryInfoResponse(r.requestId, SUCCESS, "", ofNullable(schedulingInfo)), getSelf());
        } else {
            LOGGER.info("discoveryInfo from BehaviorSubject is null {}", jobId);
            sender.tell(new GetLatestJobDiscoveryInfoResponse(r.requestId, SERVER_ERROR, "discoveryInfo from BehaviorSubject is null " + jobId, empty()), getSelf());
        }
    } else {
        String msg = "JobCluster in the request " + r.getJobCluster() + " does not match Job Actors job ID " + this.jobId;
        LOGGER.warn(msg);
        sender.tell(new GetLatestJobDiscoveryInfoResponse(r.requestId, SERVER_ERROR, msg, empty()), getSelf());
    }
}
Also used : ActorRef(akka.actor.ActorRef) JobSchedulingInfo(io.mantisrx.server.core.JobSchedulingInfo) GetLatestJobDiscoveryInfoResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLatestJobDiscoveryInfoResponse)

Example 2 with GetLatestJobDiscoveryInfoResponse

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

the class JobClustersManagerActor method onGetLatestJobDiscoveryInfo.

@Override
public void onGetLatestJobDiscoveryInfo(GetLatestJobDiscoveryInfoRequest request) {
    Optional<JobClusterInfo> jobClusterInfo = jobClusterInfoManager.getJobClusterInfo(request.getJobCluster());
    ActorRef sender = getSender();
    if (jobClusterInfo.isPresent()) {
        jobClusterInfo.get().jobClusterActor.forward(request, getContext());
    } else {
        sender.tell(new GetLatestJobDiscoveryInfoResponse(request.requestId, CLIENT_ERROR_NOT_FOUND, "JobCluster " + request.getJobCluster() + " doesn't exist", Optional.empty()), getSelf());
    }
}
Also used : ActorRef(akka.actor.ActorRef) GetLatestJobDiscoveryInfoResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLatestJobDiscoveryInfoResponse)

Example 3 with GetLatestJobDiscoveryInfoResponse

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

the class JobClusterActor method onGetLatestJobDiscoveryInfo.

@Override
public void onGetLatestJobDiscoveryInfo(JobClusterManagerProto.GetLatestJobDiscoveryInfoRequest request) {
    if (logger.isTraceEnabled()) {
        logger.trace("Enter onGetLatestJobDiscoveryInfo {}", request);
    }
    ActorRef sender = getSender();
    if (this.name.equals(request.getJobCluster())) {
        JobId latestJobId = jobIdSubmissionSubject.getValue();
        logger.debug("[{}] latest job Id for cluster: {}", name, latestJobId);
        if (latestJobId != null) {
            Optional<JobInfo> jInfo = jobManager.getJobInfoForNonTerminalJob(latestJobId);
            if (jInfo.isPresent()) {
                // ask job actor for discovery info
                jInfo.get().jobActor.forward(request, getContext());
            } else {
                logger.info("job info not found for job ID when looking up discovery info: {}", latestJobId);
                sender.tell(new GetLatestJobDiscoveryInfoResponse(request.requestId, SERVER_ERROR, "JobInfo not found when looking up discovery info for " + latestJobId, empty()), getSelf());
            }
        } else {
            // no latest job ID found for this job cluster
            logger.debug("no latest Job ID found for job cluster {}", name);
            sender.tell(new GetLatestJobDiscoveryInfoResponse(request.requestId, CLIENT_ERROR_NOT_FOUND, "No latest jobId found for job cluster " + name, empty()), getSelf());
        }
    } else {
        String msg = "Job Cluster " + request.getJobCluster() + " In request does not match the name of this actor " + this.name;
        logger.warn(msg);
        sender.tell(new JobClusterManagerProto.GetLatestJobDiscoveryInfoResponse(request.requestId, SERVER_ERROR, msg, empty()), getSelf());
    }
    if (logger.isTraceEnabled()) {
        logger.trace("Exit onGetLatestJobDiscoveryInfo {}", request);
    }
}
Also used : GetLatestJobDiscoveryInfoResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLatestJobDiscoveryInfoResponse) ActorRef(akka.actor.ActorRef) GetLatestJobDiscoveryInfoResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLatestJobDiscoveryInfoResponse) JobId(io.mantisrx.server.master.domain.JobId) JobClusterManagerProto(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto)

Aggregations

ActorRef (akka.actor.ActorRef)3 GetLatestJobDiscoveryInfoResponse (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLatestJobDiscoveryInfoResponse)3 JobClusterManagerProto (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto)1 JobSchedulingInfo (io.mantisrx.server.core.JobSchedulingInfo)1 JobId (io.mantisrx.server.master.domain.JobId)1