Volatile variables Problem
Hi all: Well, i have a serious problem... I have defined a variable inside my product that I refresh periodically via XML-RPC (every ~1 min). I need to maintain this variable volatile because ZODB grows to the infinite... The problem arises when a new conection is established an the variable value need to be shown. In some cases the query raises an AttributeException. Now I catch this exception, but this no solves my problem... Why the value of this variable is lost? How I can solve the problem? Thanks in advance... -- Microsoft merges technologies: Windows CE + Windows ME + Windows NT = Windows CEMENT ---- Antonio Beamud Montero Agora Systems S.A. http://www.agoratechnologies.com
Antonio Beamud Montero wrote:
Hi all: Well, i have a serious problem... I have defined a variable inside my product that I refresh periodically via XML-RPC (every ~1 min). I need to maintain this variable volatile because ZODB grows to the infinite... The problem arises when a new conection is established an the variable value need to be shown. In some cases the query raises an AttributeException. Now I catch this exception, but this no solves my problem... Why the value of this variable is lost?
Since nobody responded till now, here are my 5c. Volatile attributes are only guaranted to exist as long a transaction AFAIK, OTOH they are also not guaranted to _not_ exist longer, which might explain that you don't see this failure everytime. So, I fear volatile attributes can't help you here.
How I can solve the problem?
Hmm, an external method which stores the values in a file? A external database? The sessioning stuff? Sorry, I have no really good idea there, maybe it helps if you explain what you want to do in more detail ... cheers, oliver
El mié, 05-02-2003 a las 15:15, Oliver Bleutgen escribió:
Antonio Beamud Montero wrote:
Hi all: Since nobody responded till now, here are my 5c. Volatile attributes are only guaranted to exist as long a transaction AFAIK, OTOH they are also not guaranted to _not_ exist longer, which might explain that you don't see this failure everytime.
So, I fear volatile attributes can't help you here.
Ok.
How I can solve the problem?
Hmm, an external method which stores the values in a file? A external database? The sessioning stuff?
Sorry, I have no really good idea there, maybe it helps if you explain what you want to do in more detail ...
Can Gadfly be my solution? really the only value I save is the status of some machines that I'm monitoring... I have an external daemon than obtains the machine status and update this volatile variables to rendering in dtml... How I can configure ZODB to only maintains one or two last object states and not grows to the infinite..? A lot of thanks -- Microsoft merges technologies: Windows CE + Windows ME + Windows NT = Windows CEMENT ---- Antonio Beamud Montero Agora Systems S.A. http://www.agoratechnologies.com
Antonio Beamud Montero wrote:
Can Gadfly be my solution?
Don't know, but I strongly suspect Gadfly uses the ZODB too, so ...
really the only value I save is the status of some machines that I'm monitoring... I have an external daemon than obtains the machine status and update this volatile variables to rendering in dtml...
Write it in an external file, the ExternalMethod to write/read from that file should be really easy. Or, reverse the direction, i.e. instead of pushing the number to the zope server, just pull the actual number (via an ExternalMethod) from you monitoring server when the page to show that number is requested - this seems more logical to me anyway. There you could use volatile attributes to cache the number(s).
How I can configure ZODB to only maintains one or two last object states and not grows to the infinite..?
You set up a (cron-) job to pack the database regularly, I don't think there's another solution if you want to use FileStorage (the default) as the underlying database backend for the ZODB. cheers, oliver
On Wednesday 05 February 2003 09:15 am, Oliver Bleutgen wrote:
Antonio Beamud Montero wrote:
Hi all: Well, i have a serious problem... I have defined a variable inside my product that I refresh periodically via XML-RPC (every ~1 min). I need to maintain this variable volatile because ZODB grows to the infinite... The problem arises when a new conection is established an the variable value need to be shown. In some cases the query raises an AttributeException. Now I catch this exception, but this no solves my problem... Why the value of this variable is lost?
Since nobody responded till now, here are my 5c. Volatile attributes are only guaranted to exist as long a transaction AFAIK, OTOH they are also not guaranted to _not_ exist longer, which might explain that you don't see this failure everytime.
Volatiles (_v_ variables) are thread-specific. A request handled by one thread won't see volatiles created on another thread.
So, I fear volatile attributes can't help you here.
How I can solve the problem?
Hmm, an external method which stores the values in a file? A external database? The sessioning stuff?
Sorry, I have no really good idea there, maybe it helps if you explain what you want to do in more detail ...
You can use sessions, but they are user-specific. If it needs to be global to all users, create a persistent class and store an instance in the temp_folder (which is where the seesion data is stored). That is a volatile storage shared between all threads. It will only be lost if Zope restarts. hth, -Casey
Opsss, temp_folder is the solution more closest that I already have... I suppose I can create a temp_folder in my product and store in this folder a object that contains this variables. I'm going to check this solution... A lot of thanks El mié, 05-02-2003 a las 15:50, Casey Duncan escribió:
On Wednesday 05 February 2003 09:15 am, Oliver Bleutgen wrote:
Antonio Beamud Montero wrote:
Hi all: Well, i have a serious problem... I have defined a variable inside my product that I refresh periodically via XML-RPC (every ~1 min). I need to maintain this variable volatile because ZODB grows to the infinite... The problem arises when a new conection is established an the variable value need to be shown. In some cases the query raises an AttributeException. Now I catch this exception, but this no solves my problem... Why the value of this variable is lost?
Since nobody responded till now, here are my 5c. Volatile attributes are only guaranted to exist as long a transaction AFAIK, OTOH they are also not guaranted to _not_ exist longer, which might explain that you don't see this failure everytime.
Volatiles (_v_ variables) are thread-specific. A request handled by one thread won't see volatiles created on another thread.
So, I fear volatile attributes can't help you here.
How I can solve the problem?
Hmm, an external method which stores the values in a file? A external database? The sessioning stuff?
Sorry, I have no really good idea there, maybe it helps if you explain what you want to do in more detail ...
You can use sessions, but they are user-specific. If it needs to be global to all users, create a persistent class and store an instance in the temp_folder (which is where the seesion data is stored). That is a volatile storage shared between all threads. It will only be lost if Zope restarts.
hth,
-Casey -- Microsoft merges technologies: Windows CE + Windows ME + Windows NT = Windows CEMENT
---- Antonio Beamud Montero Agora Systems S.A. http://www.agoratechnologies.com
Antonio Beamud Montero wrote:
Opsss, temp_folder is the solution more closest that I already have... I suppose I can create a temp_folder in my product and store in this folder a object that contains this variables.
I'm going to check this solution...
Yes, I think this solution is indeed the best if you want to stay with the current scheme. cheers, oliver
participants (3)
-
Antonio Beamud Montero -
Casey Duncan -
Oliver Bleutgen