- Timestamp:
- Apr 21, 2010 6:23:08 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 4c931af
- Parents:
- f7a54c6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_client.py
rf7a54c6 rd055eb1 419 419 420 420 421 422 # Querying experiment data follows the same control flow regardless of the423 # specific data retrieved. This class encapsulates that control flow.424 class exp_data(exp_data_base):425 def __init__(self):426 exp_data_base.__init__(self)427 428 421 def __call__(self): 429 422 """ … … 482 475 sys.exit("Error processing RPC: %s" % e) 483 476 477 return (resp_dict, opts) 478 479 480 # Querying experiment data follows the same control flow regardless of the 481 # specific data retrieved. This class encapsulates that control flow. 482 class exp_data(exp_data_base): 483 def __init__(self): 484 exp_data_base.__init__(self) 485 486 def __call__(self): 487 """ 488 The control flow. Compose the request and print the response. 489 """ 490 491 resp_dict, opts = exp_data_base.__call__(self) 492 484 493 for d in opts.data: 485 494 key, output = self.params[d] … … 490 499 sys.exit("Bad response. %s" % e.message) 491 500 492 class vtopo(exp_data): 501 class ftopo(exp_data_base): 502 """ 503 ftopo returns the mapping from logical name to local hostname 504 """ 505 def __init__(self): 506 exp_data_base.__init__(self) 507 def __call__(self): 508 sys.argv.append('--data=experimentdescription') 509 resp, opts = exp_data_base.__call__(self) 510 if 'experimentdescription' in resp and \ 511 'topdldescription' in resp['experimentdescription']: 512 top = \ 513 topdl.Topology(\ 514 **resp['experimentdescription']['topdldescription']) 515 516 for e in [ e for e in top.elements \ 517 if isinstance(e, topdl.Computer)]: 518 hn = e.get_attribute('hostname') 519 tb = e.get_attribute('testbed') 520 if hn and tb: 521 print ":".join([",".join(e.name), hn, tb]) 522 523 524 525 526 class vtopo(exp_data_base): 493 527 """ 494 528 vtopo is just an info --data=vtopo request, so this adds that parameter to … … 496 530 """ 497 531 def __init__(self): 498 exp_data .__init__(self)532 exp_data_base.__init__(self) 499 533 def __call__(self): 500 534 sys.argv.append('--data=vtopo') 501 exp_data.__call__(self) 502 503 504 class vis(exp_data): 535 resp, opts = exp_data_base.__call__(self) 536 if 'vtopo' in resp: 537 self.print_vis_or_vtopo('vtopo')(resp['vtopo']) 538 539 540 class vis(exp_data_base): 505 541 """ 506 542 vis is just an info --data=vis request, so this adds that parameter to … … 508 544 """ 509 545 def __init__(self): 510 exp_data .__init__(self)546 exp_data_base.__init__(self) 511 547 def __call__(self): 512 548 sys.argv.append('--data=vis') 513 exp_data.__call__(self) 514 515 class status(exp_data): 549 resp, opts = exp_data_base.__call__(self) 550 if 'vis' in resp: 551 self.print_vis_or_vtopo('vis')(resp['vis']) 552 553 class status(exp_data_base): 516 554 """ 517 555 status is just an info --data=status request, so this adds that parameter … … 519 557 """ 520 558 def __init__(self): 521 exp_data .__init__(self)559 exp_data_base.__init__(self) 522 560 def __call__(self): 523 561 sys.argv.append('--data=status') 524 exp_data.__call__(self) 562 resp, opts = exp_data_base.__call__(self) 563 if 'experimentStatus' in resp: 564 self.print_string(resp['experimentStatus']) 525 565 526 566 class multi_exp_data(exp_data_base): … … 1834 1874 'split': split(),\ 1835 1875 'access': access(),\ 1876 'ftopo': ftopo(),\ 1836 1877 'vtopo': vtopo(),\ 1837 1878 'vis': vis(),\
Note: See TracChangeset
for help on using the changeset viewer.