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

changes to launcher supporting tests

parent b8fea20a
......@@ -345,8 +345,7 @@ auto timeout retry: {self.auto_timeout_retry}
return {variable:value for (variable,value) in entries}
def get_envs(self, *, timeout=False, error=False):
#envs = os.environ.copy()
envs = {}
envs = os.environ.copy()
app = self.get_application()
except NoApplication:
'''Python API for Balsam DAG Manipulations
Example usage:
>>> import balsam.dag as dag
>>> import balsamlauncher.dag as dag
>>> output = open('expected_output').read()
......@@ -97,11 +97,24 @@ def add_dependency(parent,child):
raise RuntimeError("Detected circular dependency; not creating link")
def spawn_child(**kwargs):
def spawn_child(clone=False, **kwargs):
'''Add new job that is dependent on the current job'''
if not isinstance(current_job, _BalsamJob):
raise RuntimeError("No current BalsamJob detected in environment")
if clone:
child = _BalsamJob.objects.get( = None
for k,v in kwargs.items():
getattr(child, k)
except AttributeError:
raise ValueError(f"Invalid field {k}")
setattr(child, k, v)
child = add_job(**kwargs)
add_dependency(current_job, child)
return child
......@@ -4,6 +4,7 @@ import balsam.models
from balsam.models import BalsamJob
import logging
import uuid
logger = logging.getLogger(__name__)
class JobReader():
......@@ -111,7 +111,7 @@ def on_exit(runner_group, transition_pool, job_source):
def get_args():
def get_args(inputcmd=None):
parser = argparse.ArgumentParser(description="Start Balsam Job Launcher.")
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--job-file', help="File of Balsam job IDs")
......@@ -127,6 +127,9 @@ def get_args():
parser.add_argument('--time-limit-minutes', type=int,
help="Provide a walltime limit if not already imposed")
parser.add_argument('--daemon', action='store_true')
if inputcmd:
return parser.parse_args(inputcmd)
return parser.parse_args()
def detect_dead_runners(job_source):
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