Guest User

Untitled

a guest
Jun 20th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. # Well known names, launch plan author needs to coordinate with these constants
  2. from bootstrap.names import *
  3.  
  4. # This is called by the outer program, well known signature
  5. def run_plan(confs, services, launcher, tester):
  6. """
  7.  
  8. @param confs Bag of anything the operator configures or overrides
  9. @param services Service configurations from launch plan
  10. @param launcher Will launch a service/node/epu
  11. @param tester Will test a service/node/epu
  12. @exception Exception If *anything* goes wrong.
  13. """
  14.  
  15. # Each of these could result in "None" if they are not in the launch plan
  16. rabbit = services.get(SERVICE_RABBIT_MQ)
  17. cass = services.get(SERVICE_CASSANDRA)
  18. broker = services.get(SERVICE_CTX_BROKER)
  19.  
  20. ##########################
  21. # LEVEL 1: Prerequisites #
  22. ##########################
  23.  
  24. to_launch = [rabbit, cass, broker]
  25.  
  26. # If you pass launcher.launch a list with any "None" in it, the return
  27. # tuple will match up with your input.
  28. (rspec, cspec, bspec) = launcher.launch(to_launch, confs)
  29.  
  30. to_test = []
  31.  
  32. if rspec:
  33. confs[IP_RABBIT_MQ] = rspec.ip
  34. to_test.append(rspec)
  35. if cspec:
  36. confs[IP_CASSANDRA] = cspec.ip
  37. to_test.append(cspec)
  38. if bspec:
  39. confs[IP_CTX_BROKER] = bspec.ip
  40. to_test.append(bspec)
  41.  
  42. tester.test(to_test, confs)
  43.  
  44. ########################
  45. # LEVEL 2: Provisioner #
  46. ########################
  47.  
  48. provisioner = services.get(SERVICE_PROVISIONER)
  49. pspec = launcher.launch([provisioner], confs)
  50. tester.test([pspec], confs)
  51.  
  52. ########################
  53. # LEVEL 3: Controllers #
  54. ########################
  55.  
  56. # Returns ordered list of all the sublevels configured in the plan.
  57. # Level 3 is itself broken up into a series of sublevels where someone
  58. # can configure their own ordered stages of which EPUs to run and how
  59. # to test proceeding.
  60. alllevels = services.level3_sublevels()
  61.  
  62. for level in alllevels:
  63. run_one_sublevel(level, confs, services, launcher, tester)
  64.  
  65. def run_one_sublevel(level, confs, services, launcher, tester):
  66. to_run = []
  67. for svc_name in level:
  68. to_run.append(services.get(svc_name))
  69. to_test = launcher.launch(to_run, confs)
  70. tester.test(to_test, confs)
Add Comment
Please, Sign In to add comment