aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcslocum <cslocum@d34015c8-bcbb-4646-8ac8-8ba5febf221d>2012-12-20 11:48:57 -0500
committercslocum <cslocum@d34015c8-bcbb-4646-8ac8-8ba5febf221d>2012-12-20 11:48:57 -0500
commit1c1b17f50ce5dd4fc5e51d995561c4a72d7a7dd9 (patch)
treedc8588b6f3a523df703504929b9c408beb82ecfd
parent6573513ccfd34b7083fd4c91020d646df4e99f9e (diff)
downloadsteuermann-1c1b17f50ce5dd4fc5e51d995561c4a72d7a7dd9.tar.gz
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
-rw-r--r--steuermann/run_all.py18
1 files changed, 17 insertions, 1 deletions
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) == '<type \'str\'>':
+ 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