Search in sources :

Example 1 with GetJobDefinitionUpdatedFromJobActorRequest

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

the class JobClusterActor method requireJobActorProcess.

/**
 * If the job request requires process via job actor, inform the target job actor and return true to stop further
 * processing till the job actor replies.
 * Two cases require job actor level process:
 * 1. Quick submit (no job definition given) + valid active last job id.
 * 2. Regular submit with inheritance requirement + valid active last job id.
 * @param request job submission request.
 * @return true if further processing should stop.
 */
private boolean requireJobActorProcess(final SubmitJobRequest request) {
    String user = request.getSubmitter();
    Optional<JobDefinition> givenJobDefn = request.getJobDefinition();
    List<JobInfo> existingJobsList = jobManager.getAllNonTerminalJobsList();
    Optional<JobId> lastJobId = JobListHelper.getLastSubmittedJobId(existingJobsList, Collections.emptyList());
    if (!lastJobId.isPresent()) {
        logger.info("No valid last job id found for inheritance. Skip job actor process step.");
        return false;
    }
    Optional<JobInfo> jobInfoForNonTerminalJob = jobManager.getJobInfoForNonTerminalJob(lastJobId.get());
    if (!jobInfoForNonTerminalJob.isPresent()) {
        logger.info("Last job id doesn't map to job info instance, skip job actor process. {}", lastJobId.get());
        return false;
    } else if (!givenJobDefn.isPresent()) {
        logger.info("[QuickSubmit] pass to job actor to process job definition: {}", lastJobId.get());
        jobInfoForNonTerminalJob.get().jobActor.tell(new GetJobDefinitionUpdatedFromJobActorRequest(user, lastJobId.get(), jobInfoForNonTerminalJob.get().jobDefinition, true, request.isAutoResubmit(), getSender()), getSelf());
        return true;
    } else if (givenJobDefn.get().requireInheritInstanceCheck()) {
        logger.info("[Inherit request] pass to job actor to process job definition: {}", lastJobId.get());
        jobInfoForNonTerminalJob.get().jobActor.tell(new GetJobDefinitionUpdatedFromJobActorRequest(user, lastJobId.get(), givenJobDefn.get(), false, request.isAutoResubmit(), getSender()), getSelf());
        return true;
    }
    logger.info("request doesn't require job actor process, skip job actor and continue.");
    return false;
}
Also used : GetJobDefinitionUpdatedFromJobActorRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDefinitionUpdatedFromJobActorRequest) JobDefinition(io.mantisrx.server.master.domain.JobDefinition) JobId(io.mantisrx.server.master.domain.JobId)

Aggregations

GetJobDefinitionUpdatedFromJobActorRequest (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDefinitionUpdatedFromJobActorRequest)1 JobDefinition (io.mantisrx.server.master.domain.JobDefinition)1 JobId (io.mantisrx.server.master.domain.JobId)1