source: fedd/fedd_multiinfo.py @ 301e941

axis_examplecompt_changesinfo-opsversion-3.01version-3.02
Last change on this file since 301e941 was d743d60, checked in by Ted Faber <faber@…>, 15 years ago

Totally refactor fedd_client.py into component scripts. The previous layout
have become a twisty hell of misdirected OOP and learning python run amok.
This version is actually pretty readable and will be much easier to build on.

  • Property mode set to 100755
File size: 1.2 KB
Line 
1#!/usr/local/bin/python
2
3import sys
4import os
5import pwd
6import tempfile
7import subprocess
8import re
9import xml.parsers.expat
10import time
11
12from federation.remote_service import service_caller
13from federation.client_lib import client_opts, exit_with_fault, RPCException,\
14        wrangle_standard_options, do_rpc, info_format
15
16class 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       
25parser = exp_data_opts()
26(opts, args) = parser.parse_args()
27cert, fid = wrangle_standard_options(opts)
28
29try:
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')
36except RPCException, e:
37    exit_with_fault(e)
38except RuntimeError, e:
39    sys.exit("Error processing RPC: %s" % e)
40
41formatter = info_format()
42for i in resp_dict.get('info', []):
43    for d in opts.data:
44        formatter(i, d)
45    print "---"
Note: See TracBrowser for help on using the repository browser.