Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/3481#discussion_r104781670
--- Diff:
flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java
---
@@ -262,9 +265,67 @@ public String toString() {
taskInfo.setContainer(containerInfo);
}
+ containerInfo.addAllVolumes(volumes(params.containerVolumes()));
+
return taskInfo.build();
}
+ /**
+ * Used to build volume specs for mesos. This allows for mounting
additional volumes into a container
+ *
+ * @param containerVolumes a comma delimited optional string of
[host_path:]container_path[:RO|RW] that
+ * defines mount points for a container volume.
If None or empty string, returns
+ * an empty iterator
+ */
+ public List<Protos.Volume> volumes(Option<String> containerVolumes) {
+ if (containerVolumes.isEmpty()) {
+ return new ArrayList<Protos.Volume>();
+ }
+ String[] specs = containerVolumes.get().split(",");
+ List<Protos.Volume> vols = new ArrayList<Protos.Volume>();
+ for (int i = 0; i < specs.length; i++) {
+ String s = specs[i];
+ if (s.isEmpty()) {
+ continue;
+ }
+ Protos.Volume.Builder vol = Protos.Volume.newBuilder();
+ vol.setMode(Protos.Volume.Mode.RW);
+
+ List<String> parts = Arrays.asList(s.split(":"));
--- End diff --
The parsing logic is a bit brittle and inconsistent; if parts.size == 3 and
the Mode is invalid an IAE is thrown. if parts.size == 2 and the mode is
invalid we'll assign a bogus path.
A regex may be more appropriate.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---