Littleworkers: Petite Python Command Runners
Daniel Lindsley, of
django-haystack,
django-tastypie, and
itty fame, just launched a
small but useful project.
This extremely minimal Python module allows you to set a list of command
strings to be executed by the system, and it eats through them in a process pool.
Example usage:
from littleworkers import Pool
# Define your commands.
commands = [
'ls -al',
'cd /tmp && mkdir foo',
'date',
'echo "Hello There."',
'sleep 2 && echo "Done."'
]
# Setup a pool. Since I have two cores, I'll use two workers.
lil = Pool(workers=2)
# Run!
lil.run(commands)
Simple. Pythonic.
Discussion
Sign in or Join to comment or subscribe