Hash: SHA1

Hedley Roos wrote:
> Hi all
> I run my script foo.zctl with "zopectl run foo.ctl param1 param2".
> This script operates on a large ZODB and catches ConflictErrors
> accordingly. It iterates over a set, updates data and commits the
> transaction every 100 iterations. But I've noticed two things:
> 1. ConflictErrors are never fully caught. The show up in the console
> (this is acceptable I suppose), but my script stops executing on the
> conflict and does not continue. The zope process stays alive.

Your script has to do the following when interrupted by a ConflictError:

 - abort the current transaction
 - sync its database connection (to pick up the changed objects)
 - re-do the work it was trying to commit (that last 100 updates).

> 2. In the event of no conflict errors my script executes its last line
> (print 'done') but the process does not always terminate.

You may need to wait longer:  a commit can get blocked for a period.

> If I instruct my script to not update the ZODB at all it terminates
> without problems. I'm running it on a live site with 7 ZEO clients.
> I've stopped a client (say client 2) so it is not accessed
> concurrently and run my script with client2/zopectl. It is in fact a
> Plone site but that should be irrelevant.

Long-running ZODB-updating scripts are pretty hard to get right.  I hope
the dance outlined above helps.

- --
Tres Seaver          +1 540-429-0999          tsea...@palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to