Commit f14b1ed3 authored by Michael Salim's avatar Michael Salim
Browse files

The launcher now exits when all jobs in its job source are in an

end-state.

The get_envs() method of BalsamJobs only produces environment variables
that contain a BALSAM or DJANGO substring now.
parent 440fe644
......@@ -29,6 +29,8 @@ logger = logging.getLogger('balsam.launcher')
logger.info("Loading Balsam Launcher")
from balsam.service.schedulers import Scheduler
from balsam.service.models import END_STATES
scheduler = Scheduler.scheduler_main
from balsam.launcher import jobreader
......@@ -194,6 +196,9 @@ def main(args, transition_pool, runner_group, job_source):
last_runner_created)
if delay: next(delay_sleeper)
if all(j.state in END_STATES for j in job_source.jobs):
logger.info("No jobs to process. Exiting main loop now.")
break
def on_exit(runner_group, transition_pool, job_source):
'''Exit cleanup'''
......
......@@ -167,8 +167,8 @@ class BalsamJob(models.Model):
help_text='The number of compute nodes requested for this job.',
default=1)
ranks_per_node = models.IntegerField(
'Number of Processes per Node',
help_text='The number of MPI processes per node to schedule for this job.',
'Number of ranks per node',
help_text='The number of MPI ranks per node to schedule for this job.',
default=1)
threads_per_rank = models.IntegerField(
'Number of threads per MPI rank',
......@@ -357,7 +357,7 @@ auto timeout retry: {self.auto_timeout_retry}
return {variable:value for (variable,value) in entries}
def get_envs(self, *, timeout=False, error=False):
keywords = 'PATH LIBRARY BALSAM DJANGO PYTHON'.split()
keywords = 'BALSAM DJANGO PYTHON'.split()
envs = {var:value for var,value in os.environ.items()
if any(keyword in var for keyword in keywords)}
try:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment