Closed blaggacao closed 2 years ago
Possible candidates:
@guewen Is this something for you to consider on the longer run?
That would OCA/queue
make a solid emerging standard job interface with batteries included but swapable. Currently, it's role as a job interface is diminished by having the implementation bundled tightly.
While mediator is thinkable, ideally, a well defined interface + (backend specific) wrapper would be preferable.
I really like the current implementation! No dependency on external tools, transnational, scalable, ....
@lmignon Yes, of course, you are right with you're opinion. Actually, my intention is not to propose any external dependency, here.
Rather, what I try to propose, is a well defined interface for Odoo specific jobs that can be implemented by any back end, while still providing the current implementation as a default back end (batteries included, but swapable). This has two advantages:
Finally, it could, then, rightfully claim to be the canonical job implementation for Odoo. After all code re-usability is a proclaimed OCA goal.
At this stage, I just want to understand how fertile the ground would be for such idea. I think OCA/queue has huge potential, and I strongly believe inter-operability would further leverage that potential.
@blaggacao in the very first implementation, I wrote some abstractions to make the job execution swappable, in the case we would like to use another queue, etc. It was of course not perfect since the use case did not really exist. Throughout the evolution of the code, at some point we decided to remove the abstractions because they made the code more complex, nobody ever used them and by using an odoo/postgres-only queue and executor, we could implement some features that would maybe not work with an external backend (I don't have them in head but I remember having to make this choice ;)).
Not saying it cannot be done, but only YAGNI; if the need arrives, and we have no choice but to implement a different back-end, then I guess we'll first have some budget to work on it, second, a real use case and real implementation is required to do the correct choices in term of interfaces (I would even say we would need to test the implementation of 3 backends to be sure of the interface).
@theangryangel I'm braking a lance here for you're idea to use airflow/luigi. I guess it's interesting what @guewen reports about the choices he had to make
For sure, anything more odoo domain specific would have to have access to an odoo registry passed around, so if scaling / resource constraining the job queue individually is a requirement, then those individually deployed runner need to bundle an odoo registry (@guewen I guess that's the main choice you had to make).
But for tasks that live more in the space between Odoo and X system, airflow/luigi/sydnesis/etc. might be the better candidate. Would be interesting to see if any integration can be done so that both job domains can interact and inter-depend. I can imagine that airflow's DAG would have some interdependencies with Odoo domain specific jobs, after all.
One of the best properties of the current system is the fact that jobs are in the same transaction. The transaction is rollbacked, they are as well. If we wanted to create the jobs in a external queue, we would "modify the external world" that the transaction would not be able to rollback, then you have a whole new category of problems.
A common pattern to avoid this issue is to first create the jobs in a DB table, commit. Then a second transaction pushes them to the external job queue. So my opinion is that, if we needed to work on such bridge, the interface would be... the queue_job table.
Yesterday I was doing some brief, very simple experiments with OCA/queue, airflow, etc. just loosely tying them together (effectively just making a delayed job signal to airflow to run a DAG on demand; not real integration as @blaggacao has suggested). I wanted to get a feel for what things might be like, what problems I might see that I hadn't considered yet, etc.
I think I'm starting to see the "category of problems" you've alluded @guewen and I'm not sure how I feel about the approach - mostly because of the time constraints I've got.
The thing that attracted me to airflow specifically was;
@blaggacao At the end of the day I'm starting to think that OCA/connector, OCA/queue is probably more than good enough for now (the benefits of deep integration with Odoo, without a lot of work, etc.) may be more appropriate. I'll ping you on Skype later to discuss further?
@theangryangel could be true. The decoupling of lifecycles (and deployments) you mentioned, from what I've seen in patterns out there, is probably the strongest argument for offloading, indeed.
@guewen As a result of the discussion with @theangryangel we have considered a different option, mainly to achieve life cycle decoupling, which I want to share with you (not validated many assumptions, yet):
OCA/rest
)OCA/connector
This way:
In this scenario, OCA/queue
would be the component in charge as Odoo's internal job queue. I feel this is a solid approach, as we decouple systems according to their life cycle while still honoring your choice to make OCA/queue
a domain specific job queue. In this light, it probably can stay that way and entirely focus on tight Odoo integration.
If any further interaction with an external queue shall be needed, like mutually conditioning the DAGs, maybe a pub/sub event interface would be just the missing bit which motivated the creation of this FR in the first place.
/cc @mlaitinen
There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.
Coming from the wish to spec job objects according to their metadata for fit resource consumption and gain more advanced operational insights (like monitoring), I want to offload the execution to a more powerful system (than python workers).
Therefore, implement a executor back-end listening on: