-
Notifications
You must be signed in to change notification settings - Fork 842
Conversation
Thanks for the PR! A few points:
|
Rebased onto master. I have no idea how to get rid of guice when integrating PluginManager into ResourceMatcher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates! Left a few more comments.
try { | ||
SchedulerPluginRunner.plugins = pluginManager.plugins[SchedulerPlugin].toList | ||
} catch { | ||
case e: Throwable => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer NonFatal
to Throwable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
* @since 6/15/17. | ||
*/ | ||
class SchedulerPluginConfigurer @Inject() (pluginManager: PluginManager) { | ||
private[this] val log = LoggerFactory.getLogger(getClass) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer StrictLogging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
SchedulerPluginRunner.plugins = pluginManager.plugins[SchedulerPlugin].toList | ||
} catch { | ||
case e: Throwable => | ||
log.error("Failed to load plugins", e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it really worth using error
level logging if the plan is to rethrow the exception? maybe debug
or info
level would be more appropriate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
/** | ||
* Is populated by [[mesosphere.marathon.core.scheduler.SchedulerPluginConfigurer]] | ||
*/ | ||
var plugins: List[SchedulerPlugin] = List.empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dislike global mutable state. let's avoid this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also dislike this approach. But I don't see another way to get list of plugins here. Can you suggest how to fix it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to introduce a SchedulerPluginModule where we inject the PluginsManager and hold the list of SchedulerPlugins and wire this to the needed classes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't solve the issue. The issue is that we have to integrate different scopes: guice (pluginManager) and global (ResourceMatcher).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResourceMatcher.matchResources(..)
is called by InstanceOpFactoryImpl
where we do have the plugin manager. At this point we could either pass a list of SchedulerPlugin
or you could hide this list behind trait abstracting this list. Would this be an option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Does any chance to merge this PR in master soon? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing documentation in https://github.com/mesosphere/marathon/blob/master/docs/docs/plugin.md
hey @tsydd, still on it? Do you need assistance or a sparring partner for the Thanks |
Updated plugin.md |
I've fixed pr according to your comments. Can it be merged now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for addressing our feedback! LGTM, did some minor doc adaptions, hope this is ok :)
Hey @jdef, could you please have a look at the addressed changes? This would be awesome :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. thanks!
Shouldn't this run through the CI once? |
yes @jeschkies it should definitely run through CI |
Thanks @jeschkies for pointing out that there was no CI run yet! I am wondering why we dont have CI for community contributions. Anyways, I am currently setting up a phabricator review just for running CI and if its done, I`ll post the results here and merge if everything is fine 🎉 |
Phab review here: Jenkins job here: |
CI passed, happy to ship this commit! Thank you very much @tsydd!
|
Thanks all. Great work! |
Adds ability to customize scheduler logic using external plugins