Skip to content

Commit

Permalink
* Polished output.
Browse files Browse the repository at this point in the history
  • Loading branch information
mflehmig committed Oct 7, 2015
1 parent 27d324c commit 2f59fc7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions simulation/libraries/msl32_cpp/simulateAll_parallel.py
Expand Up @@ -112,7 +112,7 @@ def wait_for_all(self):
"""
for i in range(len(self.sub_processes)):
self.sub_processes[i].wait()
print " Finished %s " % (self.sims[i])
print "%20s \t %s " % ("Finished", self.sims[i])

def get_simulations(self):
"""
Expand All @@ -131,7 +131,7 @@ def run_simulation(self, i):
:param i: Index of the simulation that will be executed.
:type i: Integer
"""
print "[%d/%d] Start %s " % (i, self.sims_num, self.sims[i])
print "[%3d/%3d] %7s \t %s " % (i, self.sims_num, "Start", self.sims[i])
sim = self.settings.omc_command + ' ' + self.sims[i]
# args should be sequence of arguments (https://docs.python.org/2/library/subprocess.html#popen-constructor)
args = sim.split(" ") # shlex.split(sim)
Expand All @@ -143,7 +143,7 @@ def run_simulation(self, i):
log_file = open(self.settings.wdir + os.path.sep + self.sims[i] + ".txt", "w")
# Call subprocess and append Popen object to list of objects
self.sub_processes.append(
subprocess.Popen(args, cwd=self.settings.wdir, stdout=log_file, stderr=subprocess.STDOUT))
subprocess.Popen(args, cwd=self.settings.wdir, stdout=log_file, stderr=subprocess.STDOUT))
self.scrs.append(i)

def execute_first_np_simulations(self):
Expand All @@ -161,8 +161,7 @@ def execute_remaining_simulations(self):
fi = self.wait_for_a_finished_simulation()
logging.debug('Number of active subprocess is %d.', len(self.sub_processes))
logging.debug('Sub process i=%d has finished.', fi)
print " Finished %s " % (self.sims[self.scrs[fi]])
# print "Finished simulation ", self.sims[self.scrs[fi]]
print "%20s \t %s " % ("Finished", self.sims[self.scrs[fi]])
self.sub_processes.pop(fi)
self.scrs.pop(fi)
self.run_simulation(i)
Expand Down

0 comments on commit 2f59fc7

Please sign in to comment.