fork download
  1. audit_templates:
  2. audit_templates_per_admin: 666
  3. fill_strategy: "random"
  4. params:
  5. - goal:
  6. name: "workload_balancing"
  7. strategy:
  8. name: "workload_stabilization"
  9. - goal:
  10. name: "dummy"
  11. strategy:
  12. name: "dummy"
  13.  
  14. audit_templates:
  15. audit_templates_per_admin: 666
  16. fill_strategy: "round_robin"
  17. params:
  18. - goal:
  19. name: "workload_balancing"
  20. strategy:
  21. name: "workload_stabilization"
  22. - goal:
  23. name: "dummy"
  24. strategy:
  25. name: "dummy"
  26.  
  27. # ----context section from config ^^
  28.  
  29.  
  30.  
  31. CONFIG_SCHEMA = {
  32. "type": "object"
  33. "$schema": consts.JSON_SCHEMA,
  34.  
  35. "fill_strategy": {"enum": ["round_robin", "random", None]}
  36. "params": {
  37. "type": "array",
  38. "minItems": 1,
  39. "uniqueItems": True,
  40. "properties": {
  41. "goal": {
  42. "type": "object",
  43. "properties": {
  44. "name": {
  45. "type": "string"
  46. }
  47. }
  48. },
  49. "strategy": {
  50. "type": "object",
  51. "properties": {
  52. "name": {
  53. "type": "string"
  54. }
  55. }
  56. },
  57. "extra": {
  58. "type": "object"
  59. }
  60. },
  61. },
  62. "additionalProperties": False,
  63. "required": ["params"]
  64. }
  65.  
  66. DEFAULT_CONFIG = {
  67. "audit_templates_per_admin": 1
  68. "fill_strategy": "round_robin"
  69. }
  70.  
  71.  
  72.  
  73. for i in range(self.config.get("audit_templates_per_admin")):
  74. cfg_size = len(self.config)
  75. if self.config["fill_strategy"] == "round_robin":
  76. audit_params = self.config["params"][i % cfg_size]
  77. else if self.config["fill_strategy"] == "round_robin":
  78. audit_params = random.choose(self.config["params"])
  79. audit_params.update({"extra": {}})
  80.  
  81. goal_id = types.WatcherGoal.transform(clients=clients,
  82. resource_config=goal)
  83. strategy_id = types.WatcherStrategy.transform(
  84. clients=clients, resource_config=strategy)
  85.  
  86. audit_template = watcher_scenario._create_audit_template(**audit_params)
  87. self.context["audit_templates"].append(audit_template.uuid)
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/py_compile.py", line 117, in compile
    raise py_exc
py_compile.PyCompileError:   File "prog.py", line 1
    audit_templates:
                   ^
SyntaxError: invalid syntax

stdout
Standard output is empty