sierra-research 1.3.11__py3-none-any.whl → 1.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. sierra/__init__.py +3 -3
  2. sierra/core/__init__.py +3 -3
  3. sierra/core/batchroot.py +223 -0
  4. sierra/core/cmdline.py +681 -1057
  5. sierra/core/compare.py +11 -0
  6. sierra/core/config.py +96 -88
  7. sierra/core/engine.py +306 -0
  8. sierra/core/execenv.py +380 -0
  9. sierra/core/expdef.py +11 -0
  10. sierra/core/experiment/__init__.py +1 -0
  11. sierra/core/experiment/bindings.py +150 -101
  12. sierra/core/experiment/definition.py +414 -245
  13. sierra/core/experiment/spec.py +83 -85
  14. sierra/core/exproot.py +44 -0
  15. sierra/core/generators/__init__.py +10 -0
  16. sierra/core/generators/experiment.py +528 -0
  17. sierra/core/generators/generator_factory.py +138 -137
  18. sierra/core/graphs/__init__.py +23 -0
  19. sierra/core/graphs/bcbridge.py +94 -0
  20. sierra/core/graphs/heatmap.py +245 -324
  21. sierra/core/graphs/pathset.py +27 -0
  22. sierra/core/graphs/schema.py +77 -0
  23. sierra/core/graphs/stacked_line.py +341 -0
  24. sierra/core/graphs/summary_line.py +506 -0
  25. sierra/core/logging.py +3 -2
  26. sierra/core/models/__init__.py +3 -1
  27. sierra/core/models/info.py +19 -0
  28. sierra/core/models/interface.py +52 -122
  29. sierra/core/pipeline/__init__.py +2 -5
  30. sierra/core/pipeline/pipeline.py +228 -126
  31. sierra/core/pipeline/stage1/__init__.py +10 -0
  32. sierra/core/pipeline/stage1/pipeline_stage1.py +45 -31
  33. sierra/core/pipeline/stage2/__init__.py +10 -0
  34. sierra/core/pipeline/stage2/pipeline_stage2.py +8 -11
  35. sierra/core/pipeline/stage2/runner.py +401 -0
  36. sierra/core/pipeline/stage3/__init__.py +12 -0
  37. sierra/core/pipeline/stage3/gather.py +321 -0
  38. sierra/core/pipeline/stage3/pipeline_stage3.py +37 -84
  39. sierra/core/pipeline/stage4/__init__.py +12 -2
  40. sierra/core/pipeline/stage4/pipeline_stage4.py +36 -354
  41. sierra/core/pipeline/stage5/__init__.py +12 -0
  42. sierra/core/pipeline/stage5/pipeline_stage5.py +33 -208
  43. sierra/core/pipeline/yaml.py +48 -0
  44. sierra/core/plugin.py +529 -62
  45. sierra/core/proc.py +11 -0
  46. sierra/core/prod.py +11 -0
  47. sierra/core/ros1/__init__.py +5 -1
  48. sierra/core/ros1/callbacks.py +22 -21
  49. sierra/core/ros1/cmdline.py +59 -88
  50. sierra/core/ros1/generators.py +159 -175
  51. sierra/core/ros1/variables/__init__.py +3 -0
  52. sierra/core/ros1/variables/exp_setup.py +122 -116
  53. sierra/core/startup.py +106 -76
  54. sierra/core/stat_kernels.py +4 -5
  55. sierra/core/storage.py +13 -32
  56. sierra/core/trampoline.py +30 -0
  57. sierra/core/types.py +116 -71
  58. sierra/core/utils.py +103 -106
  59. sierra/core/variables/__init__.py +1 -1
  60. sierra/core/variables/base_variable.py +12 -17
  61. sierra/core/variables/batch_criteria.py +387 -481
  62. sierra/core/variables/builtin.py +135 -0
  63. sierra/core/variables/exp_setup.py +19 -39
  64. sierra/core/variables/population_size.py +72 -76
  65. sierra/core/variables/variable_density.py +44 -68
  66. sierra/core/vector.py +1 -1
  67. sierra/main.py +256 -88
  68. sierra/plugins/__init__.py +119 -0
  69. sierra/plugins/compare/__init__.py +14 -0
  70. sierra/plugins/compare/graphs/__init__.py +19 -0
  71. sierra/plugins/compare/graphs/cmdline.py +120 -0
  72. sierra/plugins/compare/graphs/comparator.py +291 -0
  73. sierra/plugins/compare/graphs/inter_controller.py +531 -0
  74. sierra/plugins/compare/graphs/inter_scenario.py +297 -0
  75. sierra/plugins/compare/graphs/namecalc.py +53 -0
  76. sierra/plugins/compare/graphs/outputroot.py +73 -0
  77. sierra/plugins/compare/graphs/plugin.py +147 -0
  78. sierra/plugins/compare/graphs/preprocess.py +172 -0
  79. sierra/plugins/compare/graphs/schema.py +37 -0
  80. sierra/plugins/engine/__init__.py +14 -0
  81. sierra/plugins/engine/argos/__init__.py +18 -0
  82. sierra/plugins/{platform → engine}/argos/cmdline.py +144 -151
  83. sierra/plugins/{platform/argos/variables → engine/argos/generators}/__init__.py +5 -0
  84. sierra/plugins/engine/argos/generators/engine.py +394 -0
  85. sierra/plugins/engine/argos/plugin.py +393 -0
  86. sierra/plugins/{platform/argos/generators → engine/argos/variables}/__init__.py +5 -0
  87. sierra/plugins/engine/argos/variables/arena_shape.py +183 -0
  88. sierra/plugins/engine/argos/variables/cameras.py +240 -0
  89. sierra/plugins/engine/argos/variables/constant_density.py +112 -0
  90. sierra/plugins/engine/argos/variables/exp_setup.py +82 -0
  91. sierra/plugins/{platform → engine}/argos/variables/physics_engines.py +83 -87
  92. sierra/plugins/engine/argos/variables/population_constant_density.py +178 -0
  93. sierra/plugins/engine/argos/variables/population_size.py +115 -0
  94. sierra/plugins/engine/argos/variables/population_variable_density.py +123 -0
  95. sierra/plugins/engine/argos/variables/rendering.py +108 -0
  96. sierra/plugins/engine/ros1gazebo/__init__.py +18 -0
  97. sierra/plugins/engine/ros1gazebo/cmdline.py +175 -0
  98. sierra/plugins/{platform/ros1robot → engine/ros1gazebo}/generators/__init__.py +5 -0
  99. sierra/plugins/engine/ros1gazebo/generators/engine.py +125 -0
  100. sierra/plugins/engine/ros1gazebo/plugin.py +404 -0
  101. sierra/plugins/engine/ros1gazebo/variables/__init__.py +15 -0
  102. sierra/plugins/engine/ros1gazebo/variables/population_size.py +214 -0
  103. sierra/plugins/engine/ros1robot/__init__.py +18 -0
  104. sierra/plugins/engine/ros1robot/cmdline.py +159 -0
  105. sierra/plugins/{platform/ros1gazebo → engine/ros1robot}/generators/__init__.py +4 -0
  106. sierra/plugins/engine/ros1robot/generators/engine.py +95 -0
  107. sierra/plugins/engine/ros1robot/plugin.py +410 -0
  108. sierra/plugins/{hpc/local → engine/ros1robot/variables}/__init__.py +5 -0
  109. sierra/plugins/engine/ros1robot/variables/population_size.py +146 -0
  110. sierra/plugins/execenv/__init__.py +11 -0
  111. sierra/plugins/execenv/hpc/__init__.py +18 -0
  112. sierra/plugins/execenv/hpc/adhoc/__init__.py +18 -0
  113. sierra/plugins/execenv/hpc/adhoc/cmdline.py +30 -0
  114. sierra/plugins/execenv/hpc/adhoc/plugin.py +131 -0
  115. sierra/plugins/execenv/hpc/cmdline.py +137 -0
  116. sierra/plugins/execenv/hpc/local/__init__.py +18 -0
  117. sierra/plugins/execenv/hpc/local/cmdline.py +31 -0
  118. sierra/plugins/execenv/hpc/local/plugin.py +145 -0
  119. sierra/plugins/execenv/hpc/pbs/__init__.py +18 -0
  120. sierra/plugins/execenv/hpc/pbs/cmdline.py +30 -0
  121. sierra/plugins/execenv/hpc/pbs/plugin.py +121 -0
  122. sierra/plugins/execenv/hpc/slurm/__init__.py +18 -0
  123. sierra/plugins/execenv/hpc/slurm/cmdline.py +30 -0
  124. sierra/plugins/execenv/hpc/slurm/plugin.py +133 -0
  125. sierra/plugins/execenv/prefectserver/__init__.py +18 -0
  126. sierra/plugins/execenv/prefectserver/cmdline.py +66 -0
  127. sierra/plugins/execenv/prefectserver/dockerremote/__init__.py +18 -0
  128. sierra/plugins/execenv/prefectserver/dockerremote/cmdline.py +66 -0
  129. sierra/plugins/execenv/prefectserver/dockerremote/plugin.py +132 -0
  130. sierra/plugins/execenv/prefectserver/flow.py +66 -0
  131. sierra/plugins/execenv/prefectserver/local/__init__.py +18 -0
  132. sierra/plugins/execenv/prefectserver/local/cmdline.py +29 -0
  133. sierra/plugins/execenv/prefectserver/local/plugin.py +133 -0
  134. sierra/plugins/{hpc/adhoc → execenv/robot}/__init__.py +1 -0
  135. sierra/plugins/execenv/robot/turtlebot3/__init__.py +18 -0
  136. sierra/plugins/execenv/robot/turtlebot3/plugin.py +204 -0
  137. sierra/plugins/expdef/__init__.py +14 -0
  138. sierra/plugins/expdef/json/__init__.py +14 -0
  139. sierra/plugins/expdef/json/plugin.py +504 -0
  140. sierra/plugins/expdef/xml/__init__.py +14 -0
  141. sierra/plugins/expdef/xml/plugin.py +386 -0
  142. sierra/{core/hpc → plugins/proc}/__init__.py +1 -1
  143. sierra/plugins/proc/collate/__init__.py +15 -0
  144. sierra/plugins/proc/collate/cmdline.py +47 -0
  145. sierra/plugins/proc/collate/plugin.py +271 -0
  146. sierra/plugins/proc/compress/__init__.py +18 -0
  147. sierra/plugins/proc/compress/cmdline.py +47 -0
  148. sierra/plugins/proc/compress/plugin.py +123 -0
  149. sierra/plugins/proc/decompress/__init__.py +18 -0
  150. sierra/plugins/proc/decompress/plugin.py +96 -0
  151. sierra/plugins/proc/imagize/__init__.py +15 -0
  152. sierra/plugins/proc/imagize/cmdline.py +49 -0
  153. sierra/plugins/proc/imagize/plugin.py +270 -0
  154. sierra/plugins/proc/modelrunner/__init__.py +16 -0
  155. sierra/plugins/proc/modelrunner/plugin.py +250 -0
  156. sierra/plugins/proc/statistics/__init__.py +15 -0
  157. sierra/plugins/proc/statistics/cmdline.py +64 -0
  158. sierra/plugins/proc/statistics/plugin.py +390 -0
  159. sierra/plugins/{hpc → prod}/__init__.py +1 -0
  160. sierra/plugins/prod/graphs/__init__.py +18 -0
  161. sierra/plugins/prod/graphs/cmdline.py +269 -0
  162. sierra/plugins/prod/graphs/collate.py +279 -0
  163. sierra/plugins/prod/graphs/inter/__init__.py +13 -0
  164. sierra/plugins/prod/graphs/inter/generate.py +83 -0
  165. sierra/plugins/prod/graphs/inter/heatmap.py +86 -0
  166. sierra/plugins/prod/graphs/inter/line.py +134 -0
  167. sierra/plugins/prod/graphs/intra/__init__.py +15 -0
  168. sierra/plugins/prod/graphs/intra/generate.py +202 -0
  169. sierra/plugins/prod/graphs/intra/heatmap.py +74 -0
  170. sierra/plugins/prod/graphs/intra/line.py +114 -0
  171. sierra/plugins/prod/graphs/plugin.py +103 -0
  172. sierra/plugins/prod/graphs/targets.py +63 -0
  173. sierra/plugins/prod/render/__init__.py +18 -0
  174. sierra/plugins/prod/render/cmdline.py +72 -0
  175. sierra/plugins/prod/render/plugin.py +282 -0
  176. sierra/plugins/storage/__init__.py +5 -0
  177. sierra/plugins/storage/arrow/__init__.py +18 -0
  178. sierra/plugins/storage/arrow/plugin.py +38 -0
  179. sierra/plugins/storage/csv/__init__.py +9 -0
  180. sierra/plugins/storage/csv/plugin.py +12 -5
  181. sierra/version.py +3 -2
  182. sierra_research-1.5.0.dist-info/METADATA +238 -0
  183. sierra_research-1.5.0.dist-info/RECORD +186 -0
  184. {sierra_research-1.3.11.dist-info → sierra_research-1.5.0.dist-info}/WHEEL +1 -2
  185. sierra/core/experiment/xml.py +0 -454
  186. sierra/core/generators/controller_generator_parser.py +0 -34
  187. sierra/core/generators/exp_creator.py +0 -351
  188. sierra/core/generators/exp_generators.py +0 -142
  189. sierra/core/graphs/scatterplot2D.py +0 -109
  190. sierra/core/graphs/stacked_line_graph.py +0 -251
  191. sierra/core/graphs/stacked_surface_graph.py +0 -220
  192. sierra/core/graphs/summary_line_graph.py +0 -371
  193. sierra/core/hpc/cmdline.py +0 -142
  194. sierra/core/models/graphs.py +0 -87
  195. sierra/core/pipeline/stage2/exp_runner.py +0 -286
  196. sierra/core/pipeline/stage3/imagizer.py +0 -149
  197. sierra/core/pipeline/stage3/run_collator.py +0 -317
  198. sierra/core/pipeline/stage3/statistics_calculator.py +0 -478
  199. sierra/core/pipeline/stage4/graph_collator.py +0 -320
  200. sierra/core/pipeline/stage4/inter_exp_graph_generator.py +0 -240
  201. sierra/core/pipeline/stage4/intra_exp_graph_generator.py +0 -317
  202. sierra/core/pipeline/stage4/model_runner.py +0 -168
  203. sierra/core/pipeline/stage4/rendering.py +0 -283
  204. sierra/core/pipeline/stage4/yaml_config_loader.py +0 -103
  205. sierra/core/pipeline/stage5/inter_scenario_comparator.py +0 -328
  206. sierra/core/pipeline/stage5/intra_scenario_comparator.py +0 -989
  207. sierra/core/platform.py +0 -493
  208. sierra/core/plugin_manager.py +0 -369
  209. sierra/core/root_dirpath_generator.py +0 -241
  210. sierra/plugins/hpc/adhoc/plugin.py +0 -125
  211. sierra/plugins/hpc/local/plugin.py +0 -81
  212. sierra/plugins/hpc/pbs/__init__.py +0 -9
  213. sierra/plugins/hpc/pbs/plugin.py +0 -126
  214. sierra/plugins/hpc/slurm/__init__.py +0 -9
  215. sierra/plugins/hpc/slurm/plugin.py +0 -130
  216. sierra/plugins/platform/__init__.py +0 -9
  217. sierra/plugins/platform/argos/__init__.py +0 -9
  218. sierra/plugins/platform/argos/generators/platform_generators.py +0 -383
  219. sierra/plugins/platform/argos/plugin.py +0 -337
  220. sierra/plugins/platform/argos/variables/arena_shape.py +0 -145
  221. sierra/plugins/platform/argos/variables/cameras.py +0 -243
  222. sierra/plugins/platform/argos/variables/constant_density.py +0 -136
  223. sierra/plugins/platform/argos/variables/exp_setup.py +0 -113
  224. sierra/plugins/platform/argos/variables/population_constant_density.py +0 -175
  225. sierra/plugins/platform/argos/variables/population_size.py +0 -102
  226. sierra/plugins/platform/argos/variables/population_variable_density.py +0 -132
  227. sierra/plugins/platform/argos/variables/rendering.py +0 -104
  228. sierra/plugins/platform/ros1gazebo/__init__.py +0 -9
  229. sierra/plugins/platform/ros1gazebo/cmdline.py +0 -213
  230. sierra/plugins/platform/ros1gazebo/generators/platform_generators.py +0 -137
  231. sierra/plugins/platform/ros1gazebo/plugin.py +0 -335
  232. sierra/plugins/platform/ros1gazebo/variables/__init__.py +0 -10
  233. sierra/plugins/platform/ros1gazebo/variables/population_size.py +0 -204
  234. sierra/plugins/platform/ros1robot/__init__.py +0 -9
  235. sierra/plugins/platform/ros1robot/cmdline.py +0 -175
  236. sierra/plugins/platform/ros1robot/generators/platform_generators.py +0 -112
  237. sierra/plugins/platform/ros1robot/plugin.py +0 -373
  238. sierra/plugins/platform/ros1robot/variables/__init__.py +0 -10
  239. sierra/plugins/platform/ros1robot/variables/population_size.py +0 -146
  240. sierra/plugins/robot/__init__.py +0 -9
  241. sierra/plugins/robot/turtlebot3/__init__.py +0 -9
  242. sierra/plugins/robot/turtlebot3/plugin.py +0 -194
  243. sierra_research-1.3.11.data/data/share/man/man1/sierra-cli.1 +0 -2349
  244. sierra_research-1.3.11.data/data/share/man/man7/sierra-examples.7 +0 -508
  245. sierra_research-1.3.11.data/data/share/man/man7/sierra-exec-envs.7 +0 -331
  246. sierra_research-1.3.11.data/data/share/man/man7/sierra-glossary.7 +0 -285
  247. sierra_research-1.3.11.data/data/share/man/man7/sierra-platforms.7 +0 -358
  248. sierra_research-1.3.11.data/data/share/man/man7/sierra-usage.7 +0 -729
  249. sierra_research-1.3.11.data/data/share/man/man7/sierra.7 +0 -78
  250. sierra_research-1.3.11.dist-info/METADATA +0 -492
  251. sierra_research-1.3.11.dist-info/RECORD +0 -133
  252. sierra_research-1.3.11.dist-info/top_level.txt +0 -1
  253. {sierra_research-1.3.11.dist-info → sierra_research-1.5.0.dist-info}/entry_points.txt +0 -0
  254. {sierra_research-1.3.11.dist-info → sierra_research-1.5.0.dist-info/licenses}/LICENSE +0 -0
