Jie Yu created MESOS-1446:
-----------------------------

             Summary: Create an abstraction for launching an operation in a 
subprocess.
                 Key: MESOS-1446
                 URL: https://issues.apache.org/jira/browse/MESOS-1446
             Project: Mesos
          Issue Type: Improvement
            Reporter: Jie Yu
            Assignee: Jie Yu


Currently, we create a separate binary for each such operation. For example, 
mesos-fetcher, mesos-executor, mesos-usage, etc.

This becomes more and more tedious as we need more and more such operation in 
slave and containerizer. Instead of creating a new binary each time we want to 
introduce an operation, what about having the following interface.

The user can define customized "execute" function and customized flags. We can 
have a single binary taking care of all operations (or have a few binaries each 
of which takes care of a subset of operations).

{noformat}
// Represents an operation to be executed by a subprocess.
template <typename F>
class Operation
{
public:
  virtual ~Operation() {}

  // Returns the name of this operation.
  virtual std::string name() const = 0;

  // Defines the operation that will be executed by a subprocess.
  virtual Try<Nothing> execute(const F& flags) = 0;

  // Launches this operation in a subprocess.
  process::Future<Option<int> > launch(
      const F& flags,
      const std::string& executable,
      const Option<int>& stdout = None(),
      const Option<int>& stderr = None());
};
{noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to