Skip to content

Instantly share code, notes, and snippets.

@dandye
Created June 8, 2012 19:17
Show Gist options
  • Save dandye/2897669 to your computer and use it in GitHub Desktop.
Save dandye/2897669 to your computer and use it in GitHub Desktop.
multi-process shell scripts
import os,sys
import glob
from multiprocessing import Pool
def f(sh):
print sh
os.system(sh)
shs = glob.glob("/mnt/tiger/TIGER2011/wg_fips/tl_2011_*/state_render.sh")
cmds = [open(x).read() for x in shs]
p = Pool(2)
p.map(f, cmds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment