GJL closed pull request #6557: [FLINK-10149] [flink-mesos] Don't allocate extra
mesos port for TM unless configured to do so.
URL: https://github.com/apache/flink/pull/6557
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/flink-mesos/src/main/java/org/apache/flink/mesos/configuration/MesosOptions.java
b/flink-mesos/src/main/java/org/apache/flink/mesos/configuration/MesosOptions.java
index 426a891e814..0c4e1f6bcba 100644
---
a/flink-mesos/src/main/java/org/apache/flink/mesos/configuration/MesosOptions.java
+++
b/flink-mesos/src/main/java/org/apache/flink/mesos/configuration/MesosOptions.java
@@ -136,8 +136,9 @@
/**
* Config parameter to configure which configuration keys will
dynamically get a port assigned through Mesos.
*/
- public static final ConfigOption<String> PORT_ASSIGNMENTS =
key("mesos.resourcemanager.tasks.port-assignments")
- .defaultValue("")
+ public static final ConfigOption<String> PORT_ASSIGNMENTS =
+ key("mesos.resourcemanager.tasks.port-assignments")
+ .noDefaultValue()
.withDescription(Description.builder()
.text("Comma-separated list of configuration keys which
represent a configurable port. " +
"All port keys will dynamically get a port
assigned through Mesos.")
diff --git
a/flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java
b/flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java
index bb15aee0a7f..e906ade3a72 100644
---
a/flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java
+++
b/flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java
@@ -346,10 +346,12 @@ public String toString() {
final String portKeys = config.getString(PORT_ASSIGNMENTS);
- Arrays.stream(portKeys.split(","))
- .map(String::trim)
- .peek(key -> LOG.debug("Adding port key " + key + " to
mesos request"))
- .forEach(tmPortKeys::add);
+ if (portKeys != null) {
+ Arrays.stream(portKeys.split(","))
+ .map(String::trim)
+ .peek(key -> LOG.debug("Adding port key " + key
+ " to mesos request"))
+ .forEach(tmPortKeys::add);
+ }
return tmPortKeys;
}
diff --git
a/flink-mesos/src/test/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorkerTest.java
b/flink-mesos/src/test/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorkerTest.java
index 6784e427c1f..7fc99d28db3 100644
---
a/flink-mesos/src/test/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorkerTest.java
+++
b/flink-mesos/src/test/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorkerTest.java
@@ -52,4 +52,19 @@ public void canGetPortKeys() {
assertEquals("port key must be correct", "anotherport",
iterator.next());
}
+ @Test
+ public void canGetNoPortKeys() {
+ // Setup
+ Configuration config = new Configuration();
+
+ // Act
+ Set<String> portKeys =
LaunchableMesosWorker.extractPortKeys(config);
+
+ // Assert
+ assertEquals("Must get right number of port keys", 2,
portKeys.size());
+ Iterator<String> iterator = portKeys.iterator();
+ assertEquals("port key must be correct",
LaunchableMesosWorker.TM_PORT_KEYS[0], iterator.next());
+ assertEquals("port key must be correct",
LaunchableMesosWorker.TM_PORT_KEYS[1], iterator.next());
+ }
+
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services