Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Added scheduler plugin functionality #5421

Merged
merged 2 commits into from
Sep 15, 2017
Merged

Added scheduler plugin functionality #5421

merged 2 commits into from
Sep 15, 2017

Conversation

tsydd
Copy link
Contributor

@tsydd tsydd commented Jun 9, 2017

Adds ability to customize scheduler logic using external plugins

@jdef
Copy link
Contributor

jdef commented Jun 14, 2017

Thanks for the PR! A few points:

  1. We strongly prefer to accept PR's against master and backport, as needed, to prior releases. This PR is against releases/1.3, not master. Please retrofit this code and open a PR against master instead. If it lands there, then we'll consider backporting it to prior releases.
  2. Nice example plugin! We have a public repo for those though (https://github.com/mesosphere/marathon-example-plugins), which is a better fit than the plugin-interface project, which we generally reserve for interfaces only. We're cleaning up the existing examples too in an effort to improve things for the community. Your example would do well here.
  3. The integration of this plugin into the main scheduling logic appears to "further refine" existing scheduler decisions (vs. replacing them alltogether); documenting this nuance is likely important.
  4. Guice is the bane of our existence. Seriously. Can we find a way to lessen the integration with it?

@tsydd tsydd changed the base branch from releases/1.3 to master June 15, 2017 11:56
@tsydd
Copy link
Contributor Author

tsydd commented Jun 15, 2017

Rebased onto master. I have no idea how to get rid of guice when integrating PluginManager into ResourceMatcher

Copy link
Contributor

@jdef jdef left a 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 =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer NonFatal to Throwable

Copy link
Contributor Author

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer StrictLogging

Copy link
Contributor Author

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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).

Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@brat002
Copy link

brat002 commented Jun 23, 2017

Does any chance to merge this PR in master soon?

Copy link
Contributor

@janisz janisz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@unterstein
Copy link
Contributor

hey @tsydd,

still on it? Do you need assistance or a sparring partner for the var plugins: List[SchedulerPlugin] discussion?

Thanks
Johannes

@tsydd
Copy link
Contributor Author

tsydd commented Jul 12, 2017

Updated plugin.md

@tsydd
Copy link
Contributor Author

tsydd commented Sep 5, 2017

I've fixed pr according to your comments. Can it be merged now?

Copy link
Contributor

@unterstein unterstein left a 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 :)

@unterstein
Copy link
Contributor

Hey @jdef, could you please have a look at the addressed changes? This would be awesome :)

Copy link
Contributor

@jdef jdef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. thanks!

@jeschkies
Copy link
Contributor

Shouldn't this run through the CI once?

@jdef
Copy link
Contributor

jdef commented Sep 15, 2017

yes @jeschkies it should definitely run through CI

@unterstein
Copy link
Contributor

unterstein commented Sep 15, 2017

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 🎉

@unterstein
Copy link
Contributor

unterstein commented Sep 15, 2017

@unterstein
Copy link
Contributor

CI passed, happy to ship this commit!

Thank you very much @tsydd!

    .  o ..                  
     o . o o.o                
          ...oo               
            __[]__          Shippin'  
         __|_o_o_o\__         it!
         \""""""""""/         
          \. ..  . /          
     ^^^^^^^^^^^^^^^^^^^^

@unterstein unterstein merged commit 3e61a17 into d2iq-archive:master Sep 15, 2017
@brat002
Copy link

brat002 commented Sep 18, 2017

Thanks all. Great work!

@kensipe kensipe mentioned this pull request Sep 26, 2017
5 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants