Marco Massenzio created MESOS-4253:
--------------------------------------
Summary: Provide a minimalist "runtime context" to an Anonymous
Module
Key: MESOS-4253
URL: https://issues.apache.org/jira/browse/MESOS-4253
Project: Mesos
Issue Type: Improvement
Components: modules
Reporter: Marco Massenzio
Assignee: Marco Massenzio
Currently, {{Anonymous}} modules only receive at creation a copy of the
{{"parameters"}} passed in the JSON configuration file.
However, at runtime, it would be useful to also have a "runtime context" for
the module developer to use, when implementing the functionality.
I would suggest to pass in the {{Flags}} object from the Master/Agent inside an
{{setRuntimeContext(const Flags&)}}[0] method, called immediately
post-{{create(const Parameters&)}}[1].
Also, I would suggest adding a {{teardown()}} method too, in case the module
needs to release resources / conduct cleanup before exiting (there is a TODO in
the code to this effect, and adding this in this patch would be close to
trivial).
[0] In practice, it won't be this trivial, as Master/Agent {{Flags}} are of a
different compile-time type - probably use something like variadic templates or
something (suggestions appreciated!).
[1] In fact, the ideal solution would be to add the {{const Flags&}} to
{{create()}}, but that would, alas, break everyone's modules; so that's
probably a no-go (ideas welcome here too).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)