Skip to content

Commit

Permalink
Correct lynting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvmann authored Mar 26, 2024
1 parent 203748c commit 631f470
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/BenchmarkManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _create_store_dir(self, store_dir: str = None, tag: str = None) -> None:
f"{datetime.today().strftime('%Y-%m-%d-%H-%M-%S')}"
Path(self.store_dir).mkdir(parents=True, exist_ok=True)
self._set_logger()

def _resume_store_dir(self, store_dir) -> None:
self.store_dir = store_dir
self._set_logger()
Expand Down Expand Up @@ -177,7 +177,7 @@ def orchestrate_benchmark(self, benchmark_config_manager: ConfigManager, app_mod
self.interrupted_results_path = interrupted_results_path
if interrupted_results_path and not store_dir:
self._resume_store_dir(os.path.dirname(interrupted_results_path))
else:
else:
self._create_store_dir(store_dir, tag=benchmark_config_manager.get_config()["application"]["name"].lower())
benchmark_config_manager.save(self.store_dir)
benchmark_config_manager.load_config(app_modules)
Expand All @@ -196,7 +196,7 @@ def orchestrate_benchmark(self, benchmark_config_manager: ConfigManager, app_mod
results = self._collect_all_results()
self._save_as_json(results)

def run_benchmark(self, benchmark_backlog: list, repetitions: int):
def run_benchmark(self, benchmark_backlog: list, repetitions: int): # pylint: disable=R0915
"""
Goes through the benchmark backlog, which contains all the benchmarks to execute.
Expand Down Expand Up @@ -247,7 +247,8 @@ def run_benchmark(self, benchmark_backlog: list, repetitions: int):
git_revision_number, git_uncommitted_changes,
i, repetitions)
self.application.metrics.set_module_config(backlog_item["config"])
instruction, problem, preprocessing_time = preprocess(self.application, None, backlog_item["config"],
instruction, problem, preprocessing_time = preprocess(self.application, None,
backlog_item["config"],
store_dir=path, rep_count=i,
previous_job_info=job_info)
self.application.metrics.set_preprocessing_time(preprocessing_time)
Expand Down Expand Up @@ -331,13 +332,14 @@ def run_benchmark(self, benchmark_backlog: list, repetitions: int):
rel_path = Path(self.store_dir).relative_to(os.getcwd())
except ValueError:
rel_path = self.store_dir
logging.info(f"====== There are interrupted jobs. You may resume them by running QUARK with")
logging.info("====== There are interrupted jobs. You may resume them by running QUARK with")
logging.info(f"====== --resume-dir={rel_path}")
logging.info(80*"=")
logging.info("")


def traverse_config(self, module: dict, input_data: any, path: str, rep_count: int, previous_job_info: dict = None) -> (any, BenchmarkRecord):
def traverse_config(self, module: dict, input_data: any, path: str, rep_count: int, previous_job_info:
dict = None) -> (any, BenchmarkRecord):
"""
Executes a benchmark by traversing down the initialized config recursively until it reaches the end. Then
traverses up again. Once it reaches the root/application, a benchmark run is finished.
Expand All @@ -357,14 +359,14 @@ def traverse_config(self, module: dict, input_data: any, path: str, rep_count: i
# Only the value of the dict is needed (dict has only one key)
module = module[next(iter(module))]
module_instance: Core = module["instance"]

submodule_job_info = None
if previous_job_info and previous_job_info.get("submodule"):
assert module['name'] == previous_job_info["submodule"]["module_name"], \
f"asyncronous job info given, but no information about module {module['name']} stored in it" #TODO!!
if 'submodule' in previous_job_info and previous_job_info['submodule']:
submodule_job_info = previous_job_info['submodule']

module_instance.metrics.set_module_config(module["config"])
instruction, module_instance.preprocessed_input, preprocessing_time\
= preprocess(module_instance, input_data,
Expand All @@ -378,7 +380,6 @@ def traverse_config(self, module: dict, input_data: any, path: str, rep_count: i
benchmark_record = self.benchmark_record_template.copy()
postprocessing_time = 0.0
if instruction == Instruction.PROCEED:

# Check if end of the chain is reached
if not module["submodule"]:
# If we reach the end of the chain we create the benchmark record, fill it and then pass it up
Expand Down

0 comments on commit 631f470

Please sign in to comment.