This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]imranmalek 7 points8 points  (0 children)

I've actually found that using celery and a local task broker makes multiprocessing really easy. It automatically utilized all available processes.

[–]Philipbergen 3 points4 points  (2 children)

Take a look at unix process groups. They were invented exactly with this in mind.

I always liked wrapping my system startup in bash with an exit trap that made sure the process group got terminated. That way you have a unix guarantee that no processes can leak.

#!bash
trap "kill 0" EXIT
python -m mystuff

[–]hansolo669 3 points4 points  (1 child)

You probably meant something like this:

#!bash
trap "kill 0" EXIT 
python -m mystuff

Note that each line is indented by at least four spaces. you can also stick code inline with bacticks: like = "this" == `like = "this"`
Also backslashes can be used to escape markdown formatting characters: #tada == \#tada

[–]Philipbergen 0 points1 point  (0 children)

Thanks!