1 | #!/usr/local/bin/python |
---|
2 | |
---|
3 | import sys |
---|
4 | |
---|
5 | from federation.proof import proof |
---|
6 | from federation.remote_service import service_caller |
---|
7 | from federation.client_lib import client_opts, exit_with_fault, RPCException, \ |
---|
8 | wrangle_standard_options, do_rpc, get_experiment_names, \ |
---|
9 | log_authentication |
---|
10 | |
---|
11 | parser = client_opts() |
---|
12 | (opts, args) = parser.parse_args() |
---|
13 | try: |
---|
14 | cert, fid, url = wrangle_standard_options(opts) |
---|
15 | except RuntimeError, e: |
---|
16 | sys.exit("%s" %e) |
---|
17 | |
---|
18 | try: |
---|
19 | resp_dict = do_rpc({ }, |
---|
20 | url, opts.transport, cert, opts.trusted, |
---|
21 | serialize_only=opts.serialize_only, |
---|
22 | tracefile=opts.tracefile, |
---|
23 | caller=service_caller('MultiInfo'), |
---|
24 | responseBody='MultiInfoResponseBody') |
---|
25 | except RPCException, e: |
---|
26 | exit_with_fault(e, 'MultiInfo', opts) |
---|
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', "") ]) |
---|
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) |
---|