linux - Run several jobs parallelly and Efficiently -
os: cent-os
i have 30,000
jobs(or scripts) run. each job takes 3-5 min. have 48 cpus(nproc = 48)
. can use 40 cpus run 40 jobs
parallelly. please suggest script or tools can handle 30,000 jobs running each 40 jobs parallely.
what had done:
i created 40 different folders , executed jobs parallely creating shell script each directory.
i want know better ways handle kind of jobs next time.
as mark setchell says: gnu parallel.
find scripts/ -type f | parallel
if insists on keeping 8 cpus free:
find scripts/ -type f | parallel -j-8
but more efficient use nice
give 48 cores when no 1 else needs them:
find scripts/ -type f | nice -n 15 parallel
to learn more:
- watch intro video quick introduction: https://www.youtube.com/playlist?list=pl284c9ff2488bc6d1
- walk through tutorial (man parallel_tutorial). command line love it.
Comments
Post a Comment