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.

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

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.

About

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.

Topics

Resources

Releases

No releases published

Packages

No packages published

Languages