sierra/core/cmdline.py CHANGED
@@ -10,20 +10,22 @@ import sys
10
10
  import typing as tp
11
11
 
12
12
  # 3rd party packages
13
+ import psutil
13
14
 
14
15
  # Project packages
15
16
  import sierra.version
16
17
  from sierra.core import utils
17
18
 
18
- kVersionMsg = ("reSearch pIpEline for Reproducibility, Reusability and "
19
- f"Automation (SIERRA) v{sierra.version.__version__}.\n"
20
- "License: MIT.\n"
21
- "This is free software: you are free to change and redistribute it.\n"
22
- "SIERRA comes with no warranty.\n\n"
23
-
24
- "See the documentation at "
25
- "https://sierra.readthedocs.io/en/master/,\n"
26
- "or 'man sierra' for details.\n")
19
+ kVersionMsg = (
20
+ "reSearch pIpEline for Reproducibility, Reusability and "
21
+ f"Automation (SIERRA) v{sierra.version.__version__}.\n"
22
+ "License: MIT.\n"
23
+ "This is free software: you are free to change and redistribute it.\n"
24
+ "SIERRA comes with no warranty.\n\n"
25
+ "See the documentation at "
26
+ "https://sierra.readthedocs.io/en/master/,\n"
27
+ "or 'man sierra' for details.\n"
28
+ )
27
29
 
28
30
 
29
31
  class ArgumentParser(argparse.ArgumentParser):
@@ -34,16 +36,16 @@ class ArgumentParser(argparse.ArgumentParser):
34
36
 
35
37
  """
36
38
 
37
- kHelpMsg = ("Usage:\n\nsierra-cli [-v | --version] [OPTION]...\n\n"
38
- "What command line options SIERRA accepts depends on the loaded\n"
39
- "--project, --platform, --exec-env, and project-specific options.\n"
40
- "'man sierra-cli' will give you the full set of options that\n"
41
- "comes with SIERRA.\n\n")
39
+ kHelpMsg = (
40
+ "Usage:\n\nsierra-cli [-v | --version] [OPTION]...\n\n"
41
+ "What command line options SIERRA accepts depends on the loaded\n"
42
+ "plugin set. 'man sierra-cli' will give you the full set of options\n"
43
+ "that comes with SIERRA.\n\n"
44
+ )
42
45
 
43
46
  def error(self, message):
44
47
  self.print_usage(sys.stderr)
45
- # self.print_help(sys.stderr)
46
- self.exit(2, '{0}: error: {1}\n'.format(self.prog, message))
48
+ self.exit(2, f"{self.prog}: error: {message}\n")
47
49
 
48
50
  def print_help(self, file=None):
49
51
  if file is None:
@@ -58,25 +60,39 @@ class BaseCmdline:
58
60
 
59
61
  """
60
62
 
63
+ def __init__(self) -> None:
64
+ self.multistage_desc = (
65
+ "Multi-stage options",
66
+ "Options which are used in multiple pipeline stages",
67
+ )
68
+ self.stage1_desc = "Stage 1 options", "Options for generating experiments"
69
+ self.stage2_desc = "Stage 2 options", "Options for running experiments"
70
+ self.stage3_desc = (
71
+ "Stage 3 options",
72
+ "Options for processing experiment results",
73
+ )
74
+ self.stage4_desc = "Stage 4 options", "Options for generating products"
75
+ self.stage5_desc = "Stage 5 options", "Options for product comparison"
76
+
61
77
  @staticmethod
62
- def stage_usage_doc(stages: tp.List[int],
63
- omitted: str = "If omitted: N/A.") -> str:
78
+ def stage_usage_doc(stages: tp.List[int], omitted: str = "If omitted: N/A.") -> str:
64
79
  lst = ",".join(map(str, stages))
65
- header = "\n.. TIP:: Used by stage {" + \
66
- lst + "}; can be omitted otherwise. " + omitted + "\n"
80
+ header = "\n.. TIP:: Used by stage {0}; can be omitted otherwise. {1}\n".format(
81
+ lst, omitted
82
+ )
67
83
  return header
68
84
 
69
85
  @staticmethod
70
86
  def bc_applicable_doc(criteria: tp.List[str]) -> str:
71
87
  lst = "".join(map(lambda bc: " - " + bc + "\n", criteria))
72
- return "\n.. TIP:: Applicable batch criteria:\n\n" + lst + "\n"
88
+ return f"\n.. TIP:: Applicable batch criteria:\n\n{lst}\n"
73
89
 
74
90
  @staticmethod
75
91
  def graphs_applicable_doc(graphs: tp.List[str]) -> str:
76
- lst = "".join(map(lambda graph: " - " +
77
- utils.sphinx_ref(graph) + "\n",
78
- graphs))
79
- return "\n.. TIP:: Applicable graphs:\n\n" + lst + "\n"
92
+ lst = "".join(
93
+ map(lambda graph: " - " + utils.sphinx_ref(graph) + "\n", graphs)
94
+ )
95
+ return f"\n.. TIP:: Applicable graphs:\n\n{lst}\n"
80
96
 
81
97
 
82
98
  class BootstrapCmdline(BaseCmdline):
@@ -85,145 +101,317 @@ class BootstrapCmdline(BaseCmdline):
85
101
  """
86
102
 
87
103
  def __init__(self) -> None:
88
- self.parser = ArgumentParser(add_help=True,
89
- allow_abbrev=False)
90
-
91
- bootstrap = self.parser.add_argument_group('Bootstrap options',
92
- 'Bare-bones options for bootstrapping SIERRA')
93
-
94
- bootstrap.add_argument("--project",
95
- help="""
96
-
97
- Specify which :term:`Project` to load.
98
-
99
- """ + self.stage_usage_doc([1, 2, 3, 4, 5]))
100
-
101
- bootstrap.add_argument("--version", "-v",
102
- help="""
103
-
104
- Display SIERRA version information on stdout and
105
- then exit.
106
-
107
- """,
108
- action='store_true')
109
-
110
- bootstrap.add_argument("--log-level",
111
- choices=["ERROR",
112
- "INFO",
113
- "WARNING",
114
- "DEBUG",
115
- "TRACE"],
116
- help="""
117
-
118
- The level of logging to use when running
119
- SIERRA.
120
-
121
- """ + self.stage_usage_doc([1, 2, 3, 4, 5]),
122
- default="INFO")
123
-
124
- bootstrap.add_argument("--platform",
125
- help="""
126
- This argument defines the :term:`Platform` you
127
- want to run experiments on.
128
-
129
- The value of this argument determines the
130
- execution environment for experiments; different
131
- platforms (e.g., simulator, real robots) will
132
- have different configuration options.
133
-
134
- Valid values can be any folder name inside a
135
- folder on the :envvar:`SIERRA_PLUGIN_PATH` (with
136
- ``/`` replaced with ``.`` as you would expect for
137
- using path names to address python packages). The
138
- platforms which come with SIERRA are:
139
-
140
- - ``platform.argos`` - This directs SIERRA to run
141
- experiments using the :term:`ARGoS`
142
- simulator. Selecting this platform assumes your
143
- code has been developed and configured for
144
- ARGoS.
145
-
146
- - ``platform.ros1gazebo`` - This directs SIERRA to
147
- run experiments using the :term:`Gazebo`
148
- simulator and :term:`ROS1`. Selecting this
149
- platform assumes your code has been developed
150
- and configured for Gazebo and ROS1.
151
-
152
- """,
153
- default='platform.argos')
154
-
155
- bootstrap.add_argument("--skip-pkg-checks",
156
- help="""
157
-
158
- Skip the usual startup package checks. Only do
159
- this if you are SURE you will never use the
160
- SIERRA functionality which requires packages you
161
- don't have installed/can't install.
162
-
163
- """,
164
- action='store_true')
165
-
166
- bootstrap.add_argument("--exec-env",
167
- help="""
168
- This argument defines `how` experiments are going
169
- to be run, using the ``--platform`` you have
170
- selected.
171
-
172
- Valid values can be any folder name inside a
173
- folder on the :envvar:`SIERRA_PLUGIN_PATH` (with
174
- ``/`` replaced with ``.`` as you would expect for
175
- using path names to address python packages). The
176
- execution environments which come with SIERRA
177
- are:
178
-
179
- - ``hpc.local`` - This directs SIERRA to run
180
- experiments on the local machine. See
181
- :ref:`ln-sierra-hpc-plugins-local` for a detailed
182
- description.
183
-
184
- - ``hpc.pbs`` - The directs SIERRA to run
185
- experiments spread across multiple allocated
186
- nodes in an HPC computing environment managed
187
- by TORQUE-PBS. See :ref:`ln-sierra-hpc-plugins-pbs`
188
- for a detailed description.
189
-
190
- - ``hpc.slurm`` - The directs SIERRA to run
191
- experiments spread across multiple allocated
192
- nodes in an HPC computing environment managed
193
- by SLURM. See
194
- :ref:`ln-sierra-hpc-plugins-slurm` for a
195
- detailed description.
196
-
197
- - ``hpc.adhoc`` - This will direct SIERRA to run
198
- experiments on an ad-hoc network of
199
- computers. See
200
- :ref:`ln-sierra-hpc-plugins-adhoc` for a
201
- detailed description.
202
-
203
- - ``robot.turtlebot3`` - This will direct SIERRA
204
- to run experiments on real Turtlebots.
205
-
206
- Not all platforms support all execution
207
- environments.
208
- """ + self.stage_usage_doc([1, 2]),
209
- default='hpc.local')
104
+ super().__init__()
105
+
106
+ self.parser = ArgumentParser(add_help=True, allow_abbrev=False)
107
+
108
+ bootstrap = self.parser.add_argument_group(
109
+ "Bootstrap options", "Bare-bones options for bootstrapping SIERRA"
110
+ )
111
+
112
+ bootstrap.add_argument(
113
+ "--project",
114
+ help="""
115
+ Specify which :term:`Project` to load.
116
+ """
117
+ + self.stage_usage_doc([1, 2, 3, 4, 5]),
118
+ )
119
+
120
+ bootstrap.add_argument(
121
+ "--version",
122
+ "-v",
123
+ help="""
124
+ Display SIERRA version information on stdout and then exit.
125
+ """,
126
+ action="store_true",
127
+ )
128
+
129
+ bootstrap.add_argument(
130
+ "--log-level",
131
+ choices=["ERROR", "INFO", "WARNING", "DEBUG", "TRACE"],
132
+ help="""
133
+ The level of logging to use when running SIERRA.
134
+ """
135
+ + self.stage_usage_doc([1, 2, 3, 4, 5]),
136
+ default="INFO",
137
+ )
138
+
139
+ bootstrap.add_argument(
140
+ "--engine",
141
+ help="""
142
+ This argument defines the :term:`Engine` you want to run
143
+ experiments on.
144
+
145
+ The value of this argument determines the execution environment
146
+ for experiments; different engines (e.g., simulator, real
147
+ robots) will have different configuration options.
148
+
149
+ Valid values can be any folder name inside a folder on the
150
+ :envvar:`SIERRA_PLUGIN_PATH` (with ``/`` replaced with ``.`` as
151
+ you would expect for using path names to address python
152
+ packages). The engines which come with SIERRA are:
153
+
154
+ - ``engine.argos`` - This directs SIERRA to run experiments
155
+ using the :term:`ARGoS` simulator. Selecting this engine
156
+ assumes your code has been developed and configured for
157
+ ARGoS.
158
+
159
+ - ``engine.ros1gazebo`` - This directs SIERRA to run
160
+ experiments using the :term:`Gazebo` simulator and
161
+ :term:`ROS1`. Selecting this engine assumes your code
162
+ has been developed and configured for Gazebo and ROS1.
163
+
164
+ - ``engine.ros1robot`` - This directs SIERRA to run
165
+ experiments using :term:`ROS1` on a real robot of your
166
+ choosing. Selecting this engine assumes your code has
167
+ been developed and configured for ROS1.
168
+ """,
169
+ default="engine.argos",
170
+ )
171
+
172
+ bootstrap.add_argument(
173
+ "--skip-pkg-checks",
174
+ help="""
175
+ Skip the usual startup package checks. Only do this if you are
176
+ SURE you will never use the SIERRA functionality which requires
177
+ packages you don't have installed/can't install.
178
+ """,
179
+ action="store_true",
180
+ )
181
+
182
+ bootstrap.add_argument(
183
+ "--execenv",
184
+ help="""
185
+ This argument defines `how` experiments are going to be run,
186
+ using the ``--engine`` you have selected.
187
+
188
+ Valid values can be any folder name inside a folder on the
189
+ :envvar:`SIERRA_PLUGIN_PATH` (with ``/`` replaced with ``.`` as
190
+ you would expect for using path names to address python
191
+ packages). The execution environments which come with SIERRA
192
+ are:
193
+
194
+ - ``hpc.local`` - This directs SIERRA to run experiments on
195
+ the local machine. See :ref:`plugins/execenv/hpc/local`
196
+ for a detailed description.
197
+
198
+ - ``hpc.pbs`` - The directs SIERRA to run experiments
199
+ spread across multiple allocated nodes in an HPC
200
+ computing environment managed by TORQUE-PBS. See
201
+ :ref:`plugins/execenv/hpc/pbs` for a detailed
202
+ description.
203
+
204
+ - ``hpc.slurm`` - The directs SIERRA to run experiments
205
+ spread across multiple allocated nodes in an HPC
206
+ computing environment managed by SLURM. See
207
+ :ref:`plugins/execenv/hpc/slurm` for a detailed
208
+ description.
209
+
210
+ - ``hpc.adhoc`` - This will direct SIERRA to run
211
+ experiments on an ad-hoc network of computers. See
212
+ :ref:`plugins/execenv/hpc/adhoc` for a detailed
213
+ description.
214
+
215
+ - ``prefectserver.local`` - This will direct SIERRA to run
216
+ experiments locally using a spun-up :term:`Prefect` job
217
+ scheduler/server. See
218
+ :ref:`plugins/execenv/prefectserver/local` for a
219
+ detailed description.
220
+
221
+ - ``prefectserver.dockerremote`` - This will direct SIERRA
222
+ to run experiments remote using a :term:`Prefect` job
223
+ scheduler/server in docker containers. See
224
+ :ref:`plugins/execenv/prefectserver/dockerremote` for a
225
+ detailed description.
226
+
227
+ - ``robot.turtlebot3`` - This will direct SIERRA to run
228
+ experiments on real Turtlebots.
229
+
230
+ Not all engines support all execution environments.
231
+ """
232
+ + self.stage_usage_doc([1, 2]),
233
+ default="hpc.local",
234
+ )
235
+
236
+ bootstrap.add_argument(
237
+ "--expdef",
238
+ help="""
239
+ Specify the experiment definition format, so that SIERRA can
240
+ select an appropriate plugin to read/write files of that
241
+ format, and manipulate in-memory representations to create
242
+ runnable experiments. Any plugin on
243
+ :envvar:`SIERRA_PLUGIN_PATH` can be used, but the ones that
244
+ come with SIERRA are:
245
+
246
+ - ``expdef.xml`` - Experimental definitions are created
247
+ from XML files. This causes ``--expdef-template`` to be
248
+ parsed as XML.
249
+
250
+ - ``expdef.json`` - Experimental definitions are created
251
+ from json files. This causes ``--expdef-template`` to be
252
+ parsed as JSON.
253
+ """
254
+ + self.stage_usage_doc([1, 4, 5]),
255
+ default="expdef.xml",
256
+ )
257
+ bootstrap.add_argument(
258
+ "--storage",
259
+ help="""
260
+ Specify the storage medium for :term:`Experimental Run`
261
+ outputs, so that SIERRA can select an appropriate plugin to
262
+ read them. Any plugin on :envvar:`SIERRA_PLUGIN_PATH`, but the
263
+ ones that come with SIERRA are:
264
+
265
+ - ``storage.csv`` - Experimental run outputs are stored in
266
+ a per-run directory as one or more CSV files.
267
+
268
+ - ``storage.arrow`` - Experimental run outputs are stored
269
+ in a per-run directory as one or more apache arrow files.
270
+
271
+ Regardless of the value of this option, SIERRA always generates
272
+ CSV files as it runs and averages outputs, generates graphs,
273
+ etc.
274
+ """
275
+ + self.stage_usage_doc([3]),
276
+ default="storage.csv",
277
+ )
278
+
279
+ bootstrap.add_argument(
280
+ "--proc",
281
+ help="""
282
+ Specify the set of plugins to run during stage 3 for data
283
+ processing. The plugins are executed IN ORDER of appearance,
284
+ so make sure to handle dependencies. Any plugin on
285
+ :envvar:`SIERRA_PLUGIN_PATH` can be used, but the ones that
286
+ come with SIERRA are:
287
+
288
+ - ``proc.statistics`` - Generate statistics from all
289
+ :term:`Raw Output Data` files.
290
+
291
+ - ``proc.imagize`` - :term:`Imagize` :term:`Raw Output
292
+ Data` files.
293
+
294
+ - ``proc.collate`` - Performs :term:`Data Collation` on
295
+ :term:`Raw Output Data` files.
296
+
297
+ - ``proc.compress`` - Performs data compression on all
298
+ :term:`Raw Output Data` files.
299
+
300
+ - ``proc.decompress`` - Performs data decompression on all
301
+ :term:`Raw Output Data` files previously compresed with
302
+ ``proc.compress``.
303
+ """
304
+ + self.stage_usage_doc([3]),
305
+ nargs="+",
306
+ default=["proc.statistics", "proc.collate"],
307
+ )
308
+
309
+ bootstrap.add_argument(
310
+ "--prod",
311
+ help="""
312
+ Specify the set of plugins to run during stage 4 for
313
+ product/deliverable generation. The plugins are executed IN
314
+ ORDER of appearance, so make sure to handle dependencies. Any
315
+ plugin on :envvar:`SIERRA_PLUGIN_PATH` can be used, but the
316
+ ones that come with SIERRA are:
317
+
318
+ - ``prod.graphs`` - Generate graphs :term:`Processed Output
319
+ Data` files.
320
+
321
+ - ``prod.render`` - Render previously :term:`imagized
322
+ <Imagize>` files into videos.
323
+ """
324
+ + self.stage_usage_doc([4]),
325
+ nargs="+",
326
+ default=["prod.graphs"],
327
+ )
328
+
329
+ bootstrap.add_argument(
330
+ "--compare",
331
+ help="""
332
+ Specify the set of plugins to run during stage 5 for
333
+ product/deliverable comparison. The plugins are executed IN
334
+ ORDER of appearance, so make sure to handle dependencies. Any
335
+ plugin on :envvar:`SIERRA_PLUGIN_PATH` can be used, but the
336
+ ones that come with SIERRA are:
337
+
338
+ - ``compare.graphs`` - Combine previously generated graphs
339
+ onto a single plot.
340
+ """
341
+ + self.stage_usage_doc([5]),
342
+ nargs="+",
343
+ default=["compare.graphs"],
344
+ )
345
+ bootstrap.add_argument(
346
+ "--rcfile",
347
+ help="""
348
+ Specify the rcfile SIERRA should read additional cmdline
349
+ arguments from. Any rcfile arguments overriden by cmdline
350
+ args, if both are present. See also :envvar:`SIERRA_RCFILE`.
351
+ """
352
+ + self.stage_usage_doc([1, 2, 3, 4, 5]),
353
+ )
210
354
 
211
355
 
212
356
  class CoreCmdline(BaseCmdline):
213
- """Defines the core command line arguments for SIERRA using :class:`argparse`.
357
+ """Defines the core command line arguments for SIERRA using :class:`argparse`."""
214
358
 
