[Cubicweb] Enhancing `bulk` writes in CubicWeb

Aurélien Campéas aurelien.campeas at logilab.fr
Tue May 6 10:55:04 CEST 2014


On 05/05/2014 22:48, Adrien Di Mascio wrote:
> Hi,
> 
> 
> On Fri, May 2, 2014 at 3:05 PM, Aurélien Campéas
> <aurelien.campeas at logilab.fr <mailto:aurelien.campeas at logilab.fr>> wrote:
> 
>     API
>     ...
> 
>     The API is as such:
> 
>     * `insert_entities` (etype, entitiesdicts, postprocessentity)
>     * `insert_relations` (rtype, fromtoentities)
>     * `run_deferred_hooks` (errorslist)
> 
> 
> What exactly does run_deferred_hooks() do ?

That's an idea still in flux.
The base idea is to run the hooks in a follow-up transaction
(they got collected with all relevant information in the
initial transaction).

The current implementation quite violates this and, in
the initial transaction, performs the "vectorized" version
of these hooks.

Hence we really can "defer" only the vectorized ones right now.
They just run at pre-commit time, like a big Op.


>  
> 
>     The first problem with cubicweb/server/hook.py is that it is barely
>     possible to understand the code. A serious refactoring is overdue.
> 
> 
> Could you elaborate a bit more ? I don't pretend this is the best piece
> of code ever but I find it at least readable.

Then you must have some super powers :)
I'm thinking esp. of server/hook.py between lines 279 and 401.


Regards,
Aurélien.




More information about the Cubicweb mailing list