Changeset 7a8d667 for fedd/fedd_client.py
- Timestamp:
- Sep 19, 2008 6:25:54 PM (16 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- 01073f7
- Parents:
- 9d207bd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_client.py
r9d207bd r7a8d667 425 425 print resp_dict 426 426 427 class terminate(fedd_rpc): 428 def __init__(self): 429 """ 430 Termination request 431 """ 432 433 fedd_rpc.__init__(self, "Terminate") 434 435 def __call__(self): 436 """ 437 The control flow. Compose the request and print the response. 438 """ 439 # Process the options using the customized option parser defined above 440 parser = fedd_exp_data_opts() 441 442 (opts, args) = parser.parse_args() 443 444 if opts.trusted != None: 445 if ( not os.access(opts.trusted, os.R_OK) ) : 446 sys.exit("Cannot read trusted certificates (%s)" % opts.trusted) 447 else: 448 parser.error("--trusted is required") 449 450 if opts.debug > 0: opts.tracefile=sys.stderr 451 452 if opts.cert != None: cert = opts.cert 453 454 if cert == None: 455 sys.exit("No certificate given (--cert) or found") 456 457 if os.access(cert, os.R_OK): 458 fid = fedid(file=cert) 459 else: 460 sys.exit("Cannot read certificate (%s)" % cert) 461 462 if opts.exp_name and opts.exp_certfile: 463 sys.exit("Only one of --experiment_cert and " +\ 464 "--experiment_name permitted"); 465 466 if opts.exp_certfile: 467 exp_id = { 'fedid': fedid(file=opts.exp_certfile) } 468 469 if opts.exp_name: 470 exp_id = { 'localname' : opts.exp_name } 471 472 req = { 'experiment': exp_id } 473 474 try: 475 resp_dict = self.do_rpc(req, 476 opts.url, opts.transport, cert, opts.trusted, 477 serialize_only=opts.serialize_only, 478 tracefile=opts.tracefile) 479 except self.RPCException, e: 480 exit_with_fault(\ 481 {'desc': e.desc, 'errstr': e.errstr, 'code': e.code}) 482 except RuntimeError, e: 483 print e 484 sys.exit("Error processing RPC: %s" % e) 485 486 eid = resp_dict.get('experimentID', None) 487 if eid: 488 for id in eid: 489 for k in id.keys(): 490 if k == 'fedid': print "%s: %s" % (k,fedid(bits=id[k])) 491 else: print "%s: %s" % (k, id[k]) 492 427 493 class create(fedd_rpc): 428 494 def __init__(self): … … 637 703 'vis': exp_data('Vis'),\ 638 704 'info': exp_data('Info'),\ 705 'terminate': terminate(),\ 639 706 } 640 707
Note: See TracChangeset
for help on using the changeset viewer.