fix: avoids redefinition of core count in loop
All checks were successful
gitea-physics/deepdog/pipeline/head This commit looks good
gitea-physics/deepdog/pipeline/pr-master This commit looks good

This commit is contained in:
2023-04-13 20:21:17 -05:00
parent bf15f4a7b7
commit 1cf4454153
2 changed files with 8 additions and 6 deletions

View File

@@ -149,13 +149,14 @@ class TempAwareRealSpectrumRun:
results = []
_logger.debug("Going to iterate over models now")
core_count = multiprocessing.cpu_count() - 1 or 1
if (self.cap_core_count >= 1) and (self.cap_core_count < core_count):
core_count = self.cap_core_count
_logger.info(f"Using {core_count} cores")
for model_count, (model, model_name) in enumerate(
zip(self.models, self.model_names)
):
_logger.debug(f"Doing model #{model_count}: {model_name}")
core_count = multiprocessing.cpu_count() - 1 or 1
if (self.cap_core_count >= 1) and (self.cap_core_count < core_count):
core_count = self.cap_core_count
with multiprocessing.Pool(core_count) as pool:
cycle_count = 0
cycle_success = 0