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.

macoj/simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages