Daniel Dehennin | 1 Feb 2012 14:53

Closing connection

Hello,

I'm looking at improving tests of rebuildd[1].

The test suite create and delete the database[2] for each test in the
setUp()[3] method, but sqlobject don't like it.

The first test is OK but all successives ones fail with "disk I/O error".

I found a thread[4] on the list speaking about the same issue but I do
not manage to fix my tests.

Any hints?

Regards.

Footnotes: 
[1]  http://packages.qa.debian.org/rebuildd

[2]  http://anonscm.debian.org/gitweb/?p=rebuildd/rebuildd.git;a=blob;f=tests/RebuilddTestSetup.py;h=d677d8e481baada9218d9f86687a818c87b28582;hb=HEAD

[3]  http://anonscm.debian.org/gitweb/?p=rebuildd/rebuildd.git;a=blob;f=tests/TestJob.py;h=20e81d6c3de9a50ddb4a95c04593d739f31dbec8;hb=HEAD#l16

[4]  http://thread.gmane.org/gmane.comp.python.sqlobject/5769

--

-- 
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1
(Continue reading)

Oleg Broytman | 1 Feb 2012 15:14
X-Face
Favicon
Gravatar

Re: Closing connection

On Wed, Feb 01, 2012 at 02:53:20PM +0100, Daniel Dehennin wrote:
> I found a thread[4] on the list speaking about the same issue
> [4]  http://thread.gmane.org/gmane.comp.python.sqlobject/5769

   The thread has the answer, IMO.

> but I do not manage to fix my tests.

   What's up?

Oleg.
--

-- 
     Oleg Broytman            http://phdru.name/            phd <at> phdru.name
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
Daniel Dehennin | 1 Feb 2012 15:28

Re: Closing connection

Oleg Broytman <phd <at> phdru.name> writes:

> On Wed, Feb 01, 2012 at 02:53:20PM +0100, Daniel Dehennin wrote:
>> I found a thread[4] on the list speaking about the same issue
>> [4]  http://thread.gmane.org/gmane.comp.python.sqlobject/5769
>
>    The thread has the answer, IMO.

So, I should have not understand:

#+begin_src
test_init_job (TestJob.TestJob) ... E: setUp Cannot operate on a closed database.
#+end_src

I move the os.unlink fro the setUp() to tearDown() which call a new function:

#+begin_src python
def rebuildd_global_test_teardown():
        try:
            Rebuildd().sqlconnection.close()
	    sqlobject.sqlhub.processConnection = Rebuildd().sqlconnection
	    sqlobject.dbconnection.TheURIOpener.cachedURIs={}
            os.unlink("/tmp/rebuildd-tests.db")
        except Exception, e:
            print "E: tearDown %s" % e
            pass
#+end_src

Regards.
--

-- 
(Continue reading)

Oleg Broytman | 1 Feb 2012 16:49
X-Face
Favicon
Gravatar

Re: Closing connection

On Wed, Feb 01, 2012 at 03:28:30PM +0100, Daniel Dehennin wrote:
>             Rebuildd().sqlconnection.close()

   Aha, got it. You've stumbled upon a subtle bug in SQLiteConnection.
SQLiteConnection uses a different (from its parent class DBAPI)
implementation of .getConnection() and maintain its own pool -
._threadPool along with DBAPI._pool. But it doesn't clear the pool on
.close().

   The quick-and-dirty solution for you is to clear the pool yourself:

            Rebuildd().sqlconnection.close()
            Rebuildd().sqlconnection._threadPool = {}

   I'll add a proper .close() to SQLiteConnection.

> 	    sqlobject.sqlhub.processConnection = Rebuildd().sqlconnection

   You preserve an old SQLiteConnection, so you don't need the
following:

> 	    sqlobject.dbconnection.TheURIOpener.cachedURIs={}

   The workaround is for the case when you want to create a new
SQLiteConnection like this:

            Rebuildd().sqlconnection = connectionForURI(...)

   And, BTW, this

(Continue reading)

Daniel Dehennin | 1 Feb 2012 19:21

Re: Closing connection

Oleg Broytman <phd <at> phdru.name> writes:

>    Aha, got it. You've stumbled upon a subtle bug in SQLiteConnection.
> SQLiteConnection uses a different (from its parent class DBAPI)
> implementation of .getConnection() and maintain its own pool -
> ._threadPool along with DBAPI._pool. But it doesn't clear the pool on
> .close().
>
>    The quick-and-dirty solution for you is to clear the pool yourself:
>
>             Rebuildd().sqlconnection.close()
>             Rebuildd().sqlconnection._threadPool = {}

Thanks, this solve my issue.

>    You preserve an old SQLiteConnection, so you don't need the
> following:
>
>> 	    sqlobject.dbconnection.TheURIOpener.cachedURIs={}

