[Erp5-dev] HowToUseTheCmfActivityTool r40

Yoshinori Okuji yo at nexedi.com
Tue Apr 13 04:48:47 CEST 2010


On Monday 12 April 2010 10:45:26 pm Vincent Pelletier wrote:
> Hi.
> 
> This mail is about the following wiki page change:
> http://www.erp5.org/HowToUseTheCmfActivityTool?action=diff&rev1=39&rev2=40
> 
> This change is not as precise as it should be, and as I don't want to just
> edit it without explanations, I prefer to send a mail here.

I don' think so. Wiki exists to edit. If something is wrong, simply edit it 
and add your comment when saving it. If you need to say more, this probably 
means that you should write more articles on the wiki, but not sending mail at 
somewhere else. ;)

> First, I'll start stating the obvious:
> CMFActivity provides as way to make executions asynchronous in Zope, in a
> transactional manner.
> 
> Now, a bit less obvious:
> Doing so, it provides 2 main "policies" for such executions:
> - factorised executions (SQLDict)
>   Used with "activate(activity='SQLDict')" or "activate()"
> - systematic executions (SQLQueue)
>   Used with "activate(activity='SQLQueue')"
> 
> By "factorised", I mean that when independent transactions trigger
>  activities, maybe some of those activities have no need to be executed
>  more than once. A trivial example is when doing 2 consecutive changes on a
>  document, each change will plan an indexation of modified document.
>  Executing the indexation operation once is enough to have the latest
>  version in the catalog.
> 
> And now, to the point ("points", as they are 2):
> - If one wants that each and every activity must be executed, he should use
>   SQLQueue by specifying it. So the proposed page change advertises a way
>  to make SQLDict somewhat work like SQLQueue. This is what I don't like in
>  mentioned change.

I don't like, either. But I don't have time to rewrite it nicely, so I only 
removed it.

> - Finally, there is indeed a behaviour in SQLQueue which is surprising when
>  it first bites you, which is that the decision that 2 activities in
>  SQLDict are actually to be executed just once is based on a finite (and
>  quite restricted at that) list of activity properties. Aggravating,
>  SQLDict is the default behaviour when creating an activity, which makes
>  this behaviour more dangerous when not known beforehand (but I think
>  backward compatibility will strongly prevent us from changing this). I
>  believe this should be mentioned in the wiki page, with the list of
>  activity properties it uses (which gets extended from time to time).

I myself believe that there is no way to prevent the beginners from getting 
surprised with activities anyway, because the nature of distributed computing 
and soft-realtime makes things so complicated. If I would remake CMFActivity 
in long future, I would make the selection of an activity explicit.

BTW, I think it is bad that the terminology is often confused even by people 
in Nexedi. "Activity" is an agent / engine planning and executing objects 
(e.g. SQLDict). Objects are activated, then they become "Active Objects". But 
I see people mistakenly calling active objects "activities" - this kind of 
confusion is quite dangerous when teaching. Note that this terminology is not 
specific to ERP5. In fact, "Active Object" is a well-known design pattern in 
distributed computing.

Regards,
YO
-- 
Yoshinori Okuji, Nexedi KK President
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.co.jp/
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com/
ERP5 Wiki: Developer Zone for ERP5 Community
http://www.erp5.org/



More information about the Erp5-dev mailing list