diff options
author | cslocum <cslocum@d34015c8-bcbb-4646-8ac8-8ba5febf221d> | 2012-12-20 11:00:22 -0500 |
---|---|---|
committer | cslocum <cslocum@d34015c8-bcbb-4646-8ac8-8ba5febf221d> | 2012-12-20 11:00:22 -0500 |
commit | 6573513ccfd34b7083fd4c91020d646df4e99f9e (patch) | |
tree | 616e4958f2b92dcfd9bed1f1fb4ae516475d68e7 | |
parent | 5745d68aa9323cbd2cb90f02a62911692bc63dc2 (diff) | |
download | steuermann-6573513ccfd34b7083fd4c91020d646df4e99f9e.tar.gz |
make smc accept unknown flags as condition definitions
git-svn-id: https://svn.stsci.edu/svn/ssb/etal/steuermann/trunk@908 d34015c8-bcbb-4646-8ac8-8ba5febf221d
-rw-r--r-- | steuermann/run_all.py | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/steuermann/run_all.py b/steuermann/run_all.py index 832c884..42012dd 100644 --- a/steuermann/run_all.py +++ b/steuermann/run_all.py @@ -59,13 +59,15 @@ def main() : # # several times to get a list # '--verbose' : '-v', # arg is an alias for some other arg - opt, args = easyargs.get( { + allowed_flags = { '--all' : '-a' , '-a' : '' , # run all nodes non-interactively '-r' : '=' , # give run name '-n' : '' , # do not actually execute any processes '-h' : '=' , # give hosts (*.ini) file - } ) + } + + opt, args = easyargs.get(allowed_flags) # # @@ -73,7 +75,8 @@ def main() : all = opt['-a'] no_run = opt['-n'] - di_nodes = nodes.read_file_list( args ) + sm_files = [a for a in args if ('--' not in a and '=' not in a)] + di_nodes = nodes.read_file_list( sm_files ) xnodes = di_nodes.node_index @@ -94,6 +97,22 @@ def main() : db = steuermann.config.open_db() + + # find any unknown arguments like --something=whatever, set as conditions + arguments = sys.argv[1:] + for a in args: + if '--' in a and '=' in a: + not_allowed_flag = True + for f in allowed_flags.keys(): + if a.startswith(f): + not_allowed_flag = False + break + if not_allowed_flag: + a = a.lstrip('--') + k, v = a.split('=') + nodes.saved_conditions[k] = v + + if all : run_all(xnodes, run_name, hosts_ini, db) else : @@ -659,13 +678,13 @@ def print_conditions() : row = 0 tt = text_table.text_table() - + for x in l : if x in boring : continue if callable(x) : v = x() - else : + else : v = nodes.saved_conditions[x] tt.set_value(row,0,x) tt.set_value(row,1,str(v)) |