diff --git a/midori/core.py b/midori/core.py index ca33619..34b83ce 100644 --- a/midori/core.py +++ b/midori/core.py @@ -93,6 +93,7 @@ def run(self) -> None: subject_path=self.__subject_path, treatment=treatment, previous_output=output, + repetitions=i, ) output = plugin.execute() @@ -107,6 +108,7 @@ def run(self) -> None: subject_path=self.__subject_path, treatment=treatment, previous_output=output, + repetitions=i, ) output = plugin.execute() diff --git a/midori/plugins/example_plugins.py b/midori/plugins/example_plugins.py index d40c62a..9c69f2e 100644 --- a/midori/plugins/example_plugins.py +++ b/midori/plugins/example_plugins.py @@ -11,7 +11,7 @@ def action(self) -> None: energy_collector: PodHelper = PodHelper( self._ssh, "prometheus-server", "default" ) - energy_node_save_path = f"~/research/results/{self.treatment}/energy.json" + energy_node_save_path = f"~/research/results/{self.treatment + '-' + str(self.repetitions)}/energy.json" energy_collector.execute_query_in_pod( node_saving_path=energy_node_save_path, query_cmd=energy_collector.construct_query_cmd(), @@ -20,6 +20,8 @@ def action(self) -> None: class LoadTestingDataCollection(PluginHelper): def action(self) -> None: - treatment_node_save_path = f"~/research/results/{self.treatment}" + treatment_node_save_path = ( + f"~/research/results/{self.treatment + '-' + str(self.repetitions)}" + ) pft: PodHelper = PodHelper(self._ssh, "loadgenerator", "default") pft.transfer_file_from_pod("/loadgen", treatment_node_save_path) diff --git a/midori/plugins/helpers.py b/midori/plugins/helpers.py index 40cacd6..c15727d 100644 --- a/midori/plugins/helpers.py +++ b/midori/plugins/helpers.py @@ -11,11 +11,13 @@ def __init__( subject_path: str, treatment: str, previous_output: Optional[str] = None, + repetitions: int = 0, ): self._ssh = ssh self.subject_path = subject_path self.previous_output = previous_output self.treatment = treatment + self.repetitions = repetitions @final def execute(self) -> Optional[str]: @@ -117,7 +119,9 @@ def construct_query_cmd( ) -> str: """Constructs the query command to be executed inside the pod.""" if end_time is None: - end_time = int(time.time()) + end_time = int( + time.time() + ) # the total trial timespan is 100s, to get the last 60 seconds if start_time is None: start_time = end_time - 60 return f"kubectl exec {self.pod} -- wget -qO- 'http://localhost:9090/api/v1/query_range?query=scaph_host_power_microwatts%20%2F%201000000&start={start_time}&end={end_time}&step=1'"