215
- """
359
+ def __init__(
360
+ self, parents: tp.Optional[tp.List[ArgumentParser]], stages: tp.List[int]
361
+ ) -> None:
362
+ super().__init__()
216
363
 
217
- def __init__(self,
218
- parents: tp.Optional[tp.List[ArgumentParser]],
219
- stages: tp.List[int]) -> None:
220
364
  self.scaffold_cli(parents)
221
365
  self.init_cli(stages)
222
366
 
367
+ def scaffold_cli(self, parents: tp.Optional[tp.List[ArgumentParser]]) -> None:
368
+ """
369
+ Scaffold CLI by defining the parser and common argument groups.
370
+ """
371
+ if parents is not None:
372
+ self.parser = ArgumentParser(
373
+ prog="sierra-cli", parents=parents, add_help=False, allow_abbrev=False
374
+ )
375
+ else:
376
+ self.parser = ArgumentParser(
377
+ prog="sierra-cli", add_help=False, allow_abbrev=False
378
+ )
379
+
380
+ self.multistage = self.parser.add_argument_group(
381
+ self.multistage_desc[0], self.multistage_desc[1]
382
+ )
383
+ self.stage1 = self.parser.add_argument_group(
384
+ self.stage1_desc[0], self.stage1_desc[1]
385
+ )
386
+ self.stage2 = self.parser.add_argument_group(
387
+ self.stage2_desc[0], self.stage2_desc[1]
388
+ )
389
+ self.stage3 = self.parser.add_argument_group(
390
+ self.stage3_desc[0], self.stage3_desc[1]
391
+ )
392
+ self.stage4 = self.parser.add_argument_group(
393
+ self.stage4_desc[0], self.stage4_desc[1]
394
+ )
395
+ self.stage5 = self.parser.add_argument_group(
396
+ self.stage5_desc[0], self.stage5_desc[1]
397
+ )
398
+ self.shortforms = self.parser.add_argument_group(
399
+ title="Shortform aliases",
400
+ description="""
401
+ Most cmdline options to SIERRA are longform (i.e.,
402
+ ``--option``), but some families of options have
403
+ shortforms (i.e., ``-o`` for ``--option``) as well.
404
+ Shortform arguments behave the same as their longform
405
+ counterparts. If both are passed, the the shortform
406
+ overrides.
407
+ """,
408
+ )
409
+
223
410
  def init_cli(self, stages: tp.List[int]) -> None:
224
411
  """Define cmdline arguments for stages 1-5."""
225
412
  if -1 in stages:
226
413
  self.init_multistage()
414
+ self.init_shortforms()
227
415
 
228
416
  if 1 in stages:
229
417
  self.init_stage1()
@@ -240,956 +428,392 @@ class CoreCmdline(BaseCmdline):
240
428
  if 5 in stages:
241
429
  self.init_stage5()
242
430
 
243
- def scaffold_cli(self,
244
- parents: tp.Optional[tp.List[ArgumentParser]]) -> None:
431
+ def init_shortforms(self) -> None:
245
432
  """
246
- Scaffold CLI by defining the parser and common argument groups.
433
+ Define cmdline shortform arguments for all pipeline stages.
247
434
  """
248
- if parents is not None:
249
- self.parser = ArgumentParser(parents=parents,
250
- add_help=False,
251
- allow_abbrev=False)
252
- else:
253
- self.parser = ArgumentParser(add_help=False,
254
- allow_abbrev=False)
255
-
256
- self.multistage = self.parser.add_argument_group('Multi-stage options',
257
- 'Options which are used in multiple pipeline stages')
258
- self.stage1 = self.parser.add_argument_group(
259
- 'Stage1: General options for generating experiments')
260
- self.stage2 = self.parser.add_argument_group(
261
- 'Stage2: General options for running experiments')
262
- self.stage3 = self.parser.add_argument_group(
263
- 'Stage3: General options for eprocessing experiment results')
264
- self.stage4 = self.parser.add_argument_group(
265
- 'Stage4: General options for generating graphs')
266
- self.stage5 = self.parser.add_argument_group(
267
- 'Stage5: General options for controller comparison')
435
+ self.shortforms.add_argument(
436
+ "-p",
437
+ action="append",
438
+ nargs="+",
439
+ help="""
440
+ Alias of ``--plot-``; any number of ``--plot-XX`` option can be
441
+ passed with separate ``-p`` arguments . If the argument to
442
+ ``-p`` does not map to a valid ``plot-XX`` option it is
443
+ ignored.
444
+
445
+ .. versionadded:: 1.3.14
446
+ """,
447
+ )
448
+
449
+ self.shortforms.add_argument(
450
+ "-e",
451
+ action="append",
452
+ nargs="+",
453
+ help="""
454
+ Alias of ``--exp-``; any number of ``--exp-XX`` option can be
455
+ passed with separate ``-e`` arguments . If the argument to
456
+ ``-e`` does not map to a valid ``exp-XX`` option it is ignored.
457
+
458
+ .. versionadded:: 1.3.14
459
+ """,
460
+ )
461
+
462
+ self.shortforms.add_argument(
463
+ "-x",
464
+ action="append",
465
+ nargs="+",
466
+ help="""
467
+ Alias of ``--exec-``; any number of ``--exec-XX`` option can be
468
+ passed with separate ``-x`` arguments . If the argument to
469
+ ``-x`` does not map to a valid ``exec-XX`` option it is
470
+ ignored.
471
+
472
+ .. versionadded:: 1.3.14
473
+ """,
474
+ )
475
+
476
+ self.shortforms.add_argument(
477
+ "-s",
478
+ action="append",
479
+ nargs="+",
480
+ help="""
481
+ Alias of ``--skip``; any number of ``--skip-XX`` option can be
482
+ passed with separate ``-s`` arguments . If the argument to
483
+ ``-s`` does not map to a valid ``skip-XX`` option it is
484
+ ignored.
485
+
486
+ .. versionadded:: 1.3.14
487
+ """,
488
+ )
268
489
 
269
490
  def init_multistage(self) -> None:
270
491
  """
