1 | #!/usr/local/bin/python |
---|
2 | |
---|
3 | import sys |
---|
4 | import os |
---|
5 | import pwd |
---|
6 | import tempfile |
---|
7 | import subprocess |
---|
8 | import re |
---|
9 | import xml.parsers.expat |
---|
10 | import time |
---|
11 | |
---|
12 | from federation.remote_service import service_caller |
---|
13 | from federation.client_lib import client_opts, exit_with_fault, RPCException,\ |
---|
14 | wrangle_standard_options, do_rpc, info_format |
---|
15 | |
---|
16 | class exp_data_opts(client_opts): |
---|
17 | def __init__(self): |
---|
18 | client_opts.__init__(self) |
---|
19 | self.add_option("--data", dest="data", default=[], |
---|
20 | action="append", type="choice", |
---|
21 | choices=("id", "experimentdescription", "federant", "vtopo", |
---|
22 | "vis", "log", "status"), |
---|
23 | help="data to extract") |
---|
24 | |
---|
25 | parser = exp_data_opts() |
---|
26 | (opts, args) = parser.parse_args() |
---|
27 | try: |
---|
28 | cert, fid, url = wrangle_standard_options(opts) |
---|
29 | except RuntimeError, e: |
---|
30 | sys.exit("%s" %e) |
---|
31 | |
---|
32 | try: |
---|
33 | resp_dict = do_rpc({ }, |
---|
34 | url, opts.transport, cert, opts.trusted, |
---|
35 | serialize_only=opts.serialize_only, |
---|
36 | tracefile=opts.tracefile, |
---|
37 | caller=service_caller('MultiInfo'), |
---|
38 | responseBody='MultiInfoResponseBody') |
---|
39 | except RPCException, e: |
---|
40 | exit_with_fault(e) |
---|
41 | except RuntimeError, e: |
---|
42 | sys.exit("Error processing RPC: %s" % e) |
---|
43 | |
---|
44 | formatter = info_format() |
---|
45 | for i in resp_dict.get('info', []): |
---|
46 | for d in opts.data: |
---|
47 | formatter(i, d) |
---|
48 | print "---" |
---|