Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2023 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mantisrx.master.jobcluster;
import com.netflix.spectator.api.BasicTag;
import io.mantisrx.common.Label;
import io.mantisrx.common.metrics.Metrics;
import io.mantisrx.common.metrics.MetricsRegistry;
import io.mantisrx.common.metrics.spectator.GaugeCallback;
import io.mantisrx.common.metrics.spectator.MetricGroupId;
import io.mantisrx.master.jobcluster.JobClusterActor.LabelCache;
import io.mantisrx.master.jobcluster.job.IMantisJobMetadata;
import io.mantisrx.master.jobcluster.job.JobState;
import io.mantisrx.server.master.domain.JobClusterDefinitionImpl.CompletedJob;
import io.mantisrx.server.master.domain.JobId;
import io.mantisrx.server.master.persistence.MantisJobStore;
import io.mantisrx.shaded.com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
import java.time.Instant;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import lombok.Value;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
interface ICompletedJobsStore {
/**
* Initialize the store
* @throws IOException if there is an error
*/
void initialize() throws IOException;
/**
* Gets a completed job given a job id
* @param jId job id
* @return completed job if found else empty
* @throws IOException if there is an error
*/
Optional getCompletedJob(JobId jId) throws IOException;
/**
* Gets a completed job given a job id
* @param jId job id
* @return completed job if found else empty
* @throws IOException if there is an error
*/
Optional getJobMetadata(JobId jId) throws IOException;
/**
* Gets a list of completed jobs
* @param limit number of jobs to return
* @return list of completed jobs
* @throws IOException if there is an error
*/
List getCompletedJobs(int limit) throws IOException;
/**
* Gets a list of completed jobs
* @param limit number of jobs to return
* @param endExclusive end job id
* @return list of completed jobs
* @throws IOException if there is an error
*/
List getCompletedJobs(int limit, JobId endExclusive) throws IOException;
/**
* Adds a new completed job to the store
* @param jobMetadata job metadata
* @return completed job
* @throws IOException if there is an error
*/
CompletedJob onJobCompletion(IMantisJobMetadata jobMetadata) throws IOException;
/**
* Adds a new completed job to the store in case the mantis job metadata was not created.
* @param jId job id
* @param submittedAt job submission time
* @param completionTime job completion time
* @param user user who submitted the job
* @param version job version
* @param finalState final state of the job
* @param labels labels associated with the job
* @return completed job
* @throws IOException if there is an error
*/
CompletedJob onJobCompletion(JobId jId, long submittedAt, long completionTime,
String user, String version, JobState finalState, List