271
492
  Define cmdline arguments which are used in multiple pipeline stages.
272
493
  """
273
- self.multistage.add_argument("--template-input-file",
274
- metavar="filepath",
275
- help="""
276
-
277
- The template ``.xml`` input file for the
278
- batch experiment. Beyond the requirements
279
- for the specific ``--platform``, the
280
- content of the file can be any valid XML,
281
- with the exception of the SIERRA
282
- requirements detailed in
283
- :ref:`ln-sierra-tutorials-project-template-input-file`.
284
-
285
- """ + self.stage_usage_doc([1, 2, 3, 4]))
286
-
287
- self.multistage.add_argument("--exp-overwrite",
288
- help="""
289
-
290
- When SIERRA calculates the batch experiment
291
- root (or any child path in the batch
292
- experiment root) during stage {1, 2}, if
293
- the calculated path already exists it is
294
- treated as a fatal error and no
295
- modifications to the filesystem are
296
- performed. This flag overwrides the default
297
- behavior. Provided to avoid accidentally
298
- overwrite input/output files for an
299
- experiment, forcing the user to be explicit
300
- with potentially dangerous actions.
301
-
302
- """ + self.stage_usage_doc([1, 2]),
303
- action='store_true')
304
-
305
- self.multistage.add_argument("--sierra-root",
306
- metavar="dirpath",
307
- help="""
308
-
309
- Root directory for all SIERRA generated and
310
- created files.
311
-
312
- Subdirectories for controllers, scenarios,
313
- experiment/experimental run inputs/outputs
314
- will be created in this directory as
315
- needed. Can persist between invocations of
316
- SIERRA.
317
-
318
- """ + self.stage_usage_doc([1, 2, 3, 4, 5]),
319
- default="<home directory>/exp")
320
-
321
- self.multistage.add_argument("--batch-criteria",
322
- metavar="[<category>.<definition>,...]",
323
- help="""
324
-
325
- Definition of criteria(s) to use to define
326
- the experiment.
327
-
328
- Specified as a list of 0 or 1 space
329
- separated strings, each with the following
330
- general structure:
331
-
332
- ``<category>.<definition>``
333
-
334
- ``<category>`` must be a filename from the
335
- ``core/variables/`` or from a ``--project``
336
- ``<project>/variables/`` directory, and
337
- ``<definition>`` must be a parsable namne
338
- (according to the requirements of the
339
- criteria defined by the parser for
340
- ``<category>``).
341
-
342
- """ + self.stage_usage_doc([1, 2, 3, 4, 5]),
343
- nargs='+',
344
- default=[])
345
-
346
- self.multistage.add_argument("--pipeline",
347
- help="""
348
- Define which stages of the experimental
349
- pipeline to run:
350
-
351
- - Stage1 - Generate the experiment
352
- definition from the template input file,
353
- batch criteria, and other command line
354
- options. Part of default pipeline.
355
-
356
- - Stage2 - Run a previously generated
357
- experiment. Part of default pipeline.
358
-
359
- - Stage3 - Post-process experimental
360
- results after running the batch
361
- experiment; some parts of this can be
362
- done in parallel. Part of default
363
- pipeline.
364
-
365
- - Stage4 - Perform deliverable generation
366
- after processing results for a batch
367
- experiment, which can include shiny
368
- graphs and videos. Part of default
369
- pipeline.
370
-
371
- - Stage5 - Perform graph generation for
372
- comparing controllers AFTER graph
373
- generation for batch experiments has been
374
- run. Not part of default pipeline.
375
-
376
- """,
377
- type=int,
378
- nargs='*',
379
- default=[1, 2, 3, 4]
380
- )
381
- self.multistage.add_argument("--exp-range",
382
- help="""
383
-
384
- Set the experiment numbers from the batch to
385
- run, average, generate intra-experiment
386
- graphs from, or generate inter-experiment
387
- graphs from (0 based). Specified in the form
388
- ``min_exp_num:max_exp_num`` (closed
389
- interval/inclusive). If omitted, runs,
390
- averages, and generates intra-experiment and
391
- inter-experiment performance measure graphs
392
- for all experiments in the batch (default
393
- behavior).
394
-
395
- This is useful to re-run part of a batch
396
- experiment in HPC environments if SIERRA
397
- gets killed before it finishes running all
398
- experiments in the batch, or to redo a
399
- single experiment with real robots which
400
- failed for some reason.
401
-
402
- """ + self.stage_usage_doc([2, 3, 4]))
403
-
404
- self.multistage.add_argument("--platform-vc",
405
- help="""
406
-
407
- For applicable ``--platforms``, enable
408
- visual capturing of run-time data during
409
- stage 2. This data can be frames (i.e., .png
410
- files), or rendering videos, depending on
411
- the platform. If the captured data was
412
- frames, then SIERRA can render the captured
413
- frames into videos during stage 4. If the
414
- selected ``--platform`` does not support
415
- visual capture, then this option has no
416
- effect. See
417
- :ref:`ln-sierra-usage-rendering-platform`
418
- for full details.
419
-
420
- """ + self.stage_usage_doc([1, 4]),
421
- action='store_true')
422
-
423
- self.multistage.add_argument("--processing-serial",
424
- help="""
425
-
426
- If TRUE, then results processing/graph
427
- generation will be performed serially,
428
- rather than using parallellism where
429
- possible.
430
-
431
- """ + self.stage_usage_doc([3, 4]),
432
- action='store_true')
433
-
434
- self.multistage.add_argument("--n-runs",
435
- type=int,
436
- help="""
437
-
438
- The # of experimental runs that will be
439
- executed and their results processed to form
440
- the result of a single experiment within a
441
- batch.
442
-
443
- If ``--platform`` is a simulator and
444
- ``--exec-env`` is something other than
445
- ``hpc.local`` then this may be be used to
446
- determine the concurrency of experimental
447
- runs.
448
-
449
- """ + self.stage_usage_doc([1, 2]))
450
-
451
- self.multistage.add_argument("--skip-collate",
452
- help="""
453
-
454
- Specify that no collation of data across
455
- experiments within a batch (stage 4) or
456
- across runs within an experiment (stage 3)
457
- should be performed. Useful if collation
458
- takes a long time and multiple types of
459
- stage 4 outputs are desired. Collation is
460
- generally idempotent unless you change the
461
- stage3 options (YMMV).
462
-
463
- """ + self.stage_usage_doc([3, 4]),
464
- action='store_true')
465
- # Plotting options
466
- self.multistage.add_argument("--plot-log-xscale",
467
- help="""
468
-
469
- Place the set of X values used to generate intra- and
470
- inter-experiment graphs into the logarithmic
471
- space. Mainly useful when the batch criteria involves
472
- large system sizes, so that the plots are more
473
- readable.
474
-
475
- """ +
476
-
477
- self.graphs_applicable_doc([':class:`~sierra.core.graphs.summary_line_graph.SummaryLineGraph`']) +
478
- self.stage_usage_doc([4, 5]),
479
- action='store_true')
480
-
481
- self.multistage.add_argument("--plot-enumerated-xscale",
482
- help="""
483
-
484
- Instead of using the values generated by a
485
- given batch criteria for the X values, use
486
- an enumerated list[0, ..., len(X value) -
487
- 1]. Mainly useful when the batch criteria
488
- involves large system sizes, so that the
489
- plots are more readable.
490
-
491
- """ +
492
-
493
- self.graphs_applicable_doc([':class:`~sierra.core.graphs.summary_line_graph.SummaryLineGraph`']) +
494
- self.stage_usage_doc([4, 5]),
495
- action='store_true')
496
-
497
- self.multistage.add_argument("--plot-log-yscale",
498
- help="""
499
-
500
- Place the set of Y values used to generate
501
- intra - and inter-experiment graphs into
502
- the logarithmic space. Mainly useful when
503
- the batch criteria involves large system
504
- sizes, so that the plots are more readable.
505
-
506
- """ +
507
-
508
- self.graphs_applicable_doc([':class:`~sierra.core.graphs.summary_line_graph.SummaryLineGraph`',
509
- ':class:`~sierra.core.graphs.stacked_line_graph.StackedLineGraph`']) +
510
- self.stage_usage_doc([4, 5]),
511
- action='store_true')
512
-
513
- self.multistage.add_argument("--plot-regression-lines",
514
- help="""
515
-
516
- For all 2D generated scatterplots, plot a
517
- linear regression line and the equation of
518
- the line to the legend. """ +
519
-
520
- self.graphs_applicable_doc([':class:`~sierra.core.graphs.summary_line_graph.SummaryLineGraph`']) +
521
- self.stage_usage_doc([4, 5]))
522
-
523
- self.multistage.add_argument("--plot-primary-axis",
524
- type=int,
525
- help="""
526
-
527
-
528
- This option allows you to override the
529
- primary axis, which is normally is computed
530
- based on the batch criteria.
531
-
532
- For example, in a bivariate batch criteria
533
- composed of
534
-
535
- - :ref:`ln-sierra-platform-argos-bc-population-size`
536
- on the X axis (rows)
537
-
538
- - Another batch criteria which does not
539
- affect system size (columns)
540
-
541
- Metrics will be calculated by `computing`
542
- across .csv rows and `projecting` down the
543
- columns by default, since system size will
544
- only vary within a row. Passing a value of 1
545
- to this option will override this
546
- calculation, which can be useful in
547
- bivariate batch criteria in which you are
548
- interested in the effect of the OTHER
549
- non-size criteria on various performance
550
- measures.
551
-
552
- 0=criteria of interest varies across `rows`.
553
-
554
- 1=criteria of interest varies across
555
- `columns`.
556
-
557
- This option only affects generating graphs
558
- from bivariate batch criteria.
559
-
560
- """
561
- +
562
- self.graphs_applicable_doc([':class:`~sierra.core.graphs.heatmap.Heatmap`',
563
- ':class:`~sierra.core.graphs.staced_line_graph.StackedLineGraph`']) +
564
- self.stage_usage_doc([4, 5]),
565
- default=None)
566
-
567
- self.multistage.add_argument("--plot-large-text",
568
- help="""
569
-
570
- This option specifies that the title, X/Y
571
- axis labels/tick labels should be larger
572
- than the SIERRA default. This is useful when
573
- generating graphs suitable for two column
574
- paper format where the default text size for
575
- rendered graphs will be too small to see
576
- easily. The SIERRA defaults are generally
577
- fine for the one column/journal paper
578
- format.
579
-
580
- """ + self.stage_usage_doc([4, 5]),
581
- action='store_true')
582
-
583
- self.multistage.add_argument("--plot-transpose-graphs",
584
- help="""
585
-
586
- Transpose the X, Y axes in generated
587
- graphs. Useful as a general way to tweak
588
- graphs for best use of space within a paper.
589
-
590
- .. versionchanged:: 1.2.20
591
-
592
- Renamed from ``--transpose-graphs`` to
593
- make its relation to other plotting
594
- options clearer.
595
-
596
- """ +
597
- self.graphs_applicable_doc([':class:`~sierra.core.graphs.heatmap.Heatmap`']) +
598
- self.stage_usage_doc([4, 5]),
599
- action='store_true')
494
+ self.multistage.add_argument(
495
+ "--expdef-template",
496
+ metavar="filepath",
497
+ help="""
498
+ The template ``.xml`` input file for the batch experiment.
499
+ Beyond the requirements for the specific ``--engine``, the
500
+ content of the file can be anything valid for the format, with
501
+ the exception of the SIERRA requirements detailed in
502
+ :ref:`plugins/expdef`.
503
+ """
504
+ + self.stage_usage_doc([1, 2, 3, 4]),
505
+ )
506
+
507
+ self.multistage.add_argument(
508
+ "--exp-overwrite",
509
+ help="""
510
+ When SIERRA calculates the batch experiment root (or any child
511
+ path in the batch experiment root) during stage {1, 2}, if the
512
+ calculated path already exists it is treated as a fatal error
513
+ and no modifications to the filesystem are performed. This
514
+ flag overwrides the default behavior. Provided to avoid
515
+ accidentally overwrite input/output files for an experiment,
516
+ forcing the user to be explicit with potentially dangerous
517
+ actions.
518
+ """
519
+ + self.stage_usage_doc([1, 2]),
520
+ action="store_true",
521
+ )
522
+
523
+ self.multistage.add_argument(
524
+ "--sierra-root",
525
+ metavar="dirpath",
526
+ help="""
527
+ Root directory for all SIERRA generated and created files.
528
+
529
+ Subdirectories for controllers, scenarios,
530
+ experiment/experimental run inputs/outputs will be created in
531
+ this directory as needed. Can persist between invocations of
532
+ SIERRA.
533
+ """
534
+ + self.stage_usage_doc([1, 2, 3, 4, 5]),
535
+ default="<home directory>/exp",
536
+ )
537
+
538
+ self.multistage.add_argument(
539
+ "--batch-criteria",
540
+ metavar="[<category>.<definition>,...]",
541
+ help="""
542
+ Definition of criteria(s) to use to define the experiment.
543
+
544
+ Specified as a list of 0 or 1 space separated strings, each
545
+ with the following general structure:
546
+
547
+ ``<category>.<definition>``
548
+
549
+ ``<category>`` must be a filename from the ``core/variables/``
550
+ or from a ``--project`` ``<project>/variables/`` directory, and
551
+ ``<definition>`` must be a parsable namne (according to the
552
+ requirements of the criteria defined by the parser for
553
+ ``<category>``).
554
+ """
555
+ + self.stage_usage_doc([1, 2, 3, 4, 5]),
556
+ nargs="+",
557
+ default=[],
558
+ )
559
+
560
+ self.multistage.add_argument(
561
+ "--pipeline",
562
+ help="""
563
+ Define which stages of the experimental pipeline to run:
564
+
565
+ - Stage1 - Generate the experiment definition from the
566
+ template input file, batch criteria, and other command
567
+ line options. Part of default pipeline.
568
+
569
+ - Stage2 - Run a previously generated experiment. Part of
570
+ default pipeline.
571
+
572
+ - Stage3 - Post-process experimental results after running
573
+ the batch experiment; some parts of this can be done in
574
+ parallel. Part of default pipeline.
575
+
576
+ - Stage4 - Perform deliverable/product generation after
577
+ processing results for a batch experiment, which can
578
+ include shiny graphs and videos. Part of default
579
+ pipeline.
580
+
581
+ - Stage5 - Compare generated products.
582
+ """,
583
+ type=int,
584
+ nargs="*",
585
+ default=[1, 2, 3, 4],
586
+ )
587
+ self.multistage.add_argument(
588
+ "--exp-range",
589
+ help="""
590
+ Set the experiment numbers from the batch to run, average,
591
+ generate intra-experiment graphs from, or generate
592
+ inter-experiment graphs from (0 based). Specified in the form
593
+ ``min_exp_num:max_exp_num`` (closed interval/inclusive). If
594
+ omitted, runs, averages, and generates intra-experiment and
595
+ inter-experiment performance measure graphs for all experiments
596
+ in the batch (default behavior).
597
+
598
+ This is useful to re-run part of a batch experiment in HPC
599
+ environments if SIERRA gets killed before it finishes running
600
+ all experiments in the batch, or to redo a single experiment
601
+ with real robots which failed for some reason.
602
+ """
603
+ + self.stage_usage_doc([2, 3, 4]),
604
+ )
605
+
606
+ self.multistage.add_argument(
607
+ "--engine-vc",
608
+ help="""
609
+ For applicable ``--engines``, enable visual capturing of
610
+ run-time data during stage 2. This data can be frames (i.e.,
611
+ .png files), or rendering videos, depending on the engine. If
612
+ the captured data was frames, then SIERRA can render the
613
+ captured frames into videos during stage 4. If the selected
614
+ ``--engine`` does not support visual capture, then this option
615
+ has no effect. See :ref:`plugins/prod/render` for more
616
+ details.
617
+ """
618
+ + self.stage_usage_doc([1, 4]),
619
+ action="store_true",
620
+ )
621
+
622
+ self.multistage.add_argument(
623
+ "--processing-parallelism",
624
+ type=int,
625
+ help="""
626
+ The level of parallelism to use in results processing/graph
627
+ generation producer-consumer queue. This value is used to
628
+ allocate consumers and produces in a 3:1 ratio. If you are
629
+ doing a LOT of processing, you may want to oversubscribe your
630
+ machine by passing a higher than default value to overcome
631
+ slowdown with high disk I/O.
632
+ """
633
+ + self.stage_usage_doc([3, 4]),
634
+ default=psutil.cpu_count(),
635
+ )
636
+ self.multistage.add_argument(
637
+ "--exec-parallelism-paradigm",
638
+ choices=["per-batch", "per-exp", "per-run", None],
639
+ default=None,
640
+ help="""
641
+ The level of parallelism to use when executing experiments in
642
+ stage 2. This should generall be set by
643
+ :py:func:`~sierra.core.experiment.bindings.IExpConfigurer.parallelism_paradigm()`
644
+ in your selected :term:`Engine`; this option is provided as an override.
645
+ """
646
+ + self.stage_usage_doc([1, 2]),
647
+ )
648
+
649
+ self.multistage.add_argument(
650
+ "--n-runs",
651
+ type=int,
652
+ default=1,
653
+ help="""
654
+ The # of experimental runs that will be executed and their
655
+ results processed to form the result of a single experiment
656
+ within a batch.
657
+
658
+ If ``--engine`` is a simulator and ``--execenv`` is something
659
+ other than ``hpc.local`` then this may be be used to determine
660
+ the concurrency of experimental runs.
661
+ """
662
+ + self.stage_usage_doc([1, 2]),
663
+ )
600
664
 
601
665
  def init_stage1(self) -> None:
602
666
  """
