Search in sources :

Example 1 with MantisJobMetadataView

use of io.mantisrx.master.jobcluster.job.MantisJobMetadataView in project mantis by Netflix.

the class JobRouteTest method testJobClusterGetJobsList.

@Test(dependsOnMethods = { "testJobClusterGetJobIds" })
public void testJobClusterGetJobsList() throws InterruptedException {
    final CountDownLatch latch = new CountDownLatch(1);
    final CompletionStage<HttpResponse> responseFuture = http.singleRequest(HttpRequest.GET(jobAPIEndpoint("list")));
    responseFuture.thenCompose(r -> processRespFut(r, Optional.of(200))).whenComplete((msg, t) -> {
        String responseMessage = getResponseMessage(msg, t);
        logger.info("got response---> {}", responseMessage);
        List<MantisJobMetadataView> jobInfos = Collections.emptyList();
        try {
            jobInfos = Jackson.fromJSON(responseMessage, new TypeReference<List<MantisJobMetadataView>>() {
            });
        } catch (IOException e) {
            logger.error("failed to deser json {}", responseMessage, e);
            fail("job list deser failed");
        }
        logger.info("jobInfos---> {}", jobInfos);
        assertEquals(1, jobInfos.size());
        MantisJobMetadataView mjm = jobInfos.get(0);
        assertEquals(mjm.getJobMetadata().getJobId(), "sine-function-1");
        assertEquals(mjm.getJobMetadata().getName(), "sine-function");
        assertTrue(mjm.getStageMetadataList().size() > 0);
        MantisStageMetadataWritable msm = mjm.getStageMetadataList().get(0);
        assertEquals(1, msm.getNumWorkers());
        assertTrue(mjm.getWorkerMetadataList().size() > 0);
        MantisWorkerMetadataWritable mwm = mjm.getWorkerMetadataList().get(0);
        assertEquals("sine-function-1", mwm.getJobId());
        assertEquals(false, mwm.getCluster().isPresent());
        latch.countDown();
    });
    assertTrue(latch.await(2, TimeUnit.SECONDS));
}
Also used : JobStatusStreamRoute(io.mantisrx.master.api.akka.route.v1.JobStatusStreamRoute) TestHelpers(com.netflix.mantis.master.scheduler.TestHelpers) MantisJobDurationType(io.mantisrx.runtime.MantisJobDurationType) MantisJobState(io.mantisrx.runtime.MantisJobState) MasterDescription(io.mantisrx.server.core.master.MasterDescription) JobRouteHandler(io.mantisrx.master.api.akka.route.handlers.JobRouteHandler) TypeReference(io.mantisrx.shaded.com.fasterxml.jackson.core.type.TypeReference) LoggerFactory(org.slf4j.LoggerFactory) TimeoutException(java.util.concurrent.TimeoutException) MantisJobStore(io.mantisrx.server.master.persistence.MantisJobStore) Test(org.testng.annotations.Test) MantisScheduler(io.mantisrx.server.master.scheduler.MantisScheduler) JobsRoute(io.mantisrx.master.api.akka.route.v1.JobsRoute) MantisStageMetadataWritable(io.mantisrx.server.master.store.MantisStageMetadataWritable) JobClustersManagerActor(io.mantisrx.master.JobClustersManagerActor) JobPayloads(io.mantisrx.master.api.akka.payloads.JobPayloads) ActorMaterializer(akka.stream.ActorMaterializer) ActorRef(akka.actor.ActorRef) MantisMasterRoute(io.mantisrx.master.api.akka.route.MantisMasterRoute) Duration(java.time.Duration) Map(java.util.Map) JobClusterProtoAdapter(io.mantisrx.master.api.akka.route.proto.JobClusterProtoAdapter) Assert.fail(org.junit.Assert.fail) LastSubmittedJobIdStreamRoute(io.mantisrx.master.api.akka.route.v1.LastSubmittedJobIdStreamRoute) StatusEventSubscriberLoggingImpl(io.mantisrx.master.events.StatusEventSubscriberLoggingImpl) ServerBinding(akka.http.javadsl.ServerBinding) HttpCharsets(akka.http.javadsl.model.HttpCharsets) JobStatusRouteHandler(io.mantisrx.master.api.akka.route.handlers.JobStatusRouteHandler) WorkerEventSubscriberLoggingImpl(io.mantisrx.master.events.WorkerEventSubscriberLoggingImpl) Jackson(io.mantisrx.master.api.akka.route.Jackson) BeforeClass(org.testng.annotations.BeforeClass) AdminMasterRoute(io.mantisrx.master.api.akka.route.v1.AdminMasterRoute) JobDiscoveryRouteHandler(io.mantisrx.master.api.akka.route.handlers.JobDiscoveryRouteHandler) HttpMethods(akka.http.javadsl.model.HttpMethods) WorkerAssignments(io.mantisrx.server.core.WorkerAssignments) JobClusterRouteHandler(io.mantisrx.master.api.akka.route.handlers.JobClusterRouteHandler) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) AgentClusterOperations(io.mantisrx.master.vm.AgentClusterOperations) CompletionStage(java.util.concurrent.CompletionStage) NotUsed(akka.NotUsed) AgentClustersRoute(io.mantisrx.master.api.akka.route.v1.AgentClustersRoute) ActorSystem(akka.actor.ActorSystem) JobDiscoveryStreamRoute(io.mantisrx.master.api.akka.route.v1.JobDiscoveryStreamRoute) JobDiscoveryRouteHandlerAkkaImpl(io.mantisrx.master.api.akka.route.handlers.JobDiscoveryRouteHandlerAkkaImpl) Optional(java.util.Optional) Mockito.mock(org.mockito.Mockito.mock) MantisJobMetadataView(io.mantisrx.master.jobcluster.job.MantisJobMetadataView) MantisWorkerMetadataWritable(io.mantisrx.server.master.store.MantisWorkerMetadataWritable) Flow(akka.stream.javadsl.Flow) JobRouteHandlerAkkaImpl(io.mantisrx.master.api.akka.route.handlers.JobRouteHandlerAkkaImpl) LeaderRedirectionFilter(io.mantisrx.server.master.LeaderRedirectionFilter) Matchers.anyString(org.mockito.Matchers.anyString) AuditEventSubscriberLoggingImpl(io.mantisrx.master.events.AuditEventSubscriberLoggingImpl) Observable(rx.Observable) JobClusterPayloads(io.mantisrx.master.api.akka.payloads.JobClusterPayloads) CompactJobInfo(io.mantisrx.server.master.http.api.CompactJobInfo) LifecycleEventPublisherImpl(io.mantisrx.master.events.LifecycleEventPublisherImpl) JobTestHelper(io.mantisrx.master.jobcluster.job.JobTestHelper) ByteString(akka.util.ByteString) HttpEntity(akka.http.javadsl.model.HttpEntity) NamedJobInfo(io.mantisrx.server.core.NamedJobInfo) LocalMasterMonitor(io.mantisrx.server.core.master.LocalMasterMonitor) LeadershipManagerLocalImpl(io.mantisrx.server.master.LeadershipManagerLocalImpl) JobClusterRouteHandlerAkkaImpl(io.mantisrx.master.api.akka.route.handlers.JobClusterRouteHandlerAkkaImpl) JobSchedulingInfo(io.mantisrx.server.core.JobSchedulingInfo) AfterClass(org.testng.annotations.AfterClass) Logger(org.slf4j.Logger) Assert.assertNotNull(org.junit.Assert.assertNotNull) Http(akka.http.javadsl.Http) HttpRequest(akka.http.javadsl.model.HttpRequest) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Mockito.when(org.mockito.Mockito.when) ContentTypes(akka.http.javadsl.model.ContentTypes) HttpEntities(akka.http.javadsl.model.HttpEntities) HttpResponse(akka.http.javadsl.model.HttpResponse) FakeMantisScheduler(io.mantisrx.master.scheduler.FakeMantisScheduler) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) JobClusterManagerProto(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto) ConnectHttp(akka.http.javadsl.ConnectHttp) MediaTypes(akka.http.javadsl.model.MediaTypes) JobClustersRoute(io.mantisrx.master.api.akka.route.v1.JobClustersRoute) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) LifecycleEventPublisher(io.mantisrx.master.events.LifecycleEventPublisher) MantisJobMetadataView(io.mantisrx.master.jobcluster.job.MantisJobMetadataView) MantisWorkerMetadataWritable(io.mantisrx.server.master.store.MantisWorkerMetadataWritable) MantisStageMetadataWritable(io.mantisrx.server.master.store.MantisStageMetadataWritable) HttpResponse(akka.http.javadsl.model.HttpResponse) Matchers.anyString(org.mockito.Matchers.anyString) ByteString(akka.util.ByteString) TypeReference(io.mantisrx.shaded.com.fasterxml.jackson.core.type.TypeReference) IOException(java.io.IOException) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.testng.annotations.Test)

