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 2019 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.server.master.domain;
import static io.mantisrx.master.jobcluster.LabelManager.SystemLabels.MANTIS_RESOURCE_CLUSTER_NAME_LABEL;
import io.mantisrx.common.Label;
import io.mantisrx.master.jobcluster.LabelManager.SystemLabels;
import io.mantisrx.runtime.JobSla;
import io.mantisrx.runtime.MachineDefinition;
import io.mantisrx.runtime.MantisJobDurationType;
import io.mantisrx.runtime.command.InvalidJobException;
import io.mantisrx.runtime.descriptor.DeploymentStrategy;
import io.mantisrx.runtime.descriptor.SchedulingInfo;
import io.mantisrx.runtime.descriptor.StageSchedulingInfo;
import io.mantisrx.runtime.parameter.Parameter;
import io.mantisrx.server.master.resourcecluster.ClusterID;
import io.mantisrx.shaded.com.fasterxml.jackson.annotation.JsonCreator;
import io.mantisrx.shaded.com.fasterxml.jackson.annotation.JsonIgnore;
import io.mantisrx.shaded.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.mantisrx.shaded.com.fasterxml.jackson.annotation.JsonProperty;
import io.mantisrx.shaded.com.google.common.base.Preconditions;
import io.mantisrx.shaded.com.google.common.base.Strings;
import io.mantisrx.shaded.com.google.common.collect.ImmutableList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import lombok.ToString;
import org.apache.commons.lang3.tuple.Pair;
@ToString
public class JobDefinition {
private final String name;
private final String user;
private final String jobJarUrl;
private final String artifactName;
private final String version;
private final List parameters;
private final JobSla jobSla;
private final long subscriptionTimeoutSecs;
private final SchedulingInfo schedulingInfo;
private final DeploymentStrategy deploymentStrategy;
private final int withNumberOfStages;
private Map labels; // Map label->name to label instance.
/**
* A map of scheduling constraints deduced from labels.
* The constraints are extracted from labels matching the "MANTIS_SCHEDULING_ATTRIBUTE_LABEL_REGEX" pattern.
* Only the contents of the capturing group (i.e., the key that comes after "_mantis.schedulingConstraint.")
* are saved. These values are then used as constraints during worker scheduling.
*/
private final Map schedulingConstraints;
private final static Pattern MANTIS_SCHEDULING_ATTRIBUTE_LABEL_REGEX =
Pattern.compile("_mantis\\.schedulingAttribute\\.(.+)", Pattern.CASE_INSENSITIVE);
@JsonCreator
@JsonIgnoreProperties(ignoreUnknown = true)
public JobDefinition(@JsonProperty("name") String name,
@JsonProperty("user") String user,
@JsonProperty("jobJarUrl") String jobJarUrl,
@JsonProperty("artifactName") String artifactName,
@JsonProperty("version") String version,
@JsonProperty("parameters") List parameters,
@JsonProperty("jobSla") JobSla jobSla,
@JsonProperty("subscriptionTimeoutSecs") long subscriptionTimeoutSecs,
@JsonProperty("schedulingInfo") SchedulingInfo schedulingInfo,
@JsonProperty("numberOfStages") int withNumberOfStages,
@JsonProperty("labels") List