603
667
  Define cmdline arguments for stage 1.
604
668
  """
605
- self.stage1.add_argument("--preserve-seeds",
606
- help="""
607
-
608
- Preserve previously generated random seeds for
609
- experiments (the default). Useful for
610
- regenerating experiments when you change
611
- parameters/python code that don't affects
612
- experimental outputs (e.g.,
613
- paths). Preserving/overwriting random seeds is
614
- not affected by ``--exp-overwrite``.
615
-
616
- """,
617
- default=True)
618
-
619
- self.stage1.add_argument("--no-preserve-seeds",
620
- help="""
621
-
622
- Opposite of ``--preserve-seeds``.
623
-
624
- """,
625
- dest='preserve_seeds',
626
- action='store_false')
669
+ self.stage1.add_argument(
670
+ "--preserve-seeds",
671
+ help="""
672
+ Preserve previously generated random seeds for experiments (the
673
+ default). Useful for regenerating experiments when you change
674
+ parameters/python code that don't affects experimental outputs
675
+ (e.g., paths). Preserving/overwriting random seeds is not
676
+ affected by ``--exp-overwrite``.
677
+ """,
678
+ default=True,
679
+ )
680
+
681
+ self.stage1.add_argument(
682
+ "--no-preserve-seeds",
683
+ help="""
684
+ Opposite of ``--preserve-seeds``.
685
+ """,
686
+ dest="preserve_seeds",
687
+ action="store_false",
688
+ )
627
689
 
628
690
  def init_stage2(self) -> None:
629
691
  """
630
692
  Define cmdline arguments for stage 2.
631
693
  """
632
- self.stage2.add_argument("--nodefile",
633
- help="""
634
-
635
- Specify a list of compute nodes which SIERpRA
636
- will use to run jobs. For simulator
637
- :term:`Platforms <Platform>`, these are HPC
638
- resource nodes. For real robot platforms, these
639
- are robot hostnames/IP addresses. This
640
- information can also be supplied via the
641
- :envvar:`SIERRA_NODEFILE` environment
642
- variable; this argument takes priority if both
643
- are supplied.
644
-
645
- """)
694
+ self.stage2.add_argument(
695
+ "--nodefile",
696
+ help="""
697
+ Specify a list of compute nodes which SIERpRA will use to run
698
+ jobs. For simulator :term:`Engines <Engine>`, these are HPC
699
+ resource nodes. For real robot engines, these are robot
700
+ hostnames/IP addresses. This information can also be supplied
701
+ via the :envvar:`SIERRA_NODEFILE` environment variable; this
702
+ argument takes priority if both are supplied.
703
+ """,
704
+ )
646
705
 
647
706
  def init_stage3(self) -> None:
648
707
  """
649
708
  Define cmdline arguments for stage 3.
