flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tillrohrmann <...@git.apache.org>
Subject [GitHub] flink pull request #5114: [FLINK-8174] [mesos] Mesos RM unable to accept off...
Date Tue, 05 Dec 2017 13:50:48 GMT
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5114#discussion_r154870701
  
    --- Diff: flink-mesos/src/main/java/org/apache/flink/mesos/util/MesosResourceAllocation.java
---
    @@ -0,0 +1,197 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 org.apache.flink.mesos.util;
    +
    +import org.apache.mesos.Protos;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.util.ArrayList;
    +import java.util.Collection;
    +import java.util.Collections;
    +import java.util.Comparator;
    +import java.util.List;
    +import java.util.ListIterator;
    +import java.util.Set;
    +
    +import static org.apache.flink.mesos.Utils.print;
    +
    +/**
    + * An allocation of resources on a particular host from one or more Mesos offers, to
be portioned out to tasks.
    + *
    + * <p>This class assumes that the resources were offered <b>without</b>
the {@code RESERVATION_REFINEMENT} capability,
    + * as detailed in the "Resource Format" section of the Mesos protocol definition.
    + *
    + * <p>This class is not thread-safe.
    + */
    +public class MesosResourceAllocation {
    +
    +	protected static final Logger LOG = LoggerFactory.getLogger(MesosResourceAllocation.class);
    +
    +	static final double EPSILON = 1e-5;
    +	static final String UNRESERVED_ROLE = "*";
    +
    +	private final List<Protos.Resource> resources;
    +
    +	/**
    +	 * Creates an allocation of resources for tasks to take.
    +	 *
    +	 * @param resources the resources to add to the allocation.
    +	 */
    +	public MesosResourceAllocation(Collection<Protos.Resource> resources) {
    +		this.resources = new ArrayList<>(resources);
    --- End diff --
    
    null check is missing.


---

Mime
View raw message