-
Notifications
You must be signed in to change notification settings - Fork 86
Allow out-of-tree worker modules #431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Interesting. I globally ok with the patch. Could be good to add a test in |
I'm curious to know what's your use case? :) |
I have a python library that has a pretty heavy initialization overhead, because it loads yaml configs and runs plugins to discover facts about nodes (such as the BMC address for a node). The (existing) program flow is library => clustershell => exec the library, potentially resulting in two initializations. Using a native worker allows a much more direct path. I don't expect that my worker would be desired upstream, and distributing it with the library makes it easier to iterate features without having to worry about maintaining cross-version compatibility between the worker and the library. |
I'll admit I'm not familiar with the test suite. I'll give it a try and look into adding a test. Thanks |
Instead of looking for a '.' to indicate that the module is 'fully qualified', should we instead just manually map 'short' known ClusterShell workers into their fully qualified module name and then attempt to import whatever is left?
If you don't like the idea of keeping a list of in-tree workers, we could detect valid workers at runtime instead (with slightly more overhead). I was just trying to rationalize if it made sense to require out-of-tree workers to be in a subpackage, or if a top-level module could be a valid worker. I don't see any reason that it couldn't. |
c941c1c
to
1863979
Compare
Thanks for this update. Thanks also for adding the tests. I'm not fond of explicitly listing the in-core supported modules. The idea was that it could be possible, as an addons, to add new Workers just adding a new class in this directory (you could if you need to). So, they need to be able to work, just adding the file. I'm thinking if we could not just first try to import like it is a ClusterShell modules, and if it fails, try importing using a global module name? |
We probably also add somewhere in the doc that a fully qualified module name is also now supported. |
1863979
to
9df69d3
Compare
Except for the python3 incompat, I'm OK with the patch. Please update the commit message subject to have the same kind of pattern we use.
Probably good to add a Signed-Off line too |
Attempt to load worker modules distributed with ClusterShell as well as custom worker modules distributed outside of ClusterShell. Signed-off-by: Matt Ezell <[email protected]>
9df69d3
to
cf4ed8e
Compare
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 like it, thanks!
If a worker is specified with a '.' in the name, assume it is a
fully qualified module name that should be used. This supports
custom worker classes that are distributed outside of ClusterShell.