650
709
  """
651
-
652
- self.stage3.add_argument('--df-skip-verify',
653
- help="""
654
-
655
- SIERRA generally assumes/relies on all
656
- dataframes with the same name having the same #
657
- of columns which are of equivalent length
658
- across :term:`Experimental Runs <Experimental
659
- Run>` (different columns within a dataframe can
660
- of course have different lengths). This is
661
- strictly verified during stage 3 by default.
662
-
663
- If passed, then the verification step will be
664
- skipped during experimental results processing,
665
- and outputs will be averaged directly.
666
-
667
- If not all the corresponding CSV files in all
668
- experiments generated the same # rows, then
669
- SIERRA will (probably) crash during experiments
670
- exist and/or have the stage4. Verification can
671
- take a long time with large # of runs and/or
672
- dataframes per experiment.
673
-
674
- """ + self.stage_usage_doc([3]),
675
- action='store_true',
676
- default=False)
677
-
678
- self.stage3.add_argument("--storage-medium", choices=['storage.csv'],
679
- help="""
680
-
681
- Specify the storage medium for
682
- :term:`Experimental Run` outputs, so that
683
- SIERRA can select an appropriate plugin to read
684
- them. Any plugin under ``plugins/storage`` can
685
- be used, but the ones that come with SIERRA
686
- are:
687
-
688
- - ``storage.csv`` - Experimental run outputs
689
- are stored in a per-run directory as one or
690
- more CSV files.
691
-
692
-
693
- Regardless of the value of this option, SIERRA
694
- always generates CSV files as it runs and
695
- averages outputs, generates graphs, etc.
696
- """ + self.stage_usage_doc([3]),
697
- default='storage.csv')
698
-
699
- self.stage3.add_argument("--dist-stats",
700
- choices=['none', 'all', 'conf95', 'bw'],
701
- help="""
702
-
703
- Specify what kinds of statistics, if any,
704
- should be calculated on the distribution of
705
- experimental data during stage 3 for inclusion
706
- on graphs during stage 4:
707
-
708
- - ``none`` - Only calculate and show raw mean
709
- on graphs.
710
-
711
- - ``conf95`` - Calculate standard deviation of
712
- experimental distribution and show 95%%
713
- confidence interval on relevant graphs.
714
-
715
- - ``bw`` - Calculate statistics necessary to
716
- show box and whisker plots around each point
717
- in the graph. """ +
718
-
719
- utils.sphinx_ref(':class: `~sierra.core.graphs.summary_line_graph.SummaryLineGraph`') +
720
-
721
- """ only).
722
-
723
- - ``all`` - Generate all possible statistics,
724
- and plot all possible statistics on graphs.
725
- """
726
- +
727
- self.graphs_applicable_doc([':class:`~sierra.core.graphs.summary_line_graph.SummaryLineGraph`',
728
- ':class:`~sierra.core.graphs.stacked_line_graph.StackedLineGraph`'])
729
- + self.stage_usage_doc([3, 4]),
730
- default='none')
731
-
732
- self.stage3.add_argument("--processing-mem-limit",
733
- type=int,
734
- help="""
735
-
736
-
737
- Specify, as a percent in [0, 100], how much
738
- memory SIERRA should try to limit itself to
739
- using. This is useful on systems with limited
740
- memory, or on systems which are shared with
741
- other users without per-user memory
742
- restrictions.
743
-
744
- """ + self.stage_usage_doc([3, 4]),
745
- default=90)
746
-
747
- self.stage3.add_argument("--df-homogenize",
748
- help="""
749
-
750
- SIERRA generally assumes/relies on all
751
- dataframes with the same name having the same #
752
- of columns which are of equivalent length
753
- across: term: `Experimental Runs < Experimental
754
- Run >` (different columns within a dataframe
755
- can of course have different lengths). This is
756
- checked during stage 3 unless
757
- ``--df-skip-verify`` is passed. If strict
758
- verification is skipped, then SIERRA provides
759
- the following options when processing
760
- dataframes during stage {3, 4} to to homogenize
761
- them:
762
-
763
- - ``none`` - Don't do anything. This may or may
764
- not produce crashes during stage 4, depending
765
- on what you are doing.
766
-
767
- - ``pad`` - Project last valid value in columns
768
- which are too short down the column to make
769
- it match those which are longer.
770
-
771
- Note that this may result in invalid
772
- data/graphs if the filled columns are
773
- intervallic, interval average, or cumulative
774
- average data. If the data is a cumulative
775
- count of something, then this policy will
776
- have no ill effects.
777
-
778
- - ``zero`` - Same as ``pad``, but always fill
779
- with zeroes.
780
-
781
- Homogenization is performed just before writing
782
- dataframes to the specified storage
783
- medium. Useful with real robot experiments if
784
- the number of datapoints captured per-robot is
785
- slightly different, depending on when they
786
- started executing relative to when the
787
- experiment started.
788
-
789
- """,
790
- default='none')
710
+ self.stage3.add_argument(
711
+ "--df-verify",
712
+ help="""
713
+ SIERRA generally assumes/relies on all dataframes with the same
714
+ name having the same # of columns which are of equivalent
715
+ length across :term:`Experimental Runs <Experimental Run>`
716
+ (different columns within a dataframe can of course have
717
+ different lengths). However this is not checked by default.
718
+
719
+ If passed, then the verification step not be skipped, and will
720
+ be executed during experimental results processing, and outputs
721
+ will be averaged directly.
722
+
723
+ If not all the corresponding CSV files in all experiments
724
+ generated the same # rows, then SIERRA will (probably) crash
725
+ during experiments exist and/or have the stage4. Verification
726
+ can take a long time with large # of runs and/or dataframes per
727
+ experiment.
728
+ """
729
+ + self.stage_usage_doc([3]),
730
+ action="store_true",
731
+ default=False,
732
+ )
733
+
734
+ self.stage3.add_argument(
735
+ "--processing-mem-limit",
736
+ type=int,
737
+ help="""
738
+ Specify, as a percent in [0, 100], how much memory SIERRA
739
+ should try to limit itself to using. This is useful on systems
740
+ with limited memory, or on systems which are shared with other
741
+ users without per-user memory restrictions.
742
+ """
743
+ + self.stage_usage_doc([3, 4]),
744
+ default=90,
745
+ )
746
+
747
+ self.stage3.add_argument(
748
+ "--df-homogenize",
749
+ help="""
750
+ SIERRA generally assumes/relies on all dataframes with the same
751
+ name having the same # of columns which are of equivalent
752
+ length across: term: `Experimental Runs < Experimental Run >`
753
+ (different columns within a dataframe can of course have
754
+ different lengths). This not checked unless ``--df-verify`` is
755
+ passed. If strict verification is skipped, then SIERRA
756
+ provides the following options when processing dataframes
757
+ during stage {3, 4} to to homogenize them:
758
+
759
+ - ``none`` - Don't do anything. This may or may not
760
+ produce crashes during stage 4, depending on what you are
761
+ doing.
762
+
763
+ - ``pad`` - Project last valid value in columns which are
764
+ too short down the column to make it match those which
765
+ are longer.
766
+
767
+ Note that this may result in invalid data/graphs if the filled
768
+ columns are intervallic, interval average, or cumulative
769
+ average data. If the data is a cumulative count of something,
770
+ then this policy will have no ill effects.
771
+
772
+ - ``zero`` - Same as ``pad``, but always fill with zeroes.
773
+
774
+ Homogenization is performed just before writing dataframes to
775
+ the specified storage medium. Useful with real robot
776
+ experiments if the number of datapoints captured per-robot is
777
+ slightly different, depending on when they started executing
778
+ relative to when the experiment started.
779
+ """,
780
+ default="none",
781
+ )
791
782
 
792
783
  def init_stage4(self) -> None:
793
784
  """
794
785
  Define cmdline arguments for stage 4.
795
786
  """
796
- self.stage4.add_argument("--exp-graphs",
797
- choices=['intra', 'inter', 'all', 'none'],
798
- help="""
799
-
800
- Specify which types of graphs should be
801
- generated from experimental results:
802
-
803
- - ``intra`` - Generate intra-experiment graphs
804
- from the results of a single experiment
805
- within a batch, for each experiment in the
806
- batch(this can take a long time with large
807
- batch experiments). If any intra-experiment
808
- models are defined and enabled, those are run
809
- and the results placed on appropriate graphs.
810
-
811
- - ``inter`` - Generate inter-experiment graphs
812
- _across_ the results of all experiments in a
813
- batch. These are very fast to generate,
814
- regardless of batch experiment size. If any
815
- inter-experiment models are defined and
816
- enabled, those are run and the results placed
817
- on appropriate graphs.
818
-
819
- - ``all`` - Generate all types of graphs.
820
-
821
- - ``none`` - Skip graph generation; provided to
822
- skip graph generation if only video outputs
823
- are desired.
824
-
825
- """ + self.stage_usage_doc([4]),
826
- default='all')
827
-
828
- self.stage4.add_argument("--project-no-LN",
829
- help="""
830
-
831
- Specify that the intra-experiment and
832
- inter-experiment linegraphs defined in project
833
- YAML configuration should not be
834
- generated. Useful if you are working on
835
- something which results in the generation of
836
- other types of graphs, and the generation of
837
- those linegraphs is not currently needed only
838
- slows down your development cycle.
839
-
840
- Model linegraphs are still generated, if
841
- applicable.
842
-
843
- """,
844
- action='store_true')
845
-
846
- self.stage4.add_argument("--project-no-HM",
847
- help="""
848
-
849
- Specify that the intra-experiment heatmaps
850
- defined in project YAML configuration should
851
- not be generated. Useful if:
852
-
853
- - You are working on something which results in
854
- the generation of other types of graphs, and
855
- the generation of heatmaps only slows down
856
- your development cycle.
857
-
858
- - You are working on stage5 comparison graphs
859
- for bivariate batch criteria, and
860
- re-generating many heatmaps during stage4 is
861
- taking too long.
862
-
863
- Model heatmaps are still generated, if
864
- applicable.
865
-
866
- .. versionadded:: 1.2.20
867
-
868
- """,
869
- action='store_true')
870
-
871
- # Model options
872
- models = self.parser.add_argument_group('Models')
873
- models.add_argument('--models-enable',
874
- help="""
875
-
876
- Enable running of all models; otherwise, no models
877
- are run, even if they appear in the project config
878
- file. The logic behind having models disabled by
879
- default is that most users won't have them.
880
-
881
- """,
882
- action="store_true")
883
-
884
- # Rendering options
885
- rendering = self.parser.add_argument_group(
886
- 'Stage4: Rendering (see also stage1 rendering options)')
887
-
888
- rendering.add_argument("--render-cmd-opts",
889
- help="""
890
-
891
- Specify the: program: `ffmpeg` options to appear
892
- between the specification of the input image
893
- files and the specification of the output
894
- file. The default is suitable for use with ARGoS
895
- frame grabbing set to a frames size of 1600x1200
896
- to output a reasonable quality video.
897
-
898
- """ + self.stage_usage_doc([4]),
899
- default="-r 10 -s:v 800x600 -c:v libx264 -crf 25 -filter:v scale=-2:956 -pix_fmt yuv420p")
900
-
901
- rendering.add_argument("--project-imagizing",
902
- help="""
903
-
904
- Enable generation of image files from CSV files
905
- captured during stage 2 and averaged during stage
906
- 3 for each experiment. See
907
- :ref:`ln-sierra-usage-rendering-project` for
908
- details and restrictions.
909
-
910
- """ + self.stage_usage_doc([3, 4]),
911
- action='store_true')
912
-
913
- rendering.add_argument("--project-rendering",
914
- help="""
915
-
916
- Enable generation of videos from imagized CSV
917
- files created as a result of
918
- ``--project-imagizing``. See
919
- :ref:`ln-sierra-usage-rendering-project` for
920
- details.
921
-
922
- """ + self.stage_usage_doc([4]),
923
- action='store_true')
924
-
925
- rendering.add_argument("--bc-rendering",
926
- help="""
927
-
928
- Enable generation of videos from generated
929
- graphs, such as heatmaps. Bivariate batch
930
- criteria only.
931
-
932
- .. versionadded: 1.2.20
933
-
934
- """ + self.stage_usage_doc([4]),
935
- action='store_true')
936
787
 
937
788
  def init_stage5(self) -> None:
938
789
  """
