Hi,
As part of the work of integrating Dynflow into Katello, we needed models
for keeping the track of tasks run in the system and their assignment to
related resources. Since the work is not specific to Katello only and other
parts of Foreman might be interested in it (especially with growing number
of features that require async processing), I've extracted the common logic
into a plugin. For now, you can find it here:
https://github.com/iNecas/foreman-tasks
I've recorded a screencast on that as well, explaining the main features
and usage:
http://www.youtube.com/watch?v=AqZkoSt8vzA
If you're interested in showing progress of background tasks, auditing,
showing CLI examples for actions of Dynflow integration, you might want
to see that video (sorry for all the coughing, I haven't felt very well
when recording that:)
The idea is this gem would provide the common API for getting the status
of running tasks. The code should be backround-processing-tool agnostic.
For now, we have adapter for Dynflow, as it's plan for using that in Katello's
orchestration.
The Dynflow part there is optional, but it should make it really
easy to start with that if anyone interested (no additional service needed, just
database migration). It might also be interesting to look into the auditing aspect
of this approach: I've spent some time on that in the README and screencast, as well
as some example in the plugin itself (tracking the actions on architecture resource)
See README for more details, I will be offline for some time till end of this year,
therefore I wanted to get something out before that (sorry for missing tests,
that's one of my new years resolutions:)
You can also see the Katello's part in action here
http://www.youtube.com/watch?v=cpUz5Ylhkr0.
There is also a wiki page started for discussions and design around the tasks API.
http://projects.theforeman.org/projects/foreman/wiki/_foreman_tasks
Ad. relation to foreman-background plugin (https://github.com/ohadlevy/foreman-background):
The foreman-background provides just basic wrapper around Sidekiq for asynchronous processing
of some operations. The sidekiq part might be probably part of Foreman Tasks as well (on the
same level as Dynflow). It would be also nice to evaluate, if the Sidekiq is needed and if
Dynflow doesn't already provide enough features around async stuff. I know Sidekiq has some
history that promises being more stable solution at the beginning, but Dynflow is getting
better every commit :). Said that, if anyone is interested in contribution, either in general
API/models stuff, or adapters for other async tools, I will be more than happy to talk to you
and merge the patches.
– Ivan