[ 
https://issues.apache.org/jira/browse/FLINK-5975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15900649#comment-15900649
 ] 

ASF GitHub Bot commented on FLINK-5975:
---------------------------------------

Github user addisonj commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3481#discussion_r104838693
  
    --- Diff: 
flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java
 ---
    @@ -262,9 +264,61 @@ public String toString() {
                        taskInfo.setContainer(containerInfo);
                }
     
    +           
containerInfo.addAllVolumes(buildVolumes(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 static List<Protos.Volume> buildVolumes(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 (String s : specs) {
    +                   if (s.trim().isEmpty()) {
    +                           continue;
    +                   }
    +                   Protos.Volume.Builder vol = Protos.Volume.newBuilder();
    +                   vol.setMode(Protos.Volume.Mode.RW);
    +
    +                   String[] parts = s.split(":");
    +                   switch (parts.length) {
    +                           case 1:
    +                                   vol.setContainerPath(parts[0]);
    +                                   break;
    +                           case 2:
    +                                   try {
    +                                           Protos.Volume.Mode mode = 
Protos.Volume.Mode.valueOf(parts[1].trim().toUpperCase());
    +                                           vol.setMode(mode)
    +                                                   
.setContainerPath(parts[0]);
    +                                   } catch (IllegalArgumentException e) {
    +                                           vol.setHostPath(parts[0])
    +                                                   
.setContainerPath(parts[1]);
    +                                   }
    +                                   break;
    +                           case 3:
    +                                   Protos.Volume.Mode mode = 
Protos.Volume.Mode.valueOf(parts[2].trim().toUpperCase());
    +                                   vol.setMode(mode)
    +                                           .setHostPath(parts[0])
    +                                           .setContainerPath(parts[1]);
    +                                   break;
    +                           default:
    +                                   throw new 
IllegalArgumentException("volume specification is invalid, given: " + s);
    --- End diff --
    
    👍  will move it there


> Mesos should support adding volumes to launched taskManagers
> ------------------------------------------------------------
>
>                 Key: FLINK-5975
>                 URL: https://issues.apache.org/jira/browse/FLINK-5975
>             Project: Flink
>          Issue Type: Improvement
>          Components: Mesos
>    Affects Versions: 1.2.0, 1.3.0
>            Reporter: Addison Higham
>            Priority: Minor
>
> Flink needs access to shared storage.
> In many cases, this is HDFS, but it would be nice to also support file URIs 
> on an mounted NFS for example.
> Mesos exposes APIs for adding volumes, so it should be relatively simply to 
> add this.
> As an example, here is the spark code for supporting volumes: 
> https://github.com/apache/spark/blob/master/resource-managers/mesos/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerBackendUtil.scala#L35
>  



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to