Skip to content

Instantly share code, notes, and snippets.

View pratik-m's full-sized avatar

Pratik Munot pratik-m

View GitHub Profile
@pratik-m
pratik-m / hello_multiprocessing.py
Created February 3, 2018 23:38 — forked from baojie/hello_multiprocessing.py
Python multiprocessing hello world. Split a list and process sublists in different jobs
import multiprocessing
# split a list into evenly sized chunks
def chunks(l, n):
return [l[i:i+n] for i in range(0, len(l), n)]
def do_job(job_id, data_slice):
for item in data_slice:
print "job", job_id, item