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



src/launcher/launcher.hpp
<https://reviews.apache.org/r/22224/#comment79410>

    This should be:
    
    extern const char* DEFAULT_EXECUTABLE;
    
    as std::string is non-POD.



src/launcher/launcher.cpp
<https://reviews.apache.org/r/22224/#comment79412>

    const char DEFAULT_EXECUTABLE[] = "mesos-launcher";
    
    same for LAUNCHER_PREFIX


- Dominic Hamon


On June 5, 2014, 10:33 a.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/22224/
> -----------------------------------------------------------
> 
> (Updated June 5, 2014, 10:33 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Ian Downes, and Vinod Kone.
> 
> 
> Bugs: MESOS-1446
>     https://issues.apache.org/jira/browse/MESOS-1446
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Currently, whenever we want something to be executed in a subprocess, we 
> create a separate binary (e.g., mesos-fetcher, mesos-executor, mesos-usage, 
> etc.). This has several drawbacks:
> 
> 1) Code duplication (passing arguments, main function, etc.)
> 2) Split logic into multiple files (not good for readability)
> 
> To solve that, I created a generic 'launcher' for 'Operation's. Users can 
> define their own 'Operation' and 'launch' it in a subprocess. For instance:
> 
> class CustomizedOperation : public Operation
> {
> public:
>   class Flags : public flags::FlagsBase
>   {
>     Flags();
>     Option<string> arg1;
>     Option<int> arg2;
>   };
> 
> protected:
>   virtual string name() const { return "customized_operation"; }
> 
>   virtual int execute()
>   {
>     if (arg1.isNone()) { return 1; }
>     if (arg2.isNone()) { return 1; }
> 
>     do_something(arg1.get(), arg2.get());
>   }
> };
> 
> In your code, if you want to execute 'CustomizedOperation' in a subprocess, 
> you can just launch it:
> 
> CustomizedOperation operation;
> operation.flags.arg1 = "arg1";
> operation.flags.arg2 = "arg2";
> 
> operation.launch(flags.launcher_dir + "/mesos-launcher");
> 
> We will handle the flags passing and parsing for you under the hood.
> 
> 
> Diffs
> -----
> 
>   src/Makefile.am c3ecb94 
>   src/launcher/launcher.hpp PRE-CREATION 
>   src/launcher/launcher.cpp PRE-CREATION 
>   src/launcher/main.cpp PRE-CREATION 
>   src/tests/environment.cpp 3e10508 
>   src/tests/launcher_tests.cpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/22224/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jie Yu
> 
>

Reply via email to