Example 2 with MantisJobMetadataView

use of io.mantisrx.master.jobcluster.job.MantisJobMetadataView in project mantis by Netflix.

the class JacksonTest method testDeser4.

@Test
public void testDeser4() throws IOException {
    final ObjectMapper objectMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    List<MantisJobMetadataView> jobIdInfos = Jackson.fromJSON(objectMapper, "[{\"jobMetadata\":{\"jobId\":\"sine-function-1\",\"name\":\"sine-function\"," + "\"user\":\"nmahilani\",\"submittedAt\":1527703650220,\"jarUrl\":\"https://mantis.staging.us-east-1.prod.netflix.net/mantis-artifacts/mantis-examples-sine-function-0.2.9.zip\"," + "\"numStages\":2,\"sla\":{\"runtimeLimitSecs\":0,\"minRuntimeSecs\":0,\"slaType\":\"Lossy\",\"durationType\":\"Perpetual\",\"userProvidedType\":\"\"}," + "\"state\":\"Accepted\",\"subscriptionTimeoutSecs\":0,\"parameters\":[{\"name\":\"useRandom\",\"value\":\"True\"}],\"nextWorkerNumberToUse\":11," + "\"migrationConfig\":{\"strategy\":\"PERCENTAGE\",\"configString\":\"{\\\"percentToMove\\\":25,\\\"intervalMs\\\":60000}\"}," + "\"labels\":[{\"name\":\"_mantis.user\",\"value\":\"nmahilani\"},{\"name\":\"_mantis.ownerEmail\",\"value\":\"nmahilani@netflix.com\"}," + "{\"name\":\"_mantis.jobType\",\"value\":\"other\"},{\"name\":\"_mantis.criticality\",\"value\":\"low\"},{\"name\":\"_mantis.artifact.version\",\"value\":\"0.2.9\"}]}," + "\"stageMetadataList\":[{\"jobId\":\"sine-function-1\",\"stageNum\":0,\"numStages\":2,\"machineDefinition\":{\"cpuCores\":1.0,\"memoryMB\":200.0,\"networkMbps\":128.0,\"diskMB\":1024.0,\"numPorts\":1}," + "\"numWorkers\":1,\"hardConstraints\":null,\"softConstraints\":null,\"scalingPolicy\":null,\"scalable\":false}," + "{\"jobId\":\"sine-function-1\",\"stageNum\":1,\"numStages\":2,\"machineDefinition\":{\"cpuCores\":1.0,\"memoryMB\":200.0,\"networkMbps\":128.0,\"diskMB\":1024.0,\"numPorts\":1},\"numWorkers\":1,\"hardConstraints\":[],\"softConstraints\":[\"M4Cluster\"]," + "\"scalingPolicy\":{\"stage\":1,\"min\":1,\"max\":10,\"increment\":2,\"decrement\":1,\"coolDownSecs\":600," + "\"strategies\":{\"CPU\":{\"reason\":\"CPU\",\"scaleDownBelowPct\":15.0,\"scaleUpAbovePct\":75.0,\"rollingCount\":{\"count\":12,\"of\":20}}},\"enabled\":true},\"scalable\":true}]," + "\"workerMetadataList\":[{\"workerIndex\":0,\"workerNumber\":2,\"jobId\":\"sine-function-1\",\"stageNum\":0,\"numberOfPorts\":4,\"metricsPort\":0,\"consolePort\":0," + "\"debugPort\":-1,\"ports\":[],\"state\":\"Accepted\",\"slave\":null,\"slaveID\":null,\"cluster\":{\"present\":false},\"acceptedAt\":1527703650231,\"launchedAt\":0,\"startingAt\":0,\"startedAt\":0," + "\"completedAt\":0,\"reason\":null,\"resubmitOf\":-1,\"totalResubmitCount\":0},{\"workerIndex\":0,\"workerNumber\":3,\"jobId\":\"sine-function-1\",\"stageNum\":1,\"numberOfPorts\":4,\"metricsPort\":0,\"consolePort\":0,\"debugPort\":-1,\"ports\":[],\"state\":\"Accepted\"," + "\"slave\":null,\"slaveID\":null,\"cluster\":{\"present\":false},\"acceptedAt\":1527703650232,\"launchedAt\":0,\"startingAt\":0,\"startedAt\":0,\"completedAt\":0," + "\"reason\":null,\"resubmitOf\":-1,\"totalResubmitCount\":0}]}]", new TypeReference<List<MantisJobMetadataView>>() {
    });
    System.out.println(jobIdInfos);
    MantisWorkerMetadataWritable mwm = jobIdInfos.get(0).getWorkerMetadataList().get(0);
    mwm.setCluster(Optional.ofNullable("test"));
    System.out.println(objectMapper.writer(Jackson.DEFAULT_FILTER_PROVIDER).writeValueAsString(mwm));
}
Also used : MantisJobMetadataView(io.mantisrx.master.jobcluster.job.MantisJobMetadataView) MantisWorkerMetadataWritable(io.mantisrx.server.master.store.MantisWorkerMetadataWritable) List(java.util.List) ObjectMapper(io.mantisrx.shaded.com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 3 with MantisJobMetadataView

use of io.mantisrx.master.jobcluster.job.MantisJobMetadataView in project mantis by Netflix.

the class JobClusterActor method onJobList.

@Override
public void onJobList(final ListJobsRequest request) {
    if (logger.isDebugEnabled()) {
        logger.info("Entering JCA:onJobList");
    }
    final ActorRef sender = getSender();
    final ActorRef self = getSelf();
    Set<JobId> jobIdsFilteredByLabelsSet = new HashSet<>();
    // If labels criterion is given prefilter by labels
    if (!request.getCriteria().getMatchingLabels().isEmpty()) {
        jobIdsFilteredByLabelsSet = jobManager.getJobsMatchingLabels(request.getCriteria().getMatchingLabels(), request.getCriteria().getLabelsOperand());
        // Found no jobs matching labels exit
        if (jobIdsFilteredByLabelsSet.isEmpty()) {
            if (logger.isTraceEnabled()) {
                logger.trace("Exit JCA:onJobList {}", jobIdsFilteredByLabelsSet.size());
            }
            sender.tell(new ListJobsResponse(request.requestId, SUCCESS, "", new ArrayList<>()), self);
            return;
        }
    }
    // Found jobs matching labels or no labels criterion given.
    // Apply additional criterion to both active and completed jobs
    getFilteredNonTerminalJobList(request.getCriteria(), jobIdsFilteredByLabelsSet).mergeWith(getFilteredTerminalJobList(request.getCriteria(), jobIdsFilteredByLabelsSet)).collect(() -> Lists.<MantisJobMetadataView>newArrayList(), List::add).doOnNext(resultList -> {
        if (logger.isTraceEnabled()) {
            logger.trace("Exit JCA:onJobList {}", resultList.size());
        }
        sender.tell(new ListJobsResponse(request.requestId, SUCCESS, "", resultList), self);
    }).subscribe();
}
Also used : JobId(io.mantisrx.server.master.domain.JobId) Terminated(akka.actor.Terminated) Optional.of(java.util.Optional.of) MantisJobStore(io.mantisrx.server.master.persistence.MantisJobStore) Action1(rx.functions.Action1) TriggerOperator(com.netflix.fenzo.triggers.TriggerOperator) GetLastSubmittedJobIdStreamResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLastSubmittedJobIdStreamResponse) JobActor(io.mantisrx.master.jobcluster.job.JobActor) ListArchivedWorkersRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListArchivedWorkersRequest) ActorRef(akka.actor.ActorRef) UpdateJobClusterLabelsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterLabelsResponse) UpdateJobClusterArtifactResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterArtifactResponse) Duration(java.time.Duration) Map(java.util.Map) CronPolicy(io.mantisrx.server.master.domain.IJobClusterDefinition.CronPolicy) Schedulers(rx.schedulers.Schedulers) Metrics(io.mantisrx.common.metrics.Metrics) Preconditions(com.netflix.spectator.impl.Preconditions) DisableJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.DisableJobClusterResponse) ListCompletedJobsInClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListCompletedJobsInClusterResponse) JobDefinition(io.mantisrx.server.master.domain.JobDefinition) Set(java.util.Set) ListCompletedJobsInClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListCompletedJobsInClusterRequest) ScaleStageRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ScaleStageRequest) JobStartedEvent(io.mantisrx.master.jobcluster.proto.JobClusterProto.JobStartedEvent) SubmitJobRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.SubmitJobRequest) CompletionStage(java.util.concurrent.CompletionStage) UpdateJobClusterWorkerMigrationStrategyRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterWorkerMigrationStrategyRequest) TriggerNotFoundException(com.netflix.fenzo.triggers.exceptions.TriggerNotFoundException) JobHelper(io.mantisrx.master.jobcluster.job.JobHelper) ListJobIdsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobIdsRequest) BehaviorSubject(rx.subjects.BehaviorSubject) ListWorkersRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListWorkersRequest) GetJobDefinitionUpdatedFromJobActorRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDefinitionUpdatedFromJobActorRequest) Optional.empty(java.util.Optional.empty) SERVER_ERROR(io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SERVER_ERROR) CronTrigger(com.netflix.fenzo.triggers.CronTrigger) MetricsRegistry(io.mantisrx.common.metrics.MetricsRegistry) JobConstraints(io.mantisrx.runtime.JobConstraints) LabelUtils(com.mantisrx.common.utils.LabelUtils) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) ListJobIdsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobIdsResponse) SupervisorStrategy(akka.actor.SupervisorStrategy) JobClusterDefinitionImpl(io.mantisrx.server.master.domain.JobClusterDefinitionImpl) WorkerEvent(io.mantisrx.server.master.scheduler.WorkerEvent) GetLastSubmittedJobIdStreamRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLastSubmittedJobIdStreamRequest) Label(io.mantisrx.common.Label) EnableJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.EnableJobClusterRequest) GetJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobClusterRequest) UpdateJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterRequest) MANTIS_MASTER_USER(io.mantisrx.master.StringConstants.MANTIS_MASTER_USER) CLIENT_ERROR_NOT_FOUND(io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.CLIENT_ERROR_NOT_FOUND) UpdateJobClusterWorkerMigrationStrategyResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterWorkerMigrationStrategyResponse) CompletedJob(io.mantisrx.server.master.domain.JobClusterDefinitionImpl.CompletedJob) IMantisJobMetadata(io.mantisrx.master.jobcluster.job.IMantisJobMetadata) KillJobResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.KillJobResponse) SchedulerException(com.netflix.fenzo.triggers.exceptions.SchedulerException) IMantisWorkerMetadata(io.mantisrx.master.jobcluster.job.worker.IMantisWorkerMetadata) ListJobsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobsResponse) EnableJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.EnableJobClusterResponse) IJobClusterDefinition(io.mantisrx.server.master.domain.IJobClusterDefinition) JobState(io.mantisrx.master.jobcluster.job.JobState) GetJobSchedInfoRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobSchedInfoRequest) LoggerFactory(org.slf4j.LoggerFactory) GaugeCallback(io.mantisrx.common.metrics.spectator.GaugeCallback) StageSchedulingInfo(io.mantisrx.runtime.descriptor.StageSchedulingInfo) JobCompletedReason(io.mantisrx.server.core.JobCompletedReason) InvalidJobRequest(io.mantisrx.server.master.InvalidJobRequest) MantisScheduler(io.mantisrx.server.master.scheduler.MantisScheduler) ListJobsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobsRequest) CLIENT_ERROR(io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.CLIENT_ERROR) GetJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobClusterResponse) JobClusterProto(io.mantisrx.master.jobcluster.proto.JobClusterProto) GetLatestJobDiscoveryInfoResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLatestJobDiscoveryInfoResponse) GetJobDetailsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDetailsResponse) BasicTag(com.netflix.spectator.api.BasicTag) JobProto(io.mantisrx.master.jobcluster.proto.JobProto) ResubmitWorkerResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ResubmitWorkerResponse) ConstraintsEvaluators(io.mantisrx.server.master.ConstraintsEvaluators) DisableJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.DisableJobClusterRequest) ResubmitWorkerRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ResubmitWorkerRequest) GetJobDefinitionUpdatedFromJobActorResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDefinitionUpdatedFromJobActorResponse) UpdateJobClusterLabelsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterLabelsRequest) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) SLA(io.mantisrx.server.master.domain.SLA) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) GetJobSchedInfoResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobSchedInfoResponse) Objects(java.util.Objects) List(java.util.List) PatternsCS.ask(akka.pattern.PatternsCS.ask) GetJobDetailsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDetailsRequest) SubmitJobResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.SubmitJobResponse) ConfigurationProvider(io.mantisrx.server.master.config.ConfigurationProvider) Optional(java.util.Optional) Props(akka.actor.Props) UpdateJobClusterSLARequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterSLARequest) MantisJobMetadataView(io.mantisrx.master.jobcluster.job.MantisJobMetadataView) ScaleStageResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ScaleStageResponse) UpdateJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterResponse) JobIdInfo(io.mantisrx.master.api.akka.route.proto.JobClusterProtoAdapter.JobIdInfo) KillJobRequest(io.mantisrx.master.jobcluster.proto.JobClusterProto.KillJobRequest) ListArchivedWorkersResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListArchivedWorkersResponse) MantisJobMetadataImpl(io.mantisrx.master.jobcluster.job.MantisJobMetadataImpl) JobSla(io.mantisrx.runtime.JobSla) HashMap(java.util.HashMap) UpdateJobClusterSLAResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterSLAResponse) MantisActorSupervisorStrategy(io.mantisrx.master.akka.MantisActorSupervisorStrategy) ConcurrentMap(java.util.concurrent.ConcurrentMap) Observable(rx.Observable) HashSet(java.util.HashSet) LifecycleEventsProto(io.mantisrx.master.events.LifecycleEventsProto) DeleteJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.DeleteJobClusterResponse) ListWorkersResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListWorkersResponse) AbstractActorWithTimers(akka.actor.AbstractActorWithTimers) JobClusterAlreadyExistsException(io.mantisrx.server.master.persistence.exceptions.JobClusterAlreadyExistsException) Counter(io.mantisrx.common.metrics.Counter) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) Optional.ofNullable(java.util.Optional.ofNullable) ListJobCriteria(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobCriteria) GetLatestJobDiscoveryInfoRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLatestJobDiscoveryInfoRequest) JobClusterConfig(io.mantisrx.server.master.domain.JobClusterConfig) SUCCESS(io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS) JobClusterManagerProto(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto) Lists(io.mantisrx.shaded.com.google.common.collect.Lists) UpdateJobClusterArtifactRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterArtifactRequest) Collections(java.util.Collections) LifecycleEventPublisher(io.mantisrx.master.events.LifecycleEventPublisher) JobClustersManagerInitializeResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.JobClustersManagerInitializeResponse) MetricGroupId(io.mantisrx.common.metrics.spectator.MetricGroupId) ActorRef(akka.actor.ActorRef) ArrayList(java.util.ArrayList) ListJobsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobsResponse) ArrayList(java.util.ArrayList) List(java.util.List) JobId(io.mantisrx.server.master.domain.JobId) HashSet(java.util.HashSet)

