modeling-users Mailing List for Object-Relational Bridge for python (Page 2)
Status: Abandoned
Brought to you by:
sbigaret
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(19) |
Feb
(55) |
Mar
(54) |
Apr
(48) |
May
(41) |
Jun
(40) |
Jul
(156) |
Aug
(56) |
Sep
(90) |
Oct
(14) |
Nov
(41) |
Dec
(32) |
2004 |
Jan
(6) |
Feb
(57) |
Mar
(38) |
Apr
(23) |
May
(3) |
Jun
(40) |
Jul
(39) |
Aug
(82) |
Sep
(31) |
Oct
(14) |
Nov
|
Dec
(9) |
2005 |
Jan
|
Feb
(4) |
Mar
(13) |
Apr
|
May
(5) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2006 |
Jan
(1) |
Feb
(1) |
Mar
(9) |
Apr
(1) |
May
|
Jun
(1) |
Jul
(5) |
Aug
|
Sep
(5) |
Oct
(1) |
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Paul M. <pau...@ma...> - 2006-03-04 00:21:48
|
Hi again, I applied the patch and here are the logs (I deleted the registered =20 callback): <server 1> ------ 2006-03-03T18:53:40 INFO(0) Products.ZEditingContextSessioning Adding =20= a 'defaultEditingContext' attribute to TransientObject ------ 2006-03-03T18:53:40 INFO(0) Products.ZEditingContextSessioning Adding =20= a 'defaultEditingContext' attribute to TransientObject ------ 2006-03-03T18:53:40 INFO(0) Products.ZEditingContextSessioning =20 Product's Control Panel: Properties tab already initialized ------ 2006-03-03T18:53:40 INFO(0) Zope Ready to handle requests </server 1> <server 2> ------ 2006-03-03T18:54:15 INFO(0) Products.ZEditingContextSessioning =20 session's deletion hook already registered ------ 2006-03-03T18:54:15 INFO(0) Products.ZEditingContextSessioning Adding =20= a 'defaultEditingContext' attribute to TransientObject ------ 2006-03-03T18:54:15 INFO(0) Products.ZEditingContextSessioning =20 Product's Control Panel: Properties tab already initialized ------ 2006-03-03T18:54:15 INFO(0) Zope Ready to handle requests </server 2> Also, when tracing defaultEditingContext(), each server seems to =20 return a different EC. Server1: session.id: 11414313110001400458 ec: =20 <Modeling.EditingContext.EditingContext object at 0x284b0f0> Server2: session.id: 11414313110001400458 ec: =20 <Modeling.EditingContext.EditingContext object at 0x26bb9d0> Thanks, Paul On 3-Mar-06, at 18:28 , S=E9bastien Bigaret wrote: > Thanks for all the precisions; this is definitely a situation that =20 > should be detected and handled by the product. > > I've opened ticket #1442766 for that. > http://sourceforge.net/tracker/index.php?=20 > func=3Ddetail&aid=3D1442766&group_id=3D58935&atid=3D489335 > > If you have some time, could you try the attached patch (replacing =20 > the one sent earlier) ? > > I've had some tests and more zLog statements: I've no zeo env. at =20 > hand, I have no time for trying to set up one and I do not have any =20= > real experience w/ zeo environments, so if you could install this =20 > patch and report the observed logs for the second zeoclient, that =20 > will be a great help for me to fully understand how zeo works. In =20 > particular, I'd like to determine whether TransientObject is also =20 > shared and correctly setup or not --I think it is not, and, well, =20 > we'd better be sure! or the second, 3rd etc. zeo instances won't =20 > have any SESSION.defaultEditiingContext. > > -- S=E9bastien. > > > PS: LOG statements at the INFO level for the purpose of =20 > verifications --they should be DEBUG or BLATHER when committed. |
From:
<sbi...@us...> - 2006-03-03 23:30:24
|
Thanks for all the precisions; this is definitely a situation that should= be detected and handled by the product.=20 I've opened ticket #1442766 for that. http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D1442766&grou= p_id=3D58935&atid=3D489335 If you have some time, could you try the attached patch (replacing the on= e sent earlier) ? I've had some tests and more zLog statements: I've no zeo env. at hand, I= have no time for trying to set up one and I do not have any real experie= nce w/ zeo environments, so if you could install this patch and report th= e observed logs for the second zeoclient, that will be a great help for m= e to fully understand how zeo works. In particular, I'd like to determin= e whether TransientObject is also shared and correctly setup or not --I t= hink it is not, and, well, we'd better be sure! or the second, 3rd etc. z= eo instances won't have any SESSION.defaultEditiingContext. -- S=E9bastien. PS: LOG statements at the INFO level for the purpose of verifications --t= hey should be DEBUG or BLATHER when committed. Paul Mylchreest a =E9crit : > Hi S=E9bastien, >=20 > On 3-Mar-06, at 15:50 , S=E9bastien Bigaret wrote: >=20 >> Hi Paul, >> >> Paul Mylchreest wrote : >>> Greetings, >>> >>> In the process of starting my zope server, getting this error: >>> >>> ------ >>> 2006-03-03T10:29:05 ERROR(200) Products.ZEditingContextSessioning The >>> session data container's destruction callback already set -- >>> installation aborted >>> ------ >> >> The message you get is a security mechanism. >> >> It notifies you that an other Product (or maybe you) already set the >> destruction callback of the sessions data container. >> The ZECS (ZEditingContextSessionning) decides not to override it when >> it is already set, because if you (or another Product) already rely on >> it, some special action needs to be taken (namely: calling the already >> registered callback before or after ZECS's one). >> >> Frankly, you're the 1st person reporting such a collision; I suspect >> that the zeo configuration is the reason. >> >> Could you please tell us which callback is registered: in the ZMI, go >> to /temp_folder/session_data and look at the value entered under the >> field 'Script to call when objects are deleted' ? I appreciate your >> time --hopefully we'll quickly find a fix for the problem. >> >=20 > The registered callback is: > "/Control_Panel/Products/ZEditingContextSessioning/sessionDeletion_hook= " >=20 > Starting to understand what happened. At some point, I split my dev > server into a zeoserver config, but with ZECS already installed. >=20 > Here's what I did: uninstall ZECS, clear the callback and reinstall. > Restarting Zope, no error and the callback is set. >=20 > Next, create another zeoclient and start it: now I get the security > warning. >=20 > I think this is happening because the session is now stored in zodb > storage, and not in the instance's home temp storage. >=20 > Thanks for your help S=E9bastien, >=20 >> In the meantime, if you want to try the ZECS despite the problem, just >> apply the attached patch: the installation won't be stopped because of >> that situation. Be aware, however, that the patch shouldn't be >> installed in a production environment if you're using >> SESSION.defaultEditingContext: if the deletion hook is not properly >> installed, then a session's EC will never be garnaged collected when a >> session expires, causing the memory footprint to grow, and grow, and >> grow! >> >> In a test/dev environment this should not be a problem however. >> >> -- S=E9bastien. >=20 >=20 > Paul, |
From: Paul M. <pau...@ma...> - 2006-03-03 21:27:02
|
Hi S=E9bastien, On 3-Mar-06, at 15:50 , S=E9bastien Bigaret wrote: > Hi Paul, > > Paul Mylchreest wrote : >> Greetings, >> >> In the process of starting my zope server, getting this error: >> >> ------ >> 2006-03-03T10:29:05 ERROR(200) Products.ZEditingContextSessioning The >> session data container's destruction callback already set -- >> installation aborted >> ------ > > The message you get is a security mechanism. > > It notifies you that an other Product (or maybe you) already set =20 > the destruction callback of the sessions data container. > The ZECS (ZEditingContextSessionning) decides not to override it =20 > when it is already set, because if you (or another Product) already =20= > rely on it, some special action needs to be taken (namely: calling =20 > the already registered callback before or after ZECS's one). > > Frankly, you're the 1st person reporting such a collision; I =20 > suspect that the zeo configuration is the reason. > > Could you please tell us which callback is registered: in the ZMI, =20 > go to /temp_folder/session_data and look at the value entered under =20= > the field 'Script to call when objects are deleted' ? I appreciate =20= > your time --hopefully we'll quickly find a fix for the problem. > The registered callback is: "/Control_Panel/Products/=20 ZEditingContextSessioning/sessionDeletion_hook" Starting to understand what happened. At some point, I split my dev =20 server into a zeoserver config, but with ZECS already installed. Here's what I did: uninstall ZECS, clear the callback and reinstall. =20 Restarting Zope, no error and the callback is set. Next, create another zeoclient and start it: now I get the security =20 warning. I think this is happening because the session is now stored in zodb =20 storage, and not in the instance's home temp storage. Thanks for your help S=E9bastien, > In the meantime, if you want to try the ZECS despite the problem, =20 > just apply the attached patch: the installation won't be stopped =20 > because of that situation. Be aware, however, that the patch =20 > shouldn't be installed in a production environment if you're using =20 > SESSION.defaultEditingContext: if the deletion hook is not properly =20= > installed, then a session's EC will never be garnaged collected =20 > when a session expires, causing the memory footprint to grow, and =20 > grow, and grow! > > In a test/dev environment this should not be a problem however. > > -- S=E9bastien. Paul,= |
From:
<sbi...@us...> - 2006-03-03 20:52:13
|
Hi Paul, Paul Mylchreest wrote : > Greetings, >=20 > In the process of starting my zope server, getting this error: >=20 > ------ > 2006-03-03T10:29:05 ERROR(200) Products.ZEditingContextSessioning The > session data container's destruction callback already set -- > installation aborted > ------ The message you get is a security mechanism. It notifies you that an other Product (or maybe you) already set the dest= ruction callback of the sessions data container. The ZECS (ZEditingContextSessionning) decides not to override it when it = is already set, because if you (or another Product) already rely on it, s= ome special action needs to be taken (namely: calling the already registe= red callback before or after ZECS's one). Frankly, you're the 1st person reporting such a collision; I suspect that= the zeo configuration is the reason. Could you please tell us which callback is registered: in the ZMI, go to = /temp_folder/session_data and look at the value entered under the field '= Script to call when objects are deleted' ? I appreciate your time --hope= fully we'll quickly find a fix for the problem. In the meantime, if you want to try the ZECS despite the problem, just ap= ply the attached patch: the installation won't be stopped because of that= situation. Be aware, however, that the patch shouldn't be installed in = a production environment if you're using SESSION.defaultEditingContext: i= f the deletion hook is not properly installed, then a session's EC will n= ever be garnaged collected when a session expires, causing the memory foo= tprint to grow, and grow, and grow! In a test/dev environment this should not be a problem however. -- S=E9bastien. > My config is: > OSX Tiger > python 2.3.5 > Zope 2.7.6 > Modeling-0.9 > ZModeling-0.9 >=20 > I have a zeoclient(1)/zeoserver setup and I used > <http://longsleep.org/howto/sharesessionwithzeo> for configuration of > the session storage. Also getting the same error with previous version. >=20 > Any ideas? >=20 > Paul |
From: Paul M. <pau...@ma...> - 2006-03-03 18:05:12
|
Greetings, In the process of starting my zope server, getting this error: ------ 2006-03-03T10:29:05 ERROR(200) Products.ZEditingContextSessioning The session data container's destruction callback already set -- installation aborted ------ My config is: OSX Tiger python 2.3.5 Zope 2.7.6 Modeling-0.9 ZModeling-0.9 I have a zeoclient(1)/zeoserver setup and I used <http:// longsleep.org/howto/sharesessionwithzeo> for configuration of the session storage. Also getting the same error with previous version. Any ideas? Paul |
From:
<sbi...@us...> - 2006-02-26 19:12:35
|
Hi all, After a loooooong time, I'm pleased to announce that version 0.9 is final= ly packaged and released. You'll find it, as usual, on the sourceforge's projet page. It contains an important fix for a bug recently discovered, causing myste= rious failures when the framework is heavily stressed in a multi-threaded= environment. Obviously it also contains all the fixes that were put on the main trunk = since 0.9pre17.1 was released, see CHANGES for details (https://sf.net/pr= oject/shownotes.php?group_id=3D58935&release_id=3D396880). Some already reported bugs remain, they'll be addressed in a future relea= se. By the way: the sources are now under subversion control; good bye cvs! a= nd a big thank you to the sf.net's team. Last, the release is again under a 3-clause BSD license, as it had been p= reviously announced here. -- S=E9bastien. |
From: Sebastien B. <sbi...@us...> - 2006-01-02 14:48:45
|
Hi Richard & all, Richard Smith <ri...@vo...> wrote: > Hi, >=20 > I'm just playing with the Modeller at the moment, and have encountered an > issue generating a model from an XML file. >=20 > Am using all published/recommended/current versions of libraries. >=20 > The only complication is that some of the libraries are in my home dir, > others are in the system python library. Having libs installed in different places is definitely not a pb. >=20 > File > "/usr/lib/python2.4/site-packages/Modeling/ModelMasons/Python_bricks/mode= l.py", > line 80, in respond > SL =3D self._searchList > AttributeError: model instance has no attribute '_searchList' >=20 > Any ideas? I assume you're getting this w/ mdl_generate_python_code.py, right? That's strange, it seems that's something's gone wrong w/ Cheetah compiled files. Could you please give us: - the version of cheetah you use python -c "import Cheetah; print Cheetah.Version" - the 20 first lines of your file /usr/lib/python2.4/site-packages/Modeling/ModelMasons/Python_bricks/model= .py (even if the solution I propose below works for you --I'd like to have the informations in case the problem shows up again) I suspect (even though I was unable to reproduce the problem here) that the version of Cheetah used by python at runtime is not compatible w/ the one with which the bricks were compiled before being packaged. Did you install Cheetah after installing Modeling? Was/is 'cheetah-compile' in your path when installing w/ 'python setup.py install --prefix=3D...' ? You can tell that the setup failed to use cheetah if you get the following message: Warning: compilation of cheetah templates failed: they may be absent, or cheetah-compile is not available. =3D> Using the already compiled templates I suggest that you re-install Modeling w/ setup.py; you won't break anything, and if you do not get the above-mentioned warning messages you're sure that the "bricks" have been recompiled. Hopefully the problem will disappear, then. -- S=E9bastien. |
From: Richard S. <ri...@vo...> - 2005-12-31 02:40:23
|
Hi, I'm just playing with the Modeller at the moment, and have encountered an issue generating a model from an XML file. Am using all published/recommended/current versions of libraries. The only complication is that some of the libraries are in my home dir, others are in the system python library. File "/usr/lib/python2.4/site-packages/Modeling/ModelMasons/Python_bricks/model.py", line 80, in respond SL = self._searchList AttributeError: model instance has no attribute '_searchList' Any ideas? -- Richard Smith Platform Engineer, VoIP.co.uk Tel: +44 (0) 1908 764196 |
From: Greg W. <gvw...@cs...> - 2005-08-09 17:53:00
|
Hi, I'm working with support from the Python Software Foundation to develop an open source course on basic software development skills for people with backgrounds in science and engineering. I have a beta version of the course notes ready for review, and would like to pull in people in sci&eng to look it over and give me feedback. If you know anyone who fits this bill (particularly people who might be interested in following along with a trial run of the course this fall), I'd be grateful for pointers. Thanks, Greg Wilson |
From: James L. <ja...@gm...> - 2005-06-10 16:59:08
|
Greetings, In order to get mdl_generate_python_code.py to work for a valid xml input, I needed to extend the fix provided in the url below: https://sourceforge.net/mailarchive/message.php?msg_id=3D9657727 The additional fix is as follows: Index: Modeling/scripts/mdl_generate_python_code.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/modeling/ProjectModeling/Modeling/scripts/mdl_generate_p= ython_code.py,v retrieving revision 1.11 diff -u -r1.11 mdl_generate_python_code.py --- Modeling/scripts/mdl_generate_python_code.py 30 Nov 2004 17:25:35 -0000 1.11 +++ Modeling/scripts/mdl_generate_python_code.py 10 Jun 2005 16:55:10 -0000 @@ -178,7 +178,7 @@ from Modeling.ModelValidation import NOT_SUPPORTED,ERROR,WARNING,INFO,DE= BUG errors=3DMV.ModelValidationException(ignore_levels=3D[DEBUG,INFO,WARNING= ]) MV.validateModel(model, errors) - if errors: + if errors.has_errors(): log("Error: model has errors") if verbose: log(str(errors)) else: log("(-v for details)") This appears to resolve the issue for me. Thanks to Lorenzo Gil Sanchez for the original fix. James Laska |
From: Neateye <nit...@ao...> - 2005-06-08 23:24:26
|
Call out Gouranga be happy!!! Gouranga Gouranga Gouranga .... That which brings the highest happiness!! |
From: Sebastien B. <sbi...@us...> - 2005-05-31 20:48:52
|
Hi James, James Laska <ja...@gm...> wrote: > Hello, >=20 > Is there a method for tagging a column as UNIQUE so that multiple > copies cannot be inserted into the database? I do not see a isUnique > property in any of the attributes. Am I looking in the wrong place or > is there an alternative way to define this? Is this simply a method > of defining multiple primaryKeys for an entity (although that does not > appear to be valid)? Well, there is no method for this working "out of the box". Multiple primary keys are not supported yet, and I've currently no idea how long it could take implementing that. The simplest method is certainly to declare 'UNIQUE' the row you want to be unique --and/or add whatever constraint you need in the database schema. Doing this, you're sure that you'll get an error when trying to saveChanges(). However, you're not going to get an error at validation time, which is maybe something you'd like to get (even if business logic cannot *guarantee* that the value will be unique in the db at the time when it is actually commited in the db). If you want to go that way, you'll probably want to check whether ec.fetchCount() returns >1 when asked, say, for entity 'Book' and qualifier 'book.title=3D"The Hitchhiker's Guide to the Galaxy", if this is the value self.title and you want 'title' to be unique. Got the idea? -- S=E9bastien. |
From: James L. <ja...@gm...> - 2005-05-27 12:06:42
|
Hello, Is there a method for tagging a column as UNIQUE so that multiple copies cannot be inserted into the database? I do not see a isUnique property in any of the attributes. Am I looking in the wrong place or is there an alternative way to define this? Is this simply a method of defining multiple primaryKeys for an entity (although that does not appear to be valid)? Thank you, James Laska |
From: Sebastien B. <sbi...@us...> - 2005-05-23 14:00:34
|
Hi James, James Laska <ja...@gm...> wrote: > Sorry to respond to my own post. >=20 > It appears this error was triggered by an incorrect specification of > the 'name' attribute of the <entity>. >=20 > Failed with: > <entity name=3D'prefix_project' externalName=3D'prefix_project' > className=3D'Project'> >=20 > Works with: > <entity name=3D'Project' externalName=3D'prefix_project' className=3D'P= roject'> >=20 Just a note even if you already solved your problem, to help making things clearer in case they need to. There is a priori no reason for className, externalName and entity's name to be the same. Class name is, well, the class name ;) the external name is the name of the corresponding table in the database, and the entity's name is the identifier the framework uses for that kind of object. This explains the behaviour you previously got, because EC.fetch() and EC.fetchCount() take an entity's name as their 1st parameter http://modeling.sf.net/API/Modeling-API/public/Modeling.EditingContext.Edit= ingContext-class.html#fetch So if you want to keep 'prefix_project' as the entity's name, such as in: <entity name=3D'prefix_project' externalName=3D'prefix_project' className=3D'Project'> then you'll ask for that entity. So, as you noticed, this fails: >>> ec.fetchCount('Project') because there is no such entity named 'Project'; however, this succeeds: >>> ec.fetchCount('prefix_project') -- S=E9bastien. > On 5/22/05, James Laska <ja...@gm...> wrote: > > Greetings, > >=20 > > I am new to the Modeling framework and have been reading the > > UsersGuide and working through examples in the document and in tests/. > > I am at the stage where I have defined a sample model (xml). I can > > use that model to generate the python classes and the DB schema. > >=20 > > $ find testmdl/ -type f -name "*py" > > testmdl/setup.py > > testmdl/MDL/__init__.py > > testmdl/MDL/Project.py > > testmdl/MDL/model_testmdl.py > > testmdl/__init__.py > > testmdl/Project.py > >=20 > > I am also able to insert new values into my tables: > >=20 > > >>> from Modeling.EditingContext import EditingContext > > >>> from testmdl.Project import Project > > >>> ec =3D EditingContext() > > >>> p =3D Project() > > >>> p.setTitle("Testing 1 2 3") > > >>> ec.insert(p) > > >>> ec.saveChanges() > >=20 > > However, when it comes to ec.fetch() or ec.fetchCount() I continue to > > get a traceback (regardless of whether or not I provide a qualifier): > >=20 > > >>> ec.fetchCount('Project') > > Traceback (most recent call last): > > File "<stdin>", line 1, in ? > > File "/usr/lib/python2.4/site-packages/Modeling/EditingContext.py", > > line 1259, in fetchCount > > fs=3DFetchSpecification(entityName, qualifier=3Dqualifier, deepFlag= =3DisDeep) > > File "/usr/lib/python2.4/site-packages/Modeling/FetchSpecification.py= ", > > line 52, in __init__ > > raise ValueError, 'Unable to find a ClassDescription for > > entityName: %s. Is the corresponding model loaded?'%entityName > > ValueError: Unable to find a ClassDescription for entityName: Project. > > Is the corresponding model loaded? > >=20 > > I can see that my previous insert(s) were properly INSERTed in to the t= able: > >=20 > > > select proj_id, proj_title from project; > >=20 > > proj_id | proj_title > > ---------+--------------- > > 1 | First > > 2 | Testing 1 2 3 > >=20 > > Any thoughts on what I might be missing? I searched the list archives > > (and google) for the same ValueError but have turned up empty. I have > > also been poking through FetchSpecification+classDescriptionForName > > but have turned up nothing so far. I have installed out of a cvs > > checkout as of last week (2005-05-17). > >=20 > > Any help or guidance would be appreciated. |
From: James L. <ja...@gm...> - 2005-05-22 14:50:09
|
Sorry to respond to my own post. It appears this error was triggered by an incorrect specification of the 'name' attribute of the <entity>. Failed with: <entity name=3D'prefix_project' externalName=3D'prefix_project' className=3D'Project'> Works with: <entity name=3D'Project' externalName=3D'prefix_project' className=3D'Pro= ject'> Thanks, James Laska On 5/22/05, James Laska <ja...@gm...> wrote: > Greetings, >=20 > I am new to the Modeling framework and have been reading the > UsersGuide and working through examples in the document and in tests/. > I am at the stage where I have defined a sample model (xml). I can > use that model to generate the python classes and the DB schema. >=20 > $ find testmdl/ -type f -name "*py" > testmdl/setup.py > testmdl/MDL/__init__.py > testmdl/MDL/Project.py > testmdl/MDL/model_testmdl.py > testmdl/__init__.py > testmdl/Project.py >=20 > I am also able to insert new values into my tables: >=20 > >>> from Modeling.EditingContext import EditingContext > >>> from testmdl.Project import Project > >>> ec =3D EditingContext() > >>> p =3D Project() > >>> p.setTitle("Testing 1 2 3") > >>> ec.insert(p) > >>> ec.saveChanges() >=20 > However, when it comes to ec.fetch() or ec.fetchCount() I continue to > get a traceback (regardless of whether or not I provide a qualifier): >=20 > >>> ec.fetchCount('Project') > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "/usr/lib/python2.4/site-packages/Modeling/EditingContext.py", > line 1259, in fetchCount > fs=3DFetchSpecification(entityName, qualifier=3Dqualifier, deepFlag= =3DisDeep) > File "/usr/lib/python2.4/site-packages/Modeling/FetchSpecification.py", > line 52, in __init__ > raise ValueError, 'Unable to find a ClassDescription for > entityName: %s. Is the corresponding model loaded?'%entityName > ValueError: Unable to find a ClassDescription for entityName: Project. > Is the corresponding model loaded? >=20 > I can see that my previous insert(s) were properly INSERTed in to the tab= le: >=20 > > select proj_id, proj_title from project; >=20 > proj_id | proj_title > ---------+--------------- > 1 | First > 2 | Testing 1 2 3 >=20 > Any thoughts on what I might be missing? I searched the list archives > (and google) for the same ValueError but have turned up empty. I have > also been poking through FetchSpecification+classDescriptionForName > but have turned up nothing so far. I have installed out of a cvs > checkout as of last week (2005-05-17). >=20 > Any help or guidance would be appreciated. > |
From: James L. <ja...@gm...> - 2005-05-22 14:20:46
|
Greetings, I am new to the Modeling framework and have been reading the UsersGuide and working through examples in the document and in tests/. I am at the stage where I have defined a sample model (xml). I can use that model to generate the python classes and the DB schema. $ find testmdl/ -type f -name "*py" testmdl/setup.py testmdl/MDL/__init__.py testmdl/MDL/Project.py testmdl/MDL/model_testmdl.py testmdl/__init__.py testmdl/Project.py I am also able to insert new values into my tables: >>> from Modeling.EditingContext import EditingContext >>> from testmdl.Project import Project >>> ec =3D EditingContext() >>> p =3D Project() >>> p.setTitle("Testing 1 2 3") >>> ec.insert(p) >>> ec.saveChanges() However, when it comes to ec.fetch() or ec.fetchCount() I continue to get a traceback (regardless of whether or not I provide a qualifier): >>> ec.fetchCount('Project') Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.4/site-packages/Modeling/EditingContext.py", line 1259, in fetchCount fs=3DFetchSpecification(entityName, qualifier=3Dqualifier, deepFlag=3Di= sDeep) File "/usr/lib/python2.4/site-packages/Modeling/FetchSpecification.py", line 52, in __init__ raise ValueError, 'Unable to find a ClassDescription for entityName: %s. Is the corresponding model loaded?'%entityName ValueError: Unable to find a ClassDescription for entityName: Project. Is the corresponding model loaded? I can see that my previous insert(s) were properly INSERTed in to the table= : > select proj_id, proj_title from project; proj_id | proj_title ---------+--------------- 1 | First 2 | Testing 1 2 3 Any thoughts on what I might be missing? I searched the list archives (and google) for the same ValueError but have turned up empty. I have also been poking through FetchSpecification+classDescriptionForName but have turned up nothing so far. I have installed out of a cvs checkout as of last week (2005-05-17). Any help or guidance would be appreciated. |
From: Sebastien B. <sbi...@us...> - 2005-03-18 18:01:05
|
John Lenton <jl...@gm...> wrote: > Thank you very much for your reply. Just one small doubt > remains: > > > On Fri, 18 Mar 2005 12:18:57 +0100, Sebastien Bigaret > <sbi...@us...> wrote: > > > > And, if you do this: just make sure that > > > > - either task.getMeal().isFault() == true > > > > - or that, in case it is not, that > > task.getMeal().getTasks().isFault()==true > > > > In this last case, if it is false, then you can do the > > meal.addToTasks(task) without any overhead, since this > indicate > > that > > the fetch has already be done. > > is there any case where the last line would return false, > instead of > raising an AttributeError? Good question ;) Here are the details First situation: you have a newly created object ; in this case, meal.getTasks() will be a real python list (actually a list or a tuple), assigned by the constructor, and you'll get an AttributeError. Second situation: the object has been fetched by the framework. In this case, any attribute corresponding to a tomany relationship is initialized with the so-called <<to-many fault>> object, responsible for lazily initializing the list when appropriate. If you're curious, you'll have a look at FaultHandler.AccessArrayFaultHandler, which is the corresponding class proxying the underlying list. So, in this case, you'll get a true or false answer when asking meal.getTasks().isFault(). As a conclusion, you're right, you have to check for AttributeError as well and your code will handle all possible situations. -- Sébastien. -- Sébastien. |
From: John L. <jl...@gm...> - 2005-03-18 14:22:34
|
Thank you very much for your reply. Just one small doubt remains: On Fri, 18 Mar 2005 12:18:57 +0100, Sebastien Bigaret <sbi...@us...> wrote: > > And, if you do this: just make sure that > > - either task.getMeal().isFault() == true > > - or that, in case it is not, that > task.getMeal().getTasks().isFault()==true > > In this last case, if it is false, then you can do the > meal.addToTasks(task) without any overhead, since this indicate > that > the fetch has already be done. is there any case where the last line would return false, instead of raising an AttributeError? -- John Lenton (jl...@gm...) -- Random fortune: Don't anthropomorphise computers and cars, They hate that. |
From: Sebastien B. <sbi...@us...> - 2005-03-18 11:19:06
|
John Lenton <jl...@gm...> wrote: > On 11 Mar 2005 22:19:37 +0100, Sebastien Bigaret > <sbi...@us...> wrote: > > > > *Big fat warning* (!): do that if you're absolutely sure that the > > related 'need', 'team' and 'mealType' objects are not already > > fetched in other ECs, *or*, if they are fetched, that the "inverse" > > tomany faults are not cleared. > > If I read you correctly then I'm safe, because I never do > > need.setTasks(None) > > (is this what you mean by clearing the tomany faults?) My apologize John, I'm afraid I was not clear (!) at all, too much jargon I guess. What I meant by "clearing the fault" was the same as "triggering the fault", in clear: fetching the objects corresponding to a to-many fault to turn the fault into a real list populated w/ the corresponding objects. For example, need.getTasks() returns a fault, but calling len() on it, or accessing a member as in need.getTasks()[0], or inserting a new element in the list, triggers the fault and makes the framework fetch the objects==the related tasks. > > > > Respectively, check that (for 'need', same for 'team' and > > 'mealType'): > > > > db=ec.rootObjectStore().objectStoreForObject(task).database() > > > > task_need_gID=task.getNeed().globalID() > > db.snapshotForGlobalID(task_need_gID=task) # None if unfetched yet > > > > and if it's not None: > > > > db.snapshotForSourceGlobalID(task_need_gID, 'tasks') # should be () > > > > Otherwise you may experience weird side-effects on the corresponding > > objects already fetched in other ECs, esp. when saving them (no > > pb. if you use a single EC in the app., however). > > I'm not clear what the purpose of this is: is it to ensure that the > task.setMeal(None) is safe? The purpose of the code I posted was to make sure that there does *not* exist an other EditingContext where the same object task.getNeed() has been fetched and where the list task.getNeed().getTasks() is not a fault anymore. However I must now admit that the warning I wrote in my last post was in fact exagerated [1]: the only problem you can have is to override changes that have been made in an other EC --and the problem we're discussing here is just a particular point in a more general category of problems, the one exposed at http://modeling.sf.net/UserGuide/framework-integration-sessioning-ec.html and which has nothing to do in particular with relationships, but w/ an object's properties in general. So you can forget that code, see below for a simpler one. A related questions BTW: are you using patch #911567 ? https://sf.net/tracker/index.php?func=detail&aid=911567&group_id=58935&atid=489337 (which is a first step toward the resolution of the problem) > basically what I'll be doing, unless you tell me otherwise, is: > > - for creating, do the task.setMeal(meal) but not the meal.addToTasks(task) > - for deleteing, do the task.setMeal(None) but not the > meal.removeFromTasks(task) > > given that I never, ever (promise! :D) clear the tasks, and that I > always saveChanges after deleteing or creating each task, although I > have many editingContexts (inside zope, one per session using > ZEditingContextSessioning), it is my understanding that I'll be safe. > Right? Okay, you can do this to *accelerate* the process of inserting, and removing tasks. However, say, if a meal always have a reasonable number of related tasks, then the overhead of fetching those meal's tasks won't be noticeable, so in this case you'd better update the two sides of the relationships (same for Teams and Needs). So the answer is: yes, do this w/ every kind of objects that *may* hold a real bunch of tasks (the kind(s) of objects that may be related to +20,000 tasks, as seen in the previous posts). And, if you do this: just make sure that - either task.getMeal().isFault() == true - or that, in case it is not, that task.getMeal().getTasks().isFault()==true In this last case, if it is false, then you can do the meal.addToTasks(task) without any overhead, since this indicate that the fetch has already be done. Sorry again for having obfuscated the problem by my previous answer, hopefully this is clearer now. -- Sébastien. PS: my previous remarks about the possibility for the framework to be smarter in the situation where the only modification is the addition or removal of objects from a list are still valid, though. [1] I had in mind that the cache of to-many faults might become desynchronized wrt the database state, but since I checked the code and the TODO list and realized that since cache is not used for now, no such problem can happen ;) |
From: John L. <jl...@gm...> - 2005-03-15 16:44:45
|
On 11 Mar 2005 22:19:37 +0100, Sebastien Bigaret <sbi...@us...> wrote: > > *Big fat warning* (!): do that if you're absolutely sure that the > related 'need', 'team' and 'mealType' objects are not already > fetched in other ECs, *or*, if they are fetched, that the "inverse" > tomany faults are not cleared. If I read you correctly then I'm safe, because I never do need.setTasks(None) (is this what you mean by clearing the tomany faults?) > > Respectively, check that (for 'need', same for 'team' and > 'mealType'): > > db=ec.rootObjectStore().objectStoreForObject(task).database() > > task_need_gID=task.getNeed().globalID() > db.snapshotForGlobalID(task_need_gID=task) # None if unfetched yet > > and if it's not None: > > db.snapshotForSourceGlobalID(task_need_gID, 'tasks') # should be () > > Otherwise you may experience weird side-effects on the corresponding > objects already fetched in other ECs, esp. when saving them (no > pb. if you use a single EC in the app., however). I'm not clear what the purpose of this is: is it to ensure that the task.setMeal(None) is safe? basically what I'll be doing, unless you tell me otherwise, is: - for creating, do the task.setMeal(meal) but not the meal.addToTasks(task) - for deleteing, do the task.setMeal(None) but not the meal.removeFromTasks(task) given that I never, ever (promise! :D) clear the tasks, and that I always saveChanges after deleteing or creating each task, although I have many editingContexts (inside zope, one per session using ZEditingContextSessioning), it is my understanding that I'll be safe. Right? -- John Lenton (jl...@gm...) -- Random fortune: Don't anthropomorphise computers and cars, They hate that. |
From: Sebastien B. <sbi...@us...> - 2005-03-11 21:19:48
|
John Lenton <jl...@gm...> wrote: > On 10 Mar 2005 15:10:59 +0100, Sebastien Bigaret > <sbi...@us...> wrote: > >=20 > > I'd like to understand why so many objects are fetched (is there, by any > > chance, a to-many relationships without an inverse relationship defined > > pointing back to the object?) >=20 > I'm pretty certain there isn't; this is the entity I'm deleting (sans > the non-relationship properties): Just to be clear: I did not meant that having such a relationship (without an inverse defined) is a bad thing, I was just thinking loudly about the reason why so much objects were fetched... but I did not think about the (now) obvious reasons: >=20 > Entity ('Task', > properties=3D [ > RToOne ('need', 'Need', joinSemantic=3D2, inverse=3D'task= s'), > RToOne ('team', 'Team', joinSemantic=3D2, inverse=3D'task= s'), > RToOne ('mealType', 'MealType', joinSemantic=3D2, > inverse=3D'tasks'), > ], > ), >=20 > the weird thing is that the entities it loads are all Tasks, the same > thing (a whole load of Tasks getting loaded) happens upon insert; what > triggers it in that case is >=20 > team.addToTasks(task) >=20 > whereas on the previous line I have a >=20 > need.addToTasks(task) >=20 > and that doesn't trigger it. Okay: when addToTasks() is called: 1. the to-many fault is triggered, fetching all related objects and populating the corresponding list, here 'self._tasks' probably, 2. the new task is added to the list. The fact that need.addToTasks(task) does not trigger any fetch simply means that the to-many faults is already cleared --or that it also triggers the fetch but you do not notice it since that 'need' object does not have (many) tasks assigned. Back to your problem in ec.delete(task): when ec.processRecentChanges() is called, it examines your object's relationships: 'need', 'team' and 'mealType', all three being of type DELETE_NULLIFY. So: at processRecentChanges() time the ec takes care of the deletion policy. For that purpose, in this case it gets these 3 related objects: need, team and mealType (using KeyValueCoding) and removes the deleted object 'task' from their tasks... but when it does that, *it triggers all three to-many faults*: need.tasks, team.tasks and mealType.tasks... and I suspect that at least one of them is quite big. Now we know why we have 1 deleted object, 3 updated ones (the related need, team and mealType), and a bunch of fetched Tasks in the ec after processRecentChanges(). And your next question will probably be: okay, and how to change that behaviour? Here is a description of what should be a definitive solution, and then a workaround you may use till that solution is implemented. Changing the default baheviour requires that ec.processRecentChanges() becomes smarter: it should be changed so that it detects that the related objects 'need', 'team' and 'mealType' do not need to be fetched if they are not cached yet, or that their to-many faults 'tasks' should not be cleared if they hasn't been yet (including: in an other EC), because simply deleting the object removes the only information where both the relationship and its inverse is stored: the Foreign Key stored in the deleted object tasks's DB-row pointing to resp. tables NEED, TEAM and MEAL_TYPE. [1] I probably won't have the time for this in the coming weeks; I'm currently overwhelmed by work and (luckily!) personal activities. In the mean time you can bypass that behaviour by removing the related objects: task.setNeed(None) task.setTeam(None) task.setMealType(None) ec.delete(task) ec.saveChanges() Note: if, for example, the related 'team' object is the only one that has a big bunch of 'Tasks in stored in its inverse relationship, you can simply setTeam(None) and leave the other objects be fetched and updated by the default behaviour. I'm saying this because there is a=20 *Big fat warning* (!): do that if you're absolutely sure that the related 'need', 'team' and 'mealType' objects are not already fetched in other ECs, *or*, if they are fetched, that the "inverse" tomany faults are not cleared. Respectively, check that (for 'need', same for 'team' and 'mealType'): db=3Dec.rootObjectStore().objectStoreForObject(task).database() task_need_gID=3Dtask.getNeed().globalID() db.snapshotForGlobalID(task_need_gID=3Dtask) # None if unfetched yet and if it's not None: db.snapshotForSourceGlobalID(task_need_gID, 'tasks') # should be () Otherwise you may experience weird side-effects on the corresponding objects already fetched in other ECs, esp. when saving them (no pb. if you use a single EC in the app., however). Hopefully this will help. -- S=E9bastien. [1] some further notes about the internals you can safely ignore (I'll use this post when working on the problem later): to be precise, propagateDeleteForObject() should be changed here. And the Database's cache should also be changed accordingly, esp. in case where the related objects are already fetched and the corresponding to-many faults are already cleared. Plus, when notification of changes is implemented, notification of changes for related objects should be posted as well (even if the objects are not actually fetched nor their tomany faults cleared for efficiency reasons)--this implies that EntityClassDescription's method propagateDeleteForObject() has a mean to communicate that information back to the EC for use at the end of the saveChanges() process when notifications are broadcasted) >=20 > Here are the Relationships defined in both Need and Team: >=20 > Entity ('Team', > properties=3D [ > RToOne ('offer', 'Offer', joinSemantic=3D2, inverse=3D'te= ams'), > RToMany ('tasks', 'Task', inverse=3D'team'), > RToMany ('userTeams', 'UserTeam', inverse=3D'team'), > ], > ), > Entity ('Need', > properties=3D [ > RToOne ('category', 'Category', joinSemantic=3D2, > inverse=3D'needs'), > RToOne ('sponsor', 'User', joinSemantic=3D2, inverse=3D'n= eeders'), > RToOne ('offer', 'Offer', joinSemantic=3D2, inverse=3D'ne= eds'), > RToOne ('user', 'User', joinSemantic=3D2, inverse=3D'need= s'), > RToOne ('visibility', 'Visibility', joinSemantic=3D2, > inverse=3D'needs'), > RToMany ('tasks', 'Task', inverse=3D'need'), > ], > ), >=20 >=20 > --=20 > John Lenton (jl...@gm...) -- Random fortune: > Don't anthropomorphise computers and cars, They hate that. |
From: John L. <jl...@gm...> - 2005-03-10 16:20:54
|
On 10 Mar 2005 15:10:59 +0100, Sebastien Bigaret <sbi...@us...> wrote: > > I'd like to understand why so many objects are fetched (is there, by any > chance, a to-many relationships without an inverse relationship defined > pointing back to the object?) I'm pretty certain there isn't; this is the entity I'm deleting (sans the non-relationship properties): Entity ('Task', properties= [ RToOne ('need', 'Need', joinSemantic=2, inverse='tasks'), RToOne ('team', 'Team', joinSemantic=2, inverse='tasks'), RToOne ('mealType', 'MealType', joinSemantic=2, inverse='tasks'), ], ), the weird thing is that the entities it loads are all Tasks, the same thing (a whole load of Tasks getting loaded) happens upon insert; what triggers it in that case is team.addToTasks(task) whereas on the previous line I have a need.addToTasks(task) and that doesn't trigger it. Here are the Relationships defined in both Need and Team: Entity ('Team', properties= [ RToOne ('offer', 'Offer', joinSemantic=2, inverse='teams'), RToMany ('tasks', 'Task', inverse='team'), RToMany ('userTeams', 'UserTeam', inverse='team'), ], ), Entity ('Need', properties= [ RToOne ('category', 'Category', joinSemantic=2, inverse='needs'), RToOne ('sponsor', 'User', joinSemantic=2, inverse='needers'), RToOne ('offer', 'Offer', joinSemantic=2, inverse='needs'), RToOne ('user', 'User', joinSemantic=2, inverse='needs'), RToOne ('visibility', 'Visibility', joinSemantic=2, inverse='needs'), RToMany ('tasks', 'Task', inverse='need'), ], ), -- John Lenton (jl...@gm...) -- Random fortune: Don't anthropomorphise computers and cars, They hate that. |
From: Sebastien B. <sbi...@us...> - 2005-03-10 14:13:12
|
John Lenton <jl...@gm...> wrote: > On 05 Mar 2005 16:31:38 +0100, Sebastien Bigaret > <sbi...@us...> wrote: > >=20 > > Even better, if you can, change ec.delete/ec.saveChange into: > >=20 > > ec.delete(obj) > > print ec.currentStateSummary() # print it or log it if this is a web = app > > ec.processRecentChanges() > > print ec.currentStateSummary() > > ec.saveChanges() > > print ec.currentStateSummary() >=20 > instead of the print I did >=20 > print >> sys.stderr, '***', pprint.pformat(ec.currentStateSummary()) >=20 > and here is the output: >=20 > *** {'auto_insertion': 0, > 'deleted': 0, > 'inserted': 0, > 'nb_objects': 2311, > 'pending_deleted': 1, > 'pending_inserted': 0, > 'pending_updated': 2, > 'time': 1110383332.976902, > 'updated': 0} > *** {'auto_insertion': 0, > 'deleted': 1, > 'inserted': 0, > 'nb_objects': 21184, > 'pending_deleted': 0, > 'pending_inserted': 0, > 'pending_updated': 0, > 'time': 1110383439.4831209, > 'updated': 3} > *** {'auto_insertion': 0, > 'deleted': 0, > 'inserted': 0, > 'nb_objects': 21183, > 'pending_deleted': 0, > 'pending_inserted': 0, > 'pending_updated': 0, > 'time': 1110383446.224946, > 'updated': 0} Bad news, most of the time is eaten by processRecentChanges()... which fetches 18873 objects and modifies 3 of them. I can't see where it can occur except in EntityClassDexcription's propagateDeleteForObject(). Can you be a little more explicit about the model (maybe w/ names like A, B and Cs if you cannot disclose the real names), and esp. the relationship between the deleted object's entity and other entities? As far as I can see, the propagation of the deletion implies the modification of 3 objects, so the relationship linking these objects to the deleted object must be a DELETE_NULLIFY one; now I'd like to know more about the type of the relationships (toone/tomany). In particular, I'd like to understand why so many objects are fetched (is there, by any chance, a to-many relationships without an inverse relationship defined pointing back to the object?) -- S=E9bastien. NB: In case it might help: you can quickly see how many objects of which type are in the ec w/ something like:: d=3D{} # { "entity name": nb_of_objects } for gID in ec._uniquingTable.globalIDs(): d[gID.entityName()] =3D d.setdefault(gID.entityName(), 0) + 1 |
From: John L. <jl...@gm...> - 2005-03-09 15:55:34
|
On 05 Mar 2005 16:31:38 +0100, Sebastien Bigaret <sbi...@us...> wrote: > > Even better, if you can, change ec.delete/ec.saveChange into: > > ec.delete(obj) > print ec.currentStateSummary() # print it or log it if this is a web app > ec.processRecentChanges() > print ec.currentStateSummary() > ec.saveChanges() > print ec.currentStateSummary() instead of the print I did print >> sys.stderr, '***', pprint.pformat(ec.currentStateSummary()) and here is the output: *** {'auto_insertion': 0, 'deleted': 0, 'inserted': 0, 'nb_objects': 2311, 'pending_deleted': 1, 'pending_inserted': 0, 'pending_updated': 2, 'time': 1110383332.976902, 'updated': 0} *** {'auto_insertion': 0, 'deleted': 1, 'inserted': 0, 'nb_objects': 21184, 'pending_deleted': 0, 'pending_inserted': 0, 'pending_updated': 0, 'time': 1110383439.4831209, 'updated': 3} *** {'auto_insertion': 0, 'deleted': 0, 'inserted': 0, 'nb_objects': 21183, 'pending_deleted': 0, 'pending_inserted': 0, 'pending_updated': 0, 'time': 1110383446.224946, 'updated': 0} -- John Lenton (jl...@gm...) -- Random fortune: Don't anthropomorphise computers and cars, They hate that. |
From: Sebastien B. <sbi...@us...> - 2005-03-05 21:09:42
|
John Lenton <jl...@gm...> wrote: > I'm guessing you forgot the patch? That's right! Here it is: Index: Modeling/EditingContext.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/EditingContext.py,v retrieving revision 1.34 diff -u -r1.34 EditingContext.py --- Modeling/EditingContext.py 20 Jul 2004 06:21:37 -0000 1.34 +++ Modeling/EditingContext.py 5 Mar 2005 15:41:26 -0000 @@ -351,6 +351,23 @@ # Registering for notifications __TBD + def currentStateSummary(self): + """ + Returns some informations about the EditingContext, such as the number of + objects it holds, the number of inserted objects, etc. + """ + info={} + import time + info['time'] = time.time() + info['nb_objects'] = len(self._uniquingTable.globalIDs()) + info['inserted'] = len(self._insertedObjects) + info['updated' ] = len(self._updatedObjects) + info['deleted' ] = len(self._deletedObjects) + info['pending_inserted'] = len(self._pendingInsertedObjects) + info['pending_updated' ] = len(self._pendingUpdatedObjects) + info['pending_deleted' ] = len(self._pendingDeletedObjects) + info['auto_insertion'] = self._propagatesInsertionForRelatedObjects + return info # Changes within the editing context def allDeletedGlobalIDs(self): |