Skip to content

Commit

Permalink
Bug fix and code smells removed
Browse files Browse the repository at this point in the history
  • Loading branch information
hlasimpk committed Apr 24, 2017
1 parent df9cdc1 commit 369475b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions simbad/util/workers_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,25 @@ def start(self, nproc=None, early_terminate=False, check_success=None, monitor=N
# Join process for timeout seconds and if we haven't finished by then move onto the next process
process.join(timeout)
if not process.is_alive():
LOGGER.debug("Checking completed process %s with exitcode %s" % process, process.exitcode)
LOGGER.debug("Checking completed process %s with exitcode %s", process, process.exitcode)

# Set failed if any job failed
if process.exitcode != 0:
LOGGER.critical("Process %s failed with exitcode %s" % process, process.exitcode)
LOGGER.critical("Process %s failed with exitcode %s", process, process.exitcode)
success = False

# Finished so see what happened
if process.exitcode == 0 and early_terminate:
if not self.inqueue.empty():
print("Process %s was successful so removing remaining jobs from inqueue" % process.name)
LOGGER.info(
"Process %s was successful so removing remaining jobs from inqueue" % process.name)
"Process %s was successful so removing remaining jobs from inqueue", process.name)
# Remove all remaining processes from the inqueue. We do this rather than terminate the
# processes as terminating leaves the MRBUMP processes running.
# This way we hang around until all our running processes have finished
while not self.inqueue.empty():
job = self.inqueue.get()
LOGGER.debug("Removed job [%s] from inqueue" % job)
LOGGER.debug("Removed job [%s] from inqueue", job)
else:
print("Got empty queue - all jobs done")

Expand Down Expand Up @@ -124,7 +124,6 @@ def run_scripts(job_scripts,
monitor=monitor,
job_time=job_time,
job_name=job_name,
submit_cluster=submit_cluster,
submit_qtype=submit_qtype,
submit_queue=submit_queue,
submit_array=submit_array,
Expand Down

0 comments on commit 369475b

Please sign in to comment.