Example 4 with MantisJobMetadataView

use of io.mantisrx.master.jobcluster.job.MantisJobMetadataView in project mantis by Netflix.

the class JobClusterActor method getFilteredTerminalJobList.

/**
 * JobState ActiveOnly Execute?
 *   None    None        Y
 *   None    TRUE        N
 *   None    FALSE       Y
 *   Active  None        N
 *   Active  TRUE        N
 *   Active  FALSE       N
 *   Terminal None       Y
 *   Terminal TRUE       Y
 *   Terminal FALSE      Y
 * @param request
 * @return
 */
private Observable<MantisJobMetadataView> getFilteredTerminalJobList(ListJobCriteria request, Set<JobId> jobIdSet) {
    if (logger.isTraceEnabled()) {
        logger.trace("JobClusterActor:getFilteredTerminalJobList");
    }
    if ((request.getJobState().isPresent() && !request.getJobState().get().equals(JobState.MetaState.Terminal))) {
        if (logger.isTraceEnabled()) {
            logger.trace("Exit JobClusterActor:getFilteredTerminalJobList with empty");
        }
        return Observable.empty();
    } else if (!request.getJobState().isPresent() && (request.getActiveOnly().isPresent() && request.getActiveOnly().get())) {
        if (logger.isTraceEnabled()) {
            logger.trace("Exit JobClusterActor:getFilteredTerminalJobList with empty");
        }
        return Observable.empty();
    }
    List<CompletedJob> jobInfoList;
    if (!jobIdSet.isEmpty()) {
        jobInfoList = jobIdSet.stream().map((jId) -> jobManager.getCompletedJob(jId)).filter((compJobOp) -> compJobOp.isPresent()).map((compJobOp) -> compJobOp.get()).collect(Collectors.toList());
    } else {
        jobInfoList = jobManager.getCompletedJobsList();
    }
    List<CompletedJob> shortenedList = jobInfoList.subList(0, Math.min(jobInfoList.size(), request.getLimit().orElse(DEFAULT_LIMIT)));
    return Observable.from(shortenedList).flatMap((cJob) -> {
        try {
            if (logger.isDebugEnabled()) {
                logger.debug("Fetching details for completed job {}", cJob);
            }
            Optional<IMantisJobMetadata> metaOp = jobManager.getJobDataForCompletedJob(cJob.getJobId());
            if (metaOp.isPresent()) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Fetched details for completed job {} -> {}", cJob, metaOp.get());
                }
                return Observable.just(new MantisJobMetadataView(metaOp.get(), cJob.getTerminatedAt(), request.getStageNumberList(), request.getWorkerIndexList(), request.getWorkerNumberList(), request.getWorkerStateList(), false));
            }
        } catch (Exception e) {
            logger.error("caught exception", e);
            return Observable.empty();
        }
        return Observable.empty();
    });
}
Also used : JobId(io.mantisrx.server.master.domain.JobId) Terminated(akka.actor.Terminated) Optional.of(java.util.Optional.of) MantisJobStore(io.mantisrx.server.master.persistence.MantisJobStore) Action1(rx.functions.Action1) TriggerOperator(com.netflix.fenzo.triggers.TriggerOperator) GetLastSubmittedJobIdStreamResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLastSubmittedJobIdStreamResponse) JobActor(io.mantisrx.master.jobcluster.job.JobActor) ListArchivedWorkersRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListArchivedWorkersRequest) ActorRef(akka.actor.ActorRef) UpdateJobClusterLabelsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterLabelsResponse) UpdateJobClusterArtifactResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterArtifactResponse) Duration(java.time.Duration) Map(java.util.Map) CronPolicy(io.mantisrx.server.master.domain.IJobClusterDefinition.CronPolicy) Schedulers(rx.schedulers.Schedulers) Metrics(io.mantisrx.common.metrics.Metrics) Preconditions(com.netflix.spectator.impl.Preconditions) DisableJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.DisableJobClusterResponse) ListCompletedJobsInClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListCompletedJobsInClusterResponse) JobDefinition(io.mantisrx.server.master.domain.JobDefinition) Set(java.util.Set) ListCompletedJobsInClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListCompletedJobsInClusterRequest) ScaleStageRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ScaleStageRequest) JobStartedEvent(io.mantisrx.master.jobcluster.proto.JobClusterProto.JobStartedEvent) SubmitJobRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.SubmitJobRequest) CompletionStage(java.util.concurrent.CompletionStage) UpdateJobClusterWorkerMigrationStrategyRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterWorkerMigrationStrategyRequest) TriggerNotFoundException(com.netflix.fenzo.triggers.exceptions.TriggerNotFoundException) JobHelper(io.mantisrx.master.jobcluster.job.JobHelper) ListJobIdsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobIdsRequest) BehaviorSubject(rx.subjects.BehaviorSubject) ListWorkersRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListWorkersRequest) GetJobDefinitionUpdatedFromJobActorRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDefinitionUpdatedFromJobActorRequest) Optional.empty(java.util.Optional.empty) SERVER_ERROR(io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SERVER_ERROR) CronTrigger(com.netflix.fenzo.triggers.CronTrigger) MetricsRegistry(io.mantisrx.common.metrics.MetricsRegistry) JobConstraints(io.mantisrx.runtime.JobConstraints) LabelUtils(com.mantisrx.common.utils.LabelUtils) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) ListJobIdsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobIdsResponse) SupervisorStrategy(akka.actor.SupervisorStrategy) JobClusterDefinitionImpl(io.mantisrx.server.master.domain.JobClusterDefinitionImpl) WorkerEvent(io.mantisrx.server.master.scheduler.WorkerEvent) GetLastSubmittedJobIdStreamRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLastSubmittedJobIdStreamRequest) Label(io.mantisrx.common.Label) EnableJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.EnableJobClusterRequest) GetJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobClusterRequest) UpdateJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterRequest) MANTIS_MASTER_USER(io.mantisrx.master.StringConstants.MANTIS_MASTER_USER) CLIENT_ERROR_NOT_FOUND(io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.CLIENT_ERROR_NOT_FOUND) UpdateJobClusterWorkerMigrationStrategyResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterWorkerMigrationStrategyResponse) CompletedJob(io.mantisrx.server.master.domain.JobClusterDefinitionImpl.CompletedJob) IMantisJobMetadata(io.mantisrx.master.jobcluster.job.IMantisJobMetadata) KillJobResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.KillJobResponse) SchedulerException(com.netflix.fenzo.triggers.exceptions.SchedulerException) IMantisWorkerMetadata(io.mantisrx.master.jobcluster.job.worker.IMantisWorkerMetadata) ListJobsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobsResponse) EnableJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.EnableJobClusterResponse) IJobClusterDefinition(io.mantisrx.server.master.domain.IJobClusterDefinition) JobState(io.mantisrx.master.jobcluster.job.JobState) GetJobSchedInfoRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobSchedInfoRequest) LoggerFactory(org.slf4j.LoggerFactory) GaugeCallback(io.mantisrx.common.metrics.spectator.GaugeCallback) StageSchedulingInfo(io.mantisrx.runtime.descriptor.StageSchedulingInfo) JobCompletedReason(io.mantisrx.server.core.JobCompletedReason) InvalidJobRequest(io.mantisrx.server.master.InvalidJobRequest) MantisScheduler(io.mantisrx.server.master.scheduler.MantisScheduler) ListJobsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobsRequest) CLIENT_ERROR(io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.CLIENT_ERROR) GetJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobClusterResponse) JobClusterProto(io.mantisrx.master.jobcluster.proto.JobClusterProto) GetLatestJobDiscoveryInfoResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLatestJobDiscoveryInfoResponse) GetJobDetailsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDetailsResponse) BasicTag(com.netflix.spectator.api.BasicTag) JobProto(io.mantisrx.master.jobcluster.proto.JobProto) ResubmitWorkerResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ResubmitWorkerResponse) ConstraintsEvaluators(io.mantisrx.server.master.ConstraintsEvaluators) DisableJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.DisableJobClusterRequest) ResubmitWorkerRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ResubmitWorkerRequest) GetJobDefinitionUpdatedFromJobActorResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDefinitionUpdatedFromJobActorResponse) UpdateJobClusterLabelsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterLabelsRequest) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) SLA(io.mantisrx.server.master.domain.SLA) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) GetJobSchedInfoResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobSchedInfoResponse) Objects(java.util.Objects) List(java.util.List) PatternsCS.ask(akka.pattern.PatternsCS.ask) GetJobDetailsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDetailsRequest) SubmitJobResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.SubmitJobResponse) ConfigurationProvider(io.mantisrx.server.master.config.ConfigurationProvider) Optional(java.util.Optional) Props(akka.actor.Props) UpdateJobClusterSLARequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterSLARequest) MantisJobMetadataView(io.mantisrx.master.jobcluster.job.MantisJobMetadataView) ScaleStageResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ScaleStageResponse) UpdateJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterResponse) JobIdInfo(io.mantisrx.master.api.akka.route.proto.JobClusterProtoAdapter.JobIdInfo) KillJobRequest(io.mantisrx.master.jobcluster.proto.JobClusterProto.KillJobRequest) ListArchivedWorkersResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListArchivedWorkersResponse) MantisJobMetadataImpl(io.mantisrx.master.jobcluster.job.MantisJobMetadataImpl) JobSla(io.mantisrx.runtime.JobSla) HashMap(java.util.HashMap) UpdateJobClusterSLAResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterSLAResponse) MantisActorSupervisorStrategy(io.mantisrx.master.akka.MantisActorSupervisorStrategy) ConcurrentMap(java.util.concurrent.ConcurrentMap) Observable(rx.Observable) HashSet(java.util.HashSet) LifecycleEventsProto(io.mantisrx.master.events.LifecycleEventsProto) DeleteJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.DeleteJobClusterResponse) ListWorkersResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListWorkersResponse) AbstractActorWithTimers(akka.actor.AbstractActorWithTimers) JobClusterAlreadyExistsException(io.mantisrx.server.master.persistence.exceptions.JobClusterAlreadyExistsException) Counter(io.mantisrx.common.metrics.Counter) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) Optional.ofNullable(java.util.Optional.ofNullable) ListJobCriteria(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobCriteria) GetLatestJobDiscoveryInfoRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLatestJobDiscoveryInfoRequest) JobClusterConfig(io.mantisrx.server.master.domain.JobClusterConfig) SUCCESS(io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS) JobClusterManagerProto(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto) Lists(io.mantisrx.shaded.com.google.common.collect.Lists) UpdateJobClusterArtifactRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterArtifactRequest) Collections(java.util.Collections) LifecycleEventPublisher(io.mantisrx.master.events.LifecycleEventPublisher) JobClustersManagerInitializeResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.JobClustersManagerInitializeResponse) MetricGroupId(io.mantisrx.common.metrics.spectator.MetricGroupId) CompletedJob(io.mantisrx.server.master.domain.JobClusterDefinitionImpl.CompletedJob) MantisJobMetadataView(io.mantisrx.master.jobcluster.job.MantisJobMetadataView) IMantisJobMetadata(io.mantisrx.master.jobcluster.job.IMantisJobMetadata) TriggerNotFoundException(com.netflix.fenzo.triggers.exceptions.TriggerNotFoundException) SchedulerException(com.netflix.fenzo.triggers.exceptions.SchedulerException) JobClusterAlreadyExistsException(io.mantisrx.server.master.persistence.exceptions.JobClusterAlreadyExistsException)

