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 | cert, fid = wrangle_standard_options(opts) |
---|
28 | |
---|
29 | try: |
---|
30 | resp_dict = do_rpc({ }, |
---|
31 | opts.url, opts.transport, cert, opts.trusted, |
---|
32 | serialize_only=opts.serialize_only, |
---|
33 | tracefile=opts.tracefile, |
---|
34 | caller=service_caller('MultiInfo'), |
---|
35 | responseBody='MultiInfoResponseBody') |
---|
36 | except RPCException, e: |
---|
37 | exit_with_fault(e) |
---|
38 | except RuntimeError, e: |
---|
39 | sys.exit("Error processing RPC: %s" % e) |
---|
40 | |
---|
41 | formatter = info_format() |
---|
42 | for i in resp_dict.get('info', []): |
---|
43 | for d in opts.data: |
---|
44 | formatter(i, d) |
---|
45 | print "---" |
---|