-1

I'm running a mrjob python script, and in the command line I can pass the number of cores for the system to use.

python example_script.py --num-cores 5 

I'm looking to run the script for n number of cores for beach marking performance test. IE: I want to run it for 1 core, 2 core etc.

Is there anyway I can write a loop directly into the command line rather then having to write out the whole command n number of times?

F.D
  • 767
  • 2
  • 10
  • 23

2 Answers2

1

As in you want to lunch 4 isntances of mrjob each with increasing number of cores?

i.e.

python mrjob.py --num-core-instances=1
python mrjob.py --num-core-instances=2
python mrjob.py --num-core-instances=3
python mrjob.py --num-core-instances=4

In that case I don't think you can. You can make a script that lunches those for you though.

import subprocess
for i in range(1,5):
    subprocess.Popen(["start","cmd","/k","python","mrjob.py","--num-core-instance="+i],shell=True)
SgtMajorJay
  • 129
  • 4
1

Is this what you want to do ?

for i in {1..10} ; do python example_script.py --num-cores $i ; done ;

It is a bash for loop.

cdrom
  • 591
  • 2
  • 16