ssbarnea/tendo — pull request #4 by pylanglois (2012-06-08 05:03:16+00:00)
Title: Adding flavor_id to singleton

Hi,

I have a script that can be called at the same time for different flavor. The same flavor cannot run simultaneously but different flavor can. Ex:

~/myscript.py update_db_1
~/myscript.py update_db_1 #Must exit(1)
~/myscript.py update_db_2 #Must be run

So I have added a flavor_id to the __init__ allowing to custom the lock filename for each flavor.

I have also found that the lock filename was based on tendo.singleton.py instead of ~/myscript.py. I have fixed that issue.

Finally, my script use a non-root logger that output only to file. I don't know why but when I import tendo.singleton, myscript.py starts to output to stdout which is a behaviour that I don't want. So I have modified tendo.singleton changing it to a non-root logger.I'm not pro with logger so any better approch is welcome.

I would be very happy to see this code merged in the main branch allowing me to use the main repo instead of my own fork.

Thanks!

Pierre-Yves Langlois