Semaphore Techniques

2009-07-28 Thread John D Giotta
I'm looking to run a process with a limit of 3 instances, but each
execution is over a crontab interval. I've been investigating the
threading module and using daemons to limit active thread objects, but
I'm not very successful at grasping the documentation.

Is it possible to do what I'm trying to do and if so anyone know of a
useful example to get started?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Semaphore Techniques

2009-07-29 Thread John D Giotta
I'm working with up to 3 process "session" per server, each process
running three threads.
I was wishing to tie back the 3 "session"/server to a semaphore, but
everything (and everyone) say semaphores are only good per process.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Semaphore Techniques

2009-07-29 Thread John D Giotta
That was my original idea. Restricting each process by pid:

#bash
procs=`ps aux | grep script.pl | grep -v grep | wc -l`

if [ $procs -lt 3 ]; then
python2.4 script.py config.xml
else
exit 0
fi
-- 
http://mail.python.org/mailman/listinfo/python-list


HTTP POST File without cURL

2009-09-09 Thread John D Giotta
I'm working with an API that allows me to POST a zip file via HTTP and
the documentation uses a cURL example. cURL works, but when I try to
POST the file via python it fails.
I don't want to use cURL (since I'm trying to be transparent and
dependency-less), but I can't find anything online that works.

When I use multipart/form-data methods (found here
http://code.activestate.com/recipes/146306/), the recipient cannot
decipher the attached file.

This is about the most difficult thing I've had to do with python and
yet it is supposed to be the very basics of HTTP.

Example cURL command:
curl -v -u username:passwd --data-binary @/home/jdgiotta/test.zip -H
"Content-Type: application/zip" https://host/selector

Is there a valid way to do this?

-- 
http://mail.python.org/mailman/listinfo/python-list