939
790
  Define cmdline arguments for stage 5.
940
791
  """
941
- self.stage5.add_argument("--controllers-list",
942
- help="""
943
-
944
- Comma separated list of controllers to compare
945
- within ``--sierra-root``.
946
-
947
- The first controller in this list will be used
948
- for as the controller of primary interest if ``--comparison-type`` is passed.
949
-
950
- """ + self.stage_usage_doc([5]))
951
-
952
- self.stage5.add_argument("--controllers-legend",
953
- help="""
954
-
955
- Comma separated list of names to use on the
956
- legend for the generated comparison graphs,
957
- specified in the same order as the
958
- ``--controllers-list``.
959
-
960
- """ + self.stage_usage_doc([5],
961
- "If omitted: the raw controller names will be used."))
962
-
963
- self.stage5.add_argument("--scenarios-list",
964
- help="""
965
-
966
- Comma separated list of scenarios to compare
967
- ``--controller`` across within
968
- ``--sierra-root``.
969
-
970
- """ + self.stage_usage_doc([5]))
971
-
972
- self.stage5.add_argument("--scenarios-legend",
973
- help="""
974
-
975
- Comma separated list of names to use on the
976
- legend for the generated inter-scenario
977
- controller comparison graphs(if applicable),
978
- specified in the same order as the
979
- ``--scenarios-list``.
980
-
981
- """ + self.stage_usage_doc([5],
982
- "If omitted: the raw scenario names will be used."))
983
- self.stage5.add_argument("--scenario-comparison", help="""
984
-
985
- Perform a comparison of ``--controller`` across
986
- ``--scenarios-list`` (univariate batch criteria
987
- only). """
988
- + self.stage_usage_doc([5],
989
- """Either ``--scenario-comparison`` or ``--controller-comparison`` must be
990
- passed."""), action='store_true')
991
-
992
- self.stage5.add_argument("--controller-comparison",
993
- help="""
994
-
995
- Perform a comparison of ``--controllers-list``
996
- across all scenarios at least one controller
997
- has been run on. """ + self.stage_usage_doc([5],
998
- "Either ``--scenario-comparison`` or ``--controller-comparison`` must be passed."),
999
- action='store_true')
1000
-
1001
- self.stage5.add_argument("--comparison-type",
1002
- choices=['LNraw',
1003
- 'HMraw', 'HMdiff', 'HMscale',
1004
- 'SUraw', 'SUscale', 'SUdiff'],
1005
- help="""
1006
-
1007
- Specify how controller comparisons should be
1008
- performed.
1009
-
1010
- If the batch criteria is univariate, the
1011
- options are:
1012
-
1013
- - ``LNraw`` - Output raw 1D performance
1014
- measures using a single """ +
1015
-
1016
- utils.sphinx_ref(':class:`~sierra.core.graphs.summary_line_graph.SummaryLineGraph`') +
1017
-
1018
- """ for each measure, with all ``--controllers-list`` controllers shown on the
1019
- same graph.
1020
-
1021
- If the batch criteria is bivariate, the options
1022
- are:
1023
-
1024
- - ``LNraw`` - Output raw performance measures
1025
- as a set of """ +
1026
-
1027
- utils.sphinx_ref(':class:`~sierra.core.graphs.summary_line_graph.SummaryLineGraph`') +
1028
-
1029
- r"""s, where each
1030
- line graph is constructed from the i-th
1031
- row/column for the 2D dataframe for the
1032
- performance results for all controllers.
1033
-
1034
- .. NOTE:: SIERRA cannot currently plot
1035
- statistics on the linegraphs built from
1036
- slices of the 2D CSVs/heatmaps generated
1037
- during stage4, because statistics
1038
- generation is limited to stage3. This
1039
- limitation may be removed in a future
1040
- release.
1041
-
1042
- - ``HMraw`` - Output raw 2D performance
1043
- measures as a set of dual heatmaps comparing
1044
- all controllers against the controller of
1045
- primary interest(one per pair).
1046
-
1047
- - ``HMdiff`` - Subtract the performance measure
1048
- of the controller of primary interest against
1049
- all other controllers, pairwise, outputting
1050
- one 2D heatmap per comparison.
1051
-
1052
- - ``HMscale`` - Scale controller performance
1053
- measures against those of the controller of
1054
- primary interest by dividing, outputing one
1055
- 2D heatmap per comparison.
1056
-
1057
- - ``SUraw`` - Output raw 3D performance
1058
- measures as a single, stacked 3D surface
1059
- plots comparing all controllers(identical
1060
- plots, but viewed from different angles).
1061
-
1062
- - ``SUscale`` - Scale controller performance
1063
- measures against those of the controller of
1064
- primary interest by dividing. This results in
1065
- a single stacked 3D surface plots comparing
1066
- all controllers(identical plots, but viewed
1067
- from different angles).
1068
-
1069
- - ``SUdiff`` - Subtract the performance measure
1070
- of the controller of primary interest from
1071
- each controller(including the primary). This
1072
- results in a set single stacked 3D surface
1073
- plots comparing all controllers(identical
1074
- plots, but viewed from different angles), in
1075
- which the controller of primary interest
1076
- forms an(X, Y) plane at Z=0.
1077
-
1078
-
1079
- For all comparison types,
1080
- ``--controllers-legend`` is used if passed for
1081
- legend.
1082
-
1083
- """ + self.stage_usage_doc([5]))
1084
-
1085
- self.stage5.add_argument("--bc-univar",
1086
- help="""
1087
-
1088
- Specify that the batch criteria is
1089
- univariate. This cannot be deduced from the
1090
- command line ``--batch-criteria`` argument in
1091
- all cases because we are comparing controllers
1092
- `across` scenarios, and each scenario
1093
- (potentially) has a different batch criteria
1094
- definition, which will result in (potentially)
1095
- erroneous comparisons if we don't re-generate
1096
- the batch criteria for each scenaro we compare
1097
- controllers within.
1098
-
1099
- """ + self.stage_usage_doc([5]),
1100
- action='store_true')
1101
-
1102
- self.stage5.add_argument("--bc-bivar",
1103
- help="""
1104
-
1105
- Specify that the batch criteria is
1106
- bivariate. This cannot be deduced from the
1107
- command line ``--batch-criteria`` argument in
1108
- all cases because we are comparing controllers
1109
- `across` scenarios, and each
1110
- scenario(potentially) has a different batch
1111
- criteria definition, which will result in
1112
- (potentially) erroneous comparisons if we don't
1113
- re-generate the batch criteria for each scenaro
1114
- we compare controllers in .
1115
-
1116
- """ + self.stage_usage_doc([5]),
1117
- action='store_true')
1118
-
1119
-
1120
- class CoreCmdlineValidator():
1121
- """Validate the core command line arguments.
1122
-
1123
- This ensures that the pipeline will work properly in all stages, given the
1124
- options that were passed.
1125
-
1126
- """
1127
-
1128
- def __call__(self, args: argparse.Namespace) -> None:
1129
- self._check_bc(args)
1130
- self._check_pipeline(args)
1131
-
1132
- assert args.sierra_root is not None,\
1133
- '--sierra-root is required for all stages'
1134
-
1135
- def _check_bc(self, args: argparse.Namespace) -> None:
1136
- assert len(args.batch_criteria) <= 2,\
1137
- "Too many batch criteria passed"
1138
-
1139
- if len(args.batch_criteria) == 2:
1140
- assert args.batch_criteria[0] != args.batch_criteria[1], \
1141
- "Duplicate batch criteria passed"
1142
-
1143
- assert isinstance(args.batch_criteria, list), \
1144
- 'Batch criteria not passed as list on cmdline'
1145
-
1146
- def _check_pipeline(self, args: argparse.Namespace) -> None:
1147
- if any(stage in args.pipeline for stage in [1]) in args.pipeline:
1148
- assert args.n_runs is not None,\
1149
- '--n-runs is required for running stage 1'
1150
- assert args.template_input_file is not None,\
1151
- '--template-input-file is required for running stage 1'
1152
- assert args.scenario is not None, \
1153
- '--scenario is required for running stage 1'
1154
-
1155
- assert all(stage in [1, 2, 3, 4, 5] for stage in args.pipeline),\
1156
- 'Only 1-5 are valid pipeline stages'
1157
-
1158
- if any(stage in args.pipeline for stage in [1, 2, 3, 4]):
1159
- assert len(args.batch_criteria) > 0,\
1160
- '--batch-criteria is required for running stages 1-4'
1161
- assert args.controller is not None,\
1162
- '--controller is required for running stages 1-4'
1163
-
1164
- if 5 in args.pipeline:
1165
- assert args.bc_univar or args.bc_bivar, \
1166
- '--bc-univar or --bc-bivar is required for stage 5'
1167
- assert args.scenario_comparison or args.controller_comparison,\
1168
- '--scenario-comparison or --controller-comparison required for stage 5'
1169
- if args.scenario_comparison:
1170
- assert args.controller is not None,\
1171
- '--controller is required for --scenario-comparison'
1172
792
 
1173
793
 
1174
794
  def sphinx_cmdline_multistage():
1175
795
  return CoreCmdline([BootstrapCmdline().parser], [-1]).parser
1176
796
 
1177
797
 
798
+ def sphinx_cmdline_stage1():
799
+ return CoreCmdline([], [1]).parser
800
+
801
+
1178
802
  def sphinx_cmdline_stage3():
1179
- return CoreCmdline(None, [3]).parser
803
+ return CoreCmdline([], [3]).parser
1180
804
 
1181
805
 
1182
806
  def sphinx_cmdline_stage4():
1183
- return CoreCmdline(None, [4]).parser
807
+ return CoreCmdline([], [4]).parser
1184
808
 
1185
809
 
1186
810
  def sphinx_cmdline_stage5():
1187
- return CoreCmdline(None, [5]).parser
811
+ return CoreCmdline([], [5]).parser
1188
812
 
1189
813
 
1190
- __api__ = [
1191
- 'ArgumentParser',
1192
- 'BaseCmdline',
1193
- 'BootstrapCmdline',
1194
- 'CoreCmdline',
814
+ __all__ = [
815
+ "ArgumentParser",
816
+ "BaseCmdline",
817
+ "BootstrapCmdline",
818
+ "CoreCmdline",
1195
819
  ]