source: fedd/fedd_multistatus.py @ dc49681

Last change on this file since dc49681 was 2e46f35, checked in by mikeryan <mikeryan@…>, 14 years ago

switch to /usr/bin/env python to run python

  • Property mode set to 100755
File size: 1.3 KB
Line 
1#!/usr/bin/env python
2
3import sys
4
5from federation.proof import proof
6from federation.remote_service import service_caller
7from federation.client_lib import client_opts, exit_with_fault, RPCException, \
8        wrangle_standard_options, do_rpc, get_experiment_names, \
9        log_authentication
10
11parser = client_opts()
12(opts, args) = parser.parse_args()
13try:
14    cert, fid, url = wrangle_standard_options(opts)
15except RuntimeError, e:
16    sys.exit("%s" %e)
17
18try:
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')
25except RPCException, e:
26    exit_with_fault(e, 'MultiInfo', opts)
27except 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.
33for 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', "") ])
37proof = proof.from_dict(resp_dict.get('proof', {}))
38if proof and opts.auth_log:
39    log_authentication(opts.auth_log, 'MultiInfo', 'succeeded', proof)
Note: See TracBrowser for help on using the repository browser.