Example 5 with MantisJobMetadataView

use of io.mantisrx.master.jobcluster.job.MantisJobMetadataView in project mantis by Netflix.

the class JobClusterActor method getFilteredNonTerminalJobList.

private Observable<MantisJobMetadataView> getFilteredNonTerminalJobList(ListJobCriteria request, Set<JobId> prefilteredJobIdSet) {
    if (logger.isTraceEnabled()) {
        logger.trace("Entering JobClusterActor:getFilteredNonTerminalJobList");
    }
    Duration timeout = Duration.ofMillis(500);
    if ((request.getJobState().isPresent() && request.getJobState().get().equals(JobState.MetaState.Terminal))) {
        if (logger.isTraceEnabled()) {
            logger.trace("Exit JobClusterActor:getFilteredNonTerminalJobList with empty");
        }
        return Observable.empty();
    }
    List<JobInfo> jobInfoList;
    // 
    if (!prefilteredJobIdSet.isEmpty()) {
        jobInfoList = prefilteredJobIdSet.stream().map((jId) -> jobManager.getJobInfoForNonTerminalJob(jId)).filter((jInfoOp) -> jInfoOp.isPresent()).map((jInfoOp) -> jInfoOp.get()).collect(Collectors.toList());
    } else {
        // no prefiltering applied start with complete set of non terminal jobs
        jobInfoList = jobManager.getAllNonTerminalJobsList();
    }
    List<JobInfo> shortenedList = jobInfoList.subList(0, Math.min(jobInfoList.size(), request.getLimit().orElse(DEFAULT_ACTIVE_JOB_LIMIT)));
    if (logger.isDebugEnabled()) {
        logger.debug("List of non terminal jobs {}", jobInfoList);
    }
    return Observable.from(shortenedList).flatMap((jInfo) -> {
        GetJobDetailsRequest req = new GetJobDetailsRequest("system", jInfo.jobId);
        CompletionStage<GetJobDetailsResponse> respCS = ask(jInfo.jobActor, req, timeout).thenApply(GetJobDetailsResponse.class::cast);
        return Observable.from(respCS.toCompletableFuture(), Schedulers.io()).onErrorResumeNext(ex -> {
            logger.warn("caught exception {}", ex.getMessage(), ex);
            return Observable.empty();
        });
    }).filter((resp) -> resp != null && resp.getJobMetadata().isPresent()).map((resp) -> resp.getJobMetadata().get()).map((metaData) -> new MantisJobMetadataView(metaData, request.getStageNumberList(), request.getWorkerIndexList(), request.getWorkerNumberList(), request.getWorkerStateList(), false));
}
Also used : JobId(io.mantisrx.server.master.domain.JobId) Terminated(akka.actor.Terminated) Optional.of(java.util.Optional.of) MantisJobStore(io.mantisrx.server.master.persistence.MantisJobStore) Action1(rx.functions.Action1) TriggerOperator(com.netflix.fenzo.triggers.TriggerOperator) GetLastSubmittedJobIdStreamResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLastSubmittedJobIdStreamResponse) JobActor(io.mantisrx.master.jobcluster.job.JobActor) ListArchivedWorkersRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListArchivedWorkersRequest) ActorRef(akka.actor.ActorRef) UpdateJobClusterLabelsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterLabelsResponse) UpdateJobClusterArtifactResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterArtifactResponse) Duration(java.time.Duration) Map(java.util.Map) CronPolicy(io.mantisrx.server.master.domain.IJobClusterDefinition.CronPolicy) Schedulers(rx.schedulers.Schedulers) Metrics(io.mantisrx.common.metrics.Metrics) Preconditions(com.netflix.spectator.impl.Preconditions) DisableJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.DisableJobClusterResponse) ListCompletedJobsInClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListCompletedJobsInClusterResponse) JobDefinition(io.mantisrx.server.master.domain.JobDefinition) Set(java.util.Set) ListCompletedJobsInClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListCompletedJobsInClusterRequest) ScaleStageRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ScaleStageRequest) JobStartedEvent(io.mantisrx.master.jobcluster.proto.JobClusterProto.JobStartedEvent) SubmitJobRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.SubmitJobRequest) CompletionStage(java.util.concurrent.CompletionStage) UpdateJobClusterWorkerMigrationStrategyRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterWorkerMigrationStrategyRequest) TriggerNotFoundException(com.netflix.fenzo.triggers.exceptions.TriggerNotFoundException) JobHelper(io.mantisrx.master.jobcluster.job.JobHelper) ListJobIdsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobIdsRequest) BehaviorSubject(rx.subjects.BehaviorSubject) ListWorkersRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListWorkersRequest) GetJobDefinitionUpdatedFromJobActorRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDefinitionUpdatedFromJobActorRequest) Optional.empty(java.util.Optional.empty) SERVER_ERROR(io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SERVER_ERROR) CronTrigger(com.netflix.fenzo.triggers.CronTrigger) MetricsRegistry(io.mantisrx.common.metrics.MetricsRegistry) JobConstraints(io.mantisrx.runtime.JobConstraints) LabelUtils(com.mantisrx.common.utils.LabelUtils) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) ListJobIdsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobIdsResponse) SupervisorStrategy(akka.actor.SupervisorStrategy) JobClusterDefinitionImpl(io.mantisrx.server.master.domain.JobClusterDefinitionImpl) WorkerEvent(io.mantisrx.server.master.scheduler.WorkerEvent) GetLastSubmittedJobIdStreamRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLastSubmittedJobIdStreamRequest) Label(io.mantisrx.common.Label) EnableJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.EnableJobClusterRequest) GetJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobClusterRequest) UpdateJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterRequest) MANTIS_MASTER_USER(io.mantisrx.master.StringConstants.MANTIS_MASTER_USER) CLIENT_ERROR_NOT_FOUND(io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.CLIENT_ERROR_NOT_FOUND) UpdateJobClusterWorkerMigrationStrategyResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterWorkerMigrationStrategyResponse) CompletedJob(io.mantisrx.server.master.domain.JobClusterDefinitionImpl.CompletedJob) IMantisJobMetadata(io.mantisrx.master.jobcluster.job.IMantisJobMetadata) KillJobResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.KillJobResponse) SchedulerException(com.netflix.fenzo.triggers.exceptions.SchedulerException) IMantisWorkerMetadata(io.mantisrx.master.jobcluster.job.worker.IMantisWorkerMetadata) ListJobsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobsResponse) EnableJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.EnableJobClusterResponse) IJobClusterDefinition(io.mantisrx.server.master.domain.IJobClusterDefinition) JobState(io.mantisrx.master.jobcluster.job.JobState) GetJobSchedInfoRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobSchedInfoRequest) LoggerFactory(org.slf4j.LoggerFactory) GaugeCallback(io.mantisrx.common.metrics.spectator.GaugeCallback) StageSchedulingInfo(io.mantisrx.runtime.descriptor.StageSchedulingInfo) JobCompletedReason(io.mantisrx.server.core.JobCompletedReason) InvalidJobRequest(io.mantisrx.server.master.InvalidJobRequest) MantisScheduler(io.mantisrx.server.master.scheduler.MantisScheduler) ListJobsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobsRequest) CLIENT_ERROR(io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.CLIENT_ERROR) GetJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobClusterResponse) JobClusterProto(io.mantisrx.master.jobcluster.proto.JobClusterProto) GetLatestJobDiscoveryInfoResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLatestJobDiscoveryInfoResponse) GetJobDetailsResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDetailsResponse) BasicTag(com.netflix.spectator.api.BasicTag) JobProto(io.mantisrx.master.jobcluster.proto.JobProto) ResubmitWorkerResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ResubmitWorkerResponse) ConstraintsEvaluators(io.mantisrx.server.master.ConstraintsEvaluators) DisableJobClusterRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.DisableJobClusterRequest) ResubmitWorkerRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ResubmitWorkerRequest) GetJobDefinitionUpdatedFromJobActorResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDefinitionUpdatedFromJobActorResponse) UpdateJobClusterLabelsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterLabelsRequest) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) SLA(io.mantisrx.server.master.domain.SLA) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) GetJobSchedInfoResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobSchedInfoResponse) Objects(java.util.Objects) List(java.util.List) PatternsCS.ask(akka.pattern.PatternsCS.ask) GetJobDetailsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDetailsRequest) SubmitJobResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.SubmitJobResponse) ConfigurationProvider(io.mantisrx.server.master.config.ConfigurationProvider) Optional(java.util.Optional) Props(akka.actor.Props) UpdateJobClusterSLARequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterSLARequest) MantisJobMetadataView(io.mantisrx.master.jobcluster.job.MantisJobMetadataView) ScaleStageResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ScaleStageResponse) UpdateJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterResponse) JobIdInfo(io.mantisrx.master.api.akka.route.proto.JobClusterProtoAdapter.JobIdInfo) KillJobRequest(io.mantisrx.master.jobcluster.proto.JobClusterProto.KillJobRequest) ListArchivedWorkersResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListArchivedWorkersResponse) MantisJobMetadataImpl(io.mantisrx.master.jobcluster.job.MantisJobMetadataImpl) JobSla(io.mantisrx.runtime.JobSla) HashMap(java.util.HashMap) UpdateJobClusterSLAResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterSLAResponse) MantisActorSupervisorStrategy(io.mantisrx.master.akka.MantisActorSupervisorStrategy) ConcurrentMap(java.util.concurrent.ConcurrentMap) Observable(rx.Observable) HashSet(java.util.HashSet) LifecycleEventsProto(io.mantisrx.master.events.LifecycleEventsProto) DeleteJobClusterResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.DeleteJobClusterResponse) ListWorkersResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListWorkersResponse) AbstractActorWithTimers(akka.actor.AbstractActorWithTimers) JobClusterAlreadyExistsException(io.mantisrx.server.master.persistence.exceptions.JobClusterAlreadyExistsException) Counter(io.mantisrx.common.metrics.Counter) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) Optional.ofNullable(java.util.Optional.ofNullable) ListJobCriteria(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.ListJobCriteria) GetLatestJobDiscoveryInfoRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetLatestJobDiscoveryInfoRequest) JobClusterConfig(io.mantisrx.server.master.domain.JobClusterConfig) SUCCESS(io.mantisrx.master.jobcluster.proto.BaseResponse.ResponseCode.SUCCESS) JobClusterManagerProto(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto) Lists(io.mantisrx.shaded.com.google.common.collect.Lists) UpdateJobClusterArtifactRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.UpdateJobClusterArtifactRequest) Collections(java.util.Collections) LifecycleEventPublisher(io.mantisrx.master.events.LifecycleEventPublisher) JobClustersManagerInitializeResponse(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.JobClustersManagerInitializeResponse) MetricGroupId(io.mantisrx.common.metrics.spectator.MetricGroupId) MantisJobMetadataView(io.mantisrx.master.jobcluster.job.MantisJobMetadataView) GetJobDetailsRequest(io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDetailsRequest) Duration(java.time.Duration) CompletionStage(java.util.concurrent.CompletionStage)

