[2e46f35] | 1 | #!/usr/bin/env python |
---|
[d743d60] | 2 | |
---|
| 3 | import sys |
---|
| 4 | |
---|
[e83f2f2] | 5 | from federation.proof import proof |
---|
[d743d60] | 6 | from federation.remote_service import service_caller |
---|
| 7 | from federation.client_lib import client_opts, exit_with_fault, RPCException, \ |
---|
[e83f2f2] | 8 | wrangle_standard_options, do_rpc, get_experiment_names, \ |
---|
| 9 | log_authentication |
---|
[d743d60] | 10 | |
---|
| 11 | parser = client_opts() |
---|
| 12 | (opts, args) = parser.parse_args() |
---|
[a0c2866] | 13 | try: |
---|
| 14 | cert, fid, url = wrangle_standard_options(opts) |
---|
| 15 | except RuntimeError, e: |
---|
| 16 | sys.exit("%s" %e) |
---|
[d743d60] | 17 | |
---|
| 18 | try: |
---|
| 19 | resp_dict = do_rpc({ }, |
---|
[5d854e1] | 20 | url, opts.transport, cert, opts.trusted, |
---|
[d743d60] | 21 | serialize_only=opts.serialize_only, |
---|
| 22 | tracefile=opts.tracefile, |
---|
| 23 | caller=service_caller('MultiInfo'), |
---|
| 24 | responseBody='MultiInfoResponseBody') |
---|
| 25 | except RPCException, e: |
---|
[e83f2f2] | 26 | exit_with_fault(e, 'MultiInfo', opts) |
---|
[d743d60] | 27 | except RuntimeError, e: |
---|
| 28 | sys.exit("Error processing RPC: %s" % e) |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | # This is a terse way to print a line with the localname, fedid, and status of |
---|
| 32 | # each experiment, one line per experiment, separated by colons. |
---|
| 33 | for exp in resp_dict.get('info', []): |
---|
| 34 | f , l = get_experiment_names(exp.get('experimentID', None)) |
---|
| 35 | print ":".join([ l or "" , "%s" % (f or "") , |
---|
| 36 | exp.get('experimentStatus', "") ]) |
---|
[e83f2f2] | 37 | proof = proof.from_dict(resp_dict.get('proof', {})) |
---|
| 38 | if proof and opts.auth_log: |
---|
| 39 | log_authentication(opts.auth_log, 'MultiInfo', 'succeeded', proof) |
---|