-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/43083/#review117906
-----------------------------------------------------------




src/slave/containerizer/mesos/isolators/docker/runtime.cpp (lines 97 - 118)
<https://reviews.apache.org/r/43083/#comment179165>

    How about restructuring the code like the following:
    
    ```
    
    Option<Environment> environment = getEnvironment(
        containerId,
        containerConfig);
        
    Option<string> workingDirectory = getWorkingDirectory(
        containerId,
        containerConfig);
        
    Try<CommandInfo> command = getLaunchCommand(
        containerId,
        containerConfig);
    
    if (command.isError()) {
      ...
    }
    
    // Set 'launchInfo'.
    ContainerLaunchInfo launchInfo;
    
    if (environment.isSome()) {
      launchInfo.mutable_environment()->CopyFrom(environment.get());
    }
    
    if (!containerConfig.has_task_info()) {
      // Custom executor case.
      launchInfo.set_working_directory(workingDirectory.get());
      launchInfo.mutable_command()->CopyFrom(command.get());
    } else {
      // Command task case.
      CommandInfo executorCommand = containerConfig.executor_info().command();
      
      if (environment.isSome()) {
        launchInfo.mutable_environment()->CopyFrom(environment.get());
      }
      
      // Pass working directory to command executor as a flag.
      if (workingDirectory.isSome()) {
        executorCommand.add_arguments(
            "--working_directory=" + workingDirectory.get());
      }
      
      // Pass task command as a flag, which will be loaded by
      // command executor.
      executorCommand.add_arguments(
          "--task_command=" +
          stringify(JSON::protobuf(command.get())));
      
      launchInfo.mutable_command()->CopyFrom(executorCommand);
    }
    ```



src/slave/containerizer/mesos/isolators/docker/runtime.cpp (line 323)
<https://reviews.apache.org/r/43083/#comment179164>

    s/getWorkingDir/getWorkingDirectory/


- Jie Yu


On Feb. 4, 2016, 12:49 a.m., Gilbert Song wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/43083/
> -----------------------------------------------------------
> 
> (Updated Feb. 4, 2016, 12:49 a.m.)
> 
> 
> Review request for mesos, Artem Harutyunyan, Jie Yu, and Timothy Chen.
> 
> 
> Bugs: MESOS-4005
>     https://issues.apache.org/jira/browse/MESOS-4005
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Supported working dir in docker runtime isolator.
> 
> 
> Diffs
> -----
> 
>   src/slave/containerizer/mesos/containerizer.cpp 
> 4b504dbb58823ce7675f1d2048dcc7a27c05663d 
>   src/slave/containerizer/mesos/isolators/docker/runtime.hpp PRE-CREATION 
>   src/slave/containerizer/mesos/isolators/docker/runtime.cpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/43083/diff/
> 
> 
> Testing
> -------
> 
> make check (ubuntu14.04 + clang-3.6)
> 
> 
> Thanks,
> 
> Gilbert Song
> 
>

Reply via email to