RE: [Zope] Transactions

2000-08-10 Thread Chris McDonough

Kapil,

I don't know if you've run across this yet, but the method call:

get_transaction()

In Python (after you've imported the ZODB module) returns the result of
the get_transaction global, which helps do some transaction-related
things:

get_transaction().commit()
get_transaction().abort()
get_transaction().note()

There are also semantics for committing subtransactions, though I'm not
real clear on them.  I *think* you commit a subtransaction by doing:

get_transaction().commit(1)

See Jim's ZODB UML model at
http://www.zope.org/Documentation/Developer/Models/ZODB for more info.

You could probably emulate what you need to do with a combination of
these commands.

> -Original Message-
> From: Kapil Thangavelu [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 09, 2000 4:59 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [Zope] Transactions
> 
> 
> Let me a bit more specific.
> 
> i'm developing a python product which does some fairly intensive list
> processing over a long list and adds stuff to the zodb based 
> on that. If
> it bombs somewhere in the middle of the processing i don't want the
> whole transaction rolled back. i'm doing my own data 
> integrity check so
> i want each add to be atomic independent of the transaction. i thought
> about sub-transactions to get around the enormous mem requirements of
> the huge transactions but it doesn't solve the problem of atomic adds.
> is there some way to either turn off transactions for a given python
> operation or to make an operation autocommit itself in a 
> subtransaction?
> 
> hmmm... related question (i think) how does one make a method whose
> effect can't be rolled back?
> 
> any help appreciated
> 
> Kapil
> 
> Kapil Thangavelu wrote:
> > 
> > quick question.
> > 
> > Is there a way to turn off transactions for a given python 
> operation?
> > 
> > Kapil
> > 
> > ___
> > Zope maillist  -  [EMAIL PROTECTED]
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
> 
> ___
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Transactions

2000-08-10 Thread Jacob Lundqvist

Hi Kapil Thangavelu!
I dont  know of if this is what your after, but here is one way do do
transacts with / without rollback


One simple way of having rollback is to do it with except raising a
flag, then 
if the flag gets turned on do whatever is needed to undo the current
action
this can be done recursivly, to rollback a whole sequence of actions

rollback=0
try:
  [do stuff foo]
  try:
[do stuff bar]
  except:
rollback=1
  if rollback:
[rollback bar]
except:
  rollback=1
if rollback:
  [rollback foo]   




> hmmm... related question (i think) how does one make a method whose
> effect can't be rolled back?

try:
  [do stuff foo]
   
  [do stuff bar]
except:
  pass


/Jacob Lundqvist

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Transactions

2000-08-09 Thread Kapil Thangavelu

Let me a bit more specific.

i'm developing a python product which does some fairly intensive list
processing over a long list and adds stuff to the zodb based on that. If
it bombs somewhere in the middle of the processing i don't want the
whole transaction rolled back. i'm doing my own data integrity check so
i want each add to be atomic independent of the transaction. i thought
about sub-transactions to get around the enormous mem requirements of
the huge transactions but it doesn't solve the problem of atomic adds.
is there some way to either turn off transactions for a given python
operation or to make an operation autocommit itself in a subtransaction?

hmmm... related question (i think) how does one make a method whose
effect can't be rolled back?

any help appreciated

Kapil

Kapil Thangavelu wrote:
> 
> quick question.
> 
> Is there a way to turn off transactions for a given python operation?
> 
> Kapil
> 
> ___
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )