[ https://issues.apache.org/jira/browse/FLINK-8174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16278817#comment-16278817 ]
ASF GitHub Bot commented on FLINK-8174: --------------------------------------- Github user EronWright commented on a diff in the pull request: https://github.com/apache/flink/pull/5114#discussion_r155000484 --- Diff: flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java --- @@ -217,15 +222,13 @@ public String toString() { dynamicProperties.setString(ConfigConstants.TASK_MANAGER_HOSTNAME_KEY, taskManagerHostname); } - // use the assigned ports for the TM - if (assignment.getAssignedPorts().size() < TM_PORT_KEYS.length) { - throw new IllegalArgumentException("unsufficient # of ports assigned"); - } - for (int i = 0; i < TM_PORT_KEYS.length; i++) { - int port = assignment.getAssignedPorts().get(i); - String key = TM_PORT_KEYS[i]; - taskInfo.addResources(ranges("ports", mesosConfiguration.frameworkInfo().getRole(), range(port, port))); - dynamicProperties.setInteger(key, port); + // take needed ports for the TM + List<Protos.Resource> portResources = allocation.takeRanges("ports", TM_PORT_KEYS.length, roles); + taskInfo.addAllResources(portResources); + Iterator<String> portsToAssign = Iterators.forArray(TM_PORT_KEYS); + rangeValues(portResources).forEach(port -> dynamicProperties.setLong(portsToAssign.next(), port)); --- End diff -- A call to `takeRanges` won't give more than requested so it won't happen. > Mesos RM unable to accept offers for unreserved resources > --------------------------------------------------------- > > Key: FLINK-8174 > URL: https://issues.apache.org/jira/browse/FLINK-8174 > Project: Flink > Issue Type: Bug > Components: Mesos > Affects Versions: 1.4.0, 1.3.3 > Reporter: Eron Wright > Assignee: Eron Wright > Priority: Blocker > Fix For: 1.4.0 > > > Flink has suffered a regression due to FLINK-7294. Any attempt to accept a > resource offer that is based on unreserved resources will fail, because Flink > (as of FLINK-7294) erroneously insists that the resource come from a prior > reservation. > Looking at the original issue, the problem may have been misdiagnosed. > Ideally Flink should work with both reserved and unreserved resources, but > the latter is a more common situation that is now broken. -- This message was sent by Atlassian JIRA (v6.4.14#64029)