-
-
Notifications
You must be signed in to change notification settings - Fork 776
Dynamic runner loading using stevedore #4217
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
* Moving get_runner call in container to refer to name instead of module_name * Using stevedore to load runner in util loader * Removing tests for removed runner loader * Removing runner loader based on import
|
@Kami take a look at this and let me know if you're good w/ the direction. As you'll see from my error message I plan on making a small |
Can you describe a little bit in more detail re What steps will be required/modified to get the fully working stackstorm system? Will we need an additional During the K8s work we experience increasing pain points with any migration, register, reload or init scripts. Any package postinst hooks are flaky by nature, see StackStorm/st2-packages#453 the consequences for From both systems/installation and user's perspective ideally to have st2 system in a "minimally" working state without any additional register steps. @Kami As an example, from what I remember some on-fly content reload happens with st2 sensors or it's different? Let's discuss. |
|
@armab Good comments. Let me clarify a bit. The reinstall-runners is only for people upgrading from <= 2.8 to >= 2.9. Starting with 2.9 all runners will be packaged with the deb/rpm packages and there's no need to run anything additional. In fact I'm eying a look at removing runners from the DB in general in this PR (I haven't yet because there would be a lot of implications so for now it will stay while I clean the rest up.) The biggest thing about upgrades I need to check is:
I think once the runners are all loaded via stevedore we can just get rid of them from the Either way, for HA story, the packages you guys would be installing from will have the runner modules baked into the env. So I do not, at this time, foresee an issue there. The One of my bigger concerns w/ removing runners from the DB (and how this is currently implemented) is I don't know what %age of our packs still have inconsistent naming references to runners. (Note to self: Look through exchange and make those consistent.) So for the foreseeable future we have to provide multiple "references" to a single runner. Or at least we need to deprecate it over the course of some version. Which, perhaps we start that in 2.9? |
|
Overall, I'm fine with this approach, but I wouldn't touch DB stuff right now since it has many consequences (and some would even argue it's a bad idea from consistency perspective since we also have DB objects for other resources, but that's a long debate :D). I'm also a bit confused like @armab about the st2ctl command - if I understand things correctly, there should be no need for that, even for users who are upgrading from a previous release. Runners will be built as Python Wheels and packaged / installed into main StackStorm virtual environment. All the pack virtual environments should inherit dependencies from parent virtualenv (and we also do some PYTHONPATH manipulating) so at least in theory, it should work out of the box. And I agree with @armab and think this will be an improvement since we can get rid of |
|
Btw, what's our target release for this functionality? v2.9.0? |
|
What's the plan for this? I would like to get at least first iteration in v3.0.0. I believe if we finish this PR and make corresponding st2-packages changes to build wheel for each runner and install it in StackStorm virtualenv we don't need any migration scripts. In addition to that, I would also avoid touching database for now (this would have implications on runner related API endpoint and many other places). |
|
I went over the code and changes and I believe those are the major changes we need to make to get this to work:
|
dictionary with metadata for requested runner. Previously it returned a list, but now that each runner is package, we can return a dicitonary for runner in question.
|
I will try to get this PR finished - it's mostly there because most of the code was already in place and this PR is just hooking everything up. I have some issues with existing tests due to how they mock some methods. I will try to sort this out and then I will look into also making Initial version of "dynamic runners" feature when this flag was added was a bit rushed. I will make registration implicit. It will happen automatically on each service startup during bootstrap phase (that's how things worked before implementing initial version of dynamic loading feature). For backward compatibility reasons, I will still leave that flag in place. |
during each service setup phase. This makes it consistent with the approach used before dynamic runner loading and also makes --register-runners st2-register-content script flag obsolete. Flag is still left in place for backward compatibility reasons.
module loading code.
|
@bigmstone This PR is now finally finished and ready for a review. I also needed to update our runner callback and query module loading code so it uses the same dynamic stevedore loading approach. Whole change took a lot of work - mostly because of mocks and fixtures in our tests (some tests mocked too much, a lot of fixtures were out of date / invalid, etc.). |
before other imports otherwise it wont work.
(Added / updated by @Kami)
This pull request works on various changes we have introduced over the last couple of releases to introduce fully automatic and dynamic runner loading.
Runners are now dynamically loaded using stevedore on each service startup (during bootstrap / init phase).
This means that
st2ctl reload --register-runnerscommand is not needed anymore (same as in the past, but now the runners are also loaded dynamically).To install a custom runner, user simply needs to create Python package for their runner, install it into StackStorm virtual environment and restart StackStorm services (notablly, action runner).
In addition to that, I also removed support for old deprecated runner names such as
run-local, etc. Those names were deprecated over 2 years ago so it's time to finally get rid of them.TODO
st2-packageschanges