Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/5114#discussion_r154869018
--- Diff:
flink-mesos/src/main/java/org/apache/flink/mesos/scheduler/Offer.java ---
@@ -0,0 +1,173 @@
+/*
+ * 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.scheduler;
+
+import com.netflix.fenzo.VirtualMachineLease;
+import org.apache.mesos.Protos;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.apache.flink.mesos.Utils.print;
+
+/**
+ * An adapter class to transform a Mesos resource offer to a Fenzo {@link
VirtualMachineLease}.
+ *
+ * <p>The default implementation provided by Fenzo isn't compatible with
reserved resources.
+ * This implementation properly combines resources, e.g. a combination of
reserved and unreserved cpus.
+ *
+ */
+public class Offer implements VirtualMachineLease {
+
+ private static final Logger logger =
LoggerFactory.getLogger(Offer.class);
+
+ private final Protos.Offer offer;
+ private final String hostname;
+ private final String vmID;
+ private final long offeredTime;
+
+ private final List<Protos.Resource> resources;
+ private final Map<String, List<Protos.Resource>> resourceMap;
+ private final Map<String, Protos.Attribute> attributeMap;
+
+ public Offer(Protos.Offer offer) {
+ this.offer = offer;
--- End diff --
check not null missing
---