From 1c1b17f50ce5dd4fc5e51d995561c4a72d7a7dd9 Mon Sep 17 00:00:00 2001 From: cslocum Date: Thu, 20 Dec 2012 16:48:57 +0000 Subject: add support for resource keywords 'all' or 'available' git-svn-id: https://svn.stsci.edu/svn/ssb/etal/steuermann/trunk@909 d34015c8-bcbb-4646-8ac8-8ba5febf221d --- steuermann/run_all.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'steuermann/run_all.py') diff --git a/steuermann/run_all.py b/steuermann/run_all.py index 42012dd..1a64a5b 100644 --- a/steuermann/run_all.py +++ b/steuermann/run_all.py @@ -483,12 +483,26 @@ def run_step( runner, xnodes, run_name, db ) : # - not enough resources available enough = True + x.used_resources = {} for res, amount in x.resources.items(): if res in common_resources.keys(): avail = common_resources_avail[res] - if amount > avail: + + if amount == 'all': + amount = common_resources[res] + elif amount == 'available': + if avail > 0: + amount = avail + + if type(amount) == '': + enough = False + elif amount > avail: enough = False break + + if enough: + x.used_resources[res] = amount + if not enough: continue @@ -533,6 +547,7 @@ def run_step( runner, xnodes, run_name, db ) : # allocate common resources for res, amount in x.resources.items(): if res in common_resources_avail.keys(): + amount = x.used_resources[res] common_resources_avail[res] -= amount tmp = runner.run(x, run_name, no_run=no_run, logfile_name = make_log_file_name(run_name, host, table, cmd) ) @@ -584,6 +599,7 @@ def run_step( runner, xnodes, run_name, db ) : # de-allocate common resources for res, amount in x.resources.items(): if res in common_resources_avail.keys(): + amount = x.used_resources[res] common_resources_avail[res] += amount -- cgit