[Erp5-dev] Activity semaphoring/locking mechanisms, was: activate_kw for activities - how to use?

Łukasz Nowak lukasz.nowak at ventis.com.pl
Tue Mar 11 12:23:51 CET 2008


Hello,

On 2008-03-11, 12:08:33
Pelletier Vincent <vincent at nexedi.com> wrote:

(...)
> With more details, it will:
> - create 2 activities (edit and doSomethingElse). Note that  "edit"
> activity has no tag.
> - assuming that there is no existing activity (or at least, none with
>   tag='my_tag'), either can execute. So they are 2 cases:
> Case 1: edit is invoked strcictly first (doSomethingElse is not
> called untill edit call is over)
>   - edit is invoked and generates an activity (most probably a
>     "reindexObject") with tag='my_tag'
>   - now, the only processable activity is "reindexObject", since
>     doSomethingElse depends on its tag: reindexObject is invoked
>   - doSomethingElse is invoked
> Case 2: doSomethingElse is invoked before edit is over (includes
> being invoked before or simultaneously by another node - if any other)
>   - doSomethingElse is invoked
>   - edit is invoked and generate a reindexObject activity with
> tag="my_tag"
>   - reindexObject is invoked
> 
> I guess you only want Case 1 to be possible. If so, you should issue
> something like:
>  object.activate(tag='my_tag').edit(activate_kw={'tag':'my_tag'})
>  object.activate(after_tag='my_tag').doSomethingElse()

Arghhh! Yes, yes. I retyped it here, and missed tag for edit.

> So that edit activity itself also gets the tag doSomethinElse depends
> on. edit activity will only be removed strictly after completion, so
> there will already be an activity with 'my_tag' present, so
> doSomethingElse has no chance to be executed at that time.
> 
> Note that those scenarii depends on "edit" to generate activities
> properly, with given tag.
> In the case of "edit", I guess it is because it does not need to
> generate complex activities. But some method might want to use their
> own tags, which makes dependancy handling at their level a tiny bit
> more complex (they need to create dummy activities with provided tag
> and depending on the tags they internaly use).

Yep. Edit is quite simple, but at least understandable.

Thank you very much. Is it ok if I update wiki with those information?

Regards,
Luke

-- 
Łukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...'' I am only craftsman.



More information about the Erp5-dev mailing list