Aggregations

MantisJobMetadataView (io.mantisrx.master.jobcluster.job.MantisJobMetadataView)11 JobClusterManagerProto (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto)9 List (java.util.List)8 Logger (org.slf4j.Logger)8 LoggerFactory (org.slf4j.LoggerFactory)8 ActorRef (akka.actor.ActorRef)7 Collections (java.util.Collections)7 Map (java.util.Map)7 Optional (java.util.Optional)7 CompletionStage (java.util.concurrent.CompletionStage)7 Observable (rx.Observable)6 MantisJobStore (io.mantisrx.server.master.persistence.MantisJobStore)5 MantisScheduler (io.mantisrx.server.master.scheduler.MantisScheduler)5 Props (akka.actor.Props)4 Counter (io.mantisrx.common.metrics.Counter)4 Metrics (io.mantisrx.common.metrics.Metrics)4 MetricsRegistry (io.mantisrx.common.metrics.MetricsRegistry)4 LifecycleEventPublisher (io.mantisrx.master.events.LifecycleEventPublisher)4 IMantisJobMetadata (io.mantisrx.master.jobcluster.job.IMantisJobMetadata)4 GetJobDetailsRequest (io.mantisrx.master.jobcluster.proto.JobClusterManagerProto.GetJobDetailsRequest)4