Ok, I plan to change rebuildd code and avoid singletons, this will
permit to make each unit test in a separate context (and directory) to
avoid side effects.

At that time, I think I will be freed of all of this.

[...]

>    And, BTW, this
>
(Continue reading)

Pʀoмᴇтнᴇυs 0x01 | 12 Feb 2012 20:55
Picon

Community-editable recipe/documentation site?

Hi all,


I don't know if anyone would be interested in this, but maybe some kind of wiki or community-editable documentation/recipe site could be useful? This way we can submit our own recipes or tips/tricks and maybe grow the SQLObject user base?

-James
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Oleg Broytman | 12 Feb 2012 21:10
X-Face
Favicon
Gravatar

Re: Community-editable recipe/documentation site?

On Sun, Feb 12, 2012 at 12:55:06PM -0700, P??oм???тн?????s 0x01 wrote:
> I don't know if anyone would be interested in this, but maybe some kind of
> wiki or community-editable documentation/recipe site could be useful? This
> way we can submit our own recipes or tips/tricks and maybe grow the
> SQLObject user base?

   There were a few tries to create such a thing - all failed. A
community-edited site requires a dedicated administrator who will be
available 99% of her times - to resolve network and hosting problems, to
remove spam and so on. A few people tried to be such admins and all
deserted.
   Also a community-edited site requires a community, preferable an
active community - which I have failed to build, even worse - which I
destroyed. Shame on me.
   I'd certainly like to take another try, though. Would you want to be
the admin? What hosting do you propose?

Oleg.
--

-- 
     Oleg Broytman            http://phdru.name/            phd <at> phdru.name
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Pʀoмᴇтнᴇυs 0x01 | 13 Feb 2012 02:51
Picon

Re: Community-editable recipe/documentation site?

Hi Oleg,


I tried setting something up on wikia, but I'm not sure that it's the appropriate venue because there's no control over page editing. I set something up on google sites however, which seems to work better. What do you think of this? https://sites.google.com/site/sqlobject/

With Google Sites the spam problem will be fairly minimal (unauthorized users can only post comments), and there should be no problems with regards to hosting or outages either.

Let me know if you like this; I'll add you as either another editor or just transfer the site to you (I'm not too clear on how Google Site permissions work beyond 'can view' and 'can edit'). I don't mind helping run it, but my available time will fluctuate -- either way, it should be a lot easier to manage than dealing with spam from an open wiki.

-James

2012/2/12 Oleg Broytman <phd <at> phdru.name>
On Sun, Feb 12, 2012 at 12:55:06PM -0700, P??oм???тн?????s 0x01 wrote:
> I don't know if anyone would be interested in this, but maybe some kind of
> wiki or community-editable documentation/recipe site could be useful? This
> way we can submit our own recipes or tips/tricks and maybe grow the
> SQLObject user base?

  There were a few tries to create such a thing - all failed. A
community-edited site requires a dedicated administrator who will be
available 99% of her times - to resolve network and hosting problems, to
remove spam and so on. A few people tried to be such admins and all
deserted.
  Also a community-edited site requires a community, preferable an
active community - which I have failed to build, even worse - which I
destroyed. Shame on me.
  I'd certainly like to take another try, though. Would you want to be
the admin? What hosting do you propose?

Oleg.
--
    Oleg Broytman            http://phdru.name/            phd <at> phdru.name
          Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Timo | 13 Feb 2012 12:32
Picon

Re: Community-editable recipe/documentation site?

Op 12-02-12 20:55, Pʀoмᴇтнᴇυs 0x01 schreef:
> Hi all,
>
> I don't know if anyone would be interested in this, but maybe some 
> kind of wiki or community-editable documentation/recipe site could be 
> useful? This way we can submit our own recipes or tips/tricks and 
> maybe grow the SQLObject user base?
Just to give a heads up, I would be very interested in something like 
this. The documentation on the website is quite good, but I keep finding 
myself Googling for examples etc. Other peoples blogs are ok, but it 
would be nice to have a clean overview of recipes on the SQLObject 
website itself.

What pops in mind though, is that recipes become abandoned after a 
while, and newer SQLObject may break things in the future. It would be 
nice to create a system where a "tested with SQLObject xyz" is included, 
or even something like the compatibility system Wordpress uses for their 
plugins (right side, just a random plugin from mainpage): 
http://wordpress.org/extend/plugins/wp-super-cache/

Cheers,
Timo

>
> -James
>
>
> ------------------------------------------------------------------------------
> Virtualization&  Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>
>
> _______________________________________________
> sqlobject-discuss mailing list
> sqlobject-discuss <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Pʀoмᴇтнᴇυs 0x01 | 13 Feb 2012 23:08
Picon

SQLObject easy_install

Hi all,


Whenever I try to do easy_install, it seems that the only version I can get is sqlobject 1.0.0 ? Am I doing something wrong?

Thanks!
-James
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Gmane