Skip to content
Do you like pool (multiprocessing) in Python? Do you want to run commands likewise? Not necessarily in Python? This is a simple tool to have experiments running in parallel.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
example.py
simulator.py

README.md

simulator.py

simulator.py is a simple tool to have experiments easily running in parallel.

It execute a given list of commands by keeping a number of process in parallel. For example, the following code will execute 30 different commands by executing at the most 20 in parallel:

execfile("simulator.py")
commands = ["ping -c 10 %s > /dev/null" % h for h in ["www.google.com", "www.twitter.com", "www.github.com"]] * 10
Simulator.execute(commands, number_of_processes=20, delay_between=1)

This tool checks periodically whether a process has finished or not, when a process finishes, another command runs. The parameter delay_between is the time in seconds which the main process sleeps until this check is performed again. The value of this parameter depends on the expected time that the commands will take to finish. The longer they take, the higher delay_between should be.

TODO

  • Different behavior depending on the return of a command.
  • An interface showing time spent by each command and the commands in line.
You can’t perform that action at this time.