Re: Recommendation for small, fast, Python based web server

2009-12-09 Thread birdsong
On Dec 9, 4:05 pm, pyt...@bdurham.com wrote: > Daniel, > > > I'm using cherrypy for this purpose, actually together with turbogears 1. > > My research has constantly pointed back to cherrypy as a tool of choice > for building local web servers. My initial impression was that cherrypy > was too big

how to knock a page out of file cache

2009-10-20 Thread birdsong
Can anyone recommend a way to read a file ensuring that it is not coming from file cache on Linux? I'm trying to write a metric script for measuring http connect + read times from a web server over localhost. I want to plot both file cache read times and non-cached files. I thought of simply ope

Re: basic thread question

2009-08-18 Thread birdsong
On Aug 18, 3:18 pm, Derek Martin wrote: > On Tue, Aug 18, 2009 at 03:10:15PM -0500, Derek Martin wrote: > > I have some simple threaded code...  If I run this > > with an arg of 1 (start one thread), it pegs one cpu, as I would > > expect.  If I run it with an arg of 2 (start 2 threads), it uses b

Re: basic thread question

2009-08-18 Thread birdsong
On Aug 18, 1:10 pm, Derek Martin wrote: > I have some simple threaded code...  If I run this > with an arg of 1 (start one thread), it pegs one cpu, as I would > expect.  If I run it with an arg of 2 (start 2 threads), it uses both > CPUs, but utilization of both is less than 50%.  Can anyone expl

Re: Non-blocking read with popen subprocess

2009-07-31 Thread birdsong
On Jul 30, 7:30 pm, Jonathan Gardner wrote: > On Jul 30, 5:24 pm, Dhanesh wrote: > > > > > how can I we have a non blocking read ? > > Seehttp://docs.python.org/library/popen2.html#flow-control-issues > > Note well: In the non-blocking world, you have to use select() or poll > () to get your job

interacting with an updatedb generated data file within python

2009-04-02 Thread birdsong
Does anybody have any recommendations on how to interact with the data file that updatedb generates? I'm running through a file list in sqlite that I want to check against the file system. updatedb is pretty optimized for building an index and storing it, but I see no way to query the db file othe

Re: Translating pysnmp oids to human readable strings

2009-03-06 Thread birdsong
On Mar 5, 11:22 pm, SpamMePlease PleasePlease wrote: > On Fri, Mar 6, 2009 at 1:10 AM, birdsong wrote: > > On Mar 5, 2:30 pm, SpamMePlease PleasePlease > > wrote: > >> On Thu, Mar 5, 2009 at 10:12 PM, birdsong wrote: > >> > On Mar 5, 1:05 pm, birdson

Re: Translating pysnmp oids to human readable strings

2009-03-05 Thread birdsong
On Mar 5, 2:30 pm, SpamMePlease PleasePlease wrote: > On Thu, Mar 5, 2009 at 10:12 PM, birdsong wrote: > > On Mar 5, 1:05 pm, birdsong wrote: > >> On Mar 5, 12:32 pm, SpamMePlease PleasePlease > > >> wrote: > >> > Hey list, > > >> >

Re: Translating pysnmp oids to human readable strings

2009-03-05 Thread birdsong
On Mar 5, 1:05 pm, birdsong wrote: > On Mar 5, 12:32 pm, SpamMePlease PleasePlease > > > > wrote: > > Hey list, > > > I was given a task, to reproduce functionality of command specified > > below by writing proper python functions to reuse in some monitoring &

Re: Translating pysnmp oids to human readable strings

2009-03-05 Thread birdsong
On Mar 5, 12:32 pm, SpamMePlease PleasePlease wrote: > Hey list, > > I was given a task, to reproduce functionality of command specified > below by writing proper python functions to reuse in some monitoring > script: > > rivendell# snmpwalk -Os -mALL -v1 -cgabilgathol 10.0.6.66 > .1.3.6.1.4.1.263

thread safe to lock on key,val pairs on a dict instead of entire dict?

2009-02-25 Thread birdsong
Dictionaries just store references to objects, right? So is it thread safe to lock a specific key/val pair on a dictionary and modify its val and release the lock? example snippet: # assuming d_lock was initialized long ago in a thread-safe manner d_lock.acquire() d = {} d[1] = (threading.Lock()

Re: single thread decrement a semaphore object more than once?

2009-02-24 Thread birdsong
On Feb 24, 8:57 pm, Christian Heimes wrote: > birdsong wrote: > > I searched but didn't see this already discussed, sorry if I didn't > > search hard enough. > > > Can I decrement a semaphore's counter within the same thread more than > > once?  I&#

single thread decrement a semaphore object more than once?

2009-02-24 Thread birdsong
I searched but didn't see this already discussed, sorry if I didn't search hard enough. Can I decrement a semaphore's counter within the same thread more than once? I'd like to set hard and soft limits in a server I'm writing. The server upon initialization would create a semaphore: threading.Se

Re: Run a linux system command as a superuser, using a python script

2009-02-24 Thread birdsong
On Feb 24, 11:44 am, Chris Rebert wrote: > On Tue, Feb 24, 2009 at 11:38 AM, madhav wrote: > > I have got postfix installed on my machine and I am updating on of its > > configuration files programmatically(using python)(on some action). > > Since any change in the configuration needs a reload, I

Re: Python shell scripting and errors

2009-02-23 Thread birdsong
On Feb 23, 9:34 am, Philip Semanchuk wrote: > On Feb 23, 2009, at 12:21 PM, Tim Wintle wrote: > > > On Mon, 2009-02-23 at 09:12 -0800, Phillip B Oldham wrote: > >> I've got a python script running as a daemon (using someone else's > >> daemon module). It runs fine for a while, but will occasionall

Re: select.poll.poll() never blocks

2009-02-11 Thread birdsong
On Feb 11, 10:36 pm, "Hendrik van Rooyen" wrote: > "birdsong" wrote: > > 8<--- select not blocking on empty file stuff - > > > Any help on what I'm missing would be appreciated. > > Why do you expect it to block? > I

Re: select.poll.poll() never blocks

2009-02-11 Thread birdsong
On Feb 11, 7:47 pm, "Rhodri James" wrote: > On Thu, 12 Feb 2009 03:01:16 -0000, birdsong   > wrote: > > > So I guess I didn't have a complete understanding of poll, I thought > > it returned file descriptors that had registered an event that the >

Re: select.poll.poll() never blocks

2009-02-11 Thread birdsong
he file is readable, yes, but is that all that the syscall has to offer? On Feb 11, 6:49 pm, Jean-Paul Calderone wrote: > On Wed, 11 Feb 2009 18:44:53 -0800 (PST), birdsong > wrote: > >I'm pretty sure I've exhausted all searches and read all the forums > >Google will turn

select.poll.poll() never blocks

2009-02-11 Thread birdsong
I'm pretty sure I've exhausted all searches and read all the forums Google will turn up related to this issue. I touch an empty file in a sh shell, fire up the python shell, open the file for reading(tried all buffering options), register it with a poll object for select.POLLIN and call poll(), bu

Re: "Weird" Indentation? (Or: is there a for...else construct?)

2009-02-08 Thread birdsong
On Feb 7, 6:34 am, Andreas Waldenburger wrote: > On Sun, 08 Feb 2009 01:28:00 +1100 Steven D'Aprano > > wrote: > > Andreas Waldenburger wrote: > > > > It seems that there is a for...else construct. Replacing the inner > > > if with pass seems to confirm this. The else clause is still > > > execut