Skip to content

Commit 7837642

Browse files
authored
Add files via upload
1 parent edf5292 commit 7837642

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

multioptpy/Wrapper/mapper.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,21 +2278,19 @@ def run(self) -> None:
22782278
# Re-validate at run() entry in case base_config was modified after __init__
22792279
self._validate_mapper_settings(self.base_config)
22802280

2281-
if self.resume and os.path.isfile(self.graph_json_path):
2282-
self.graph.load(self.graph_json_path)
2283-
self._iteration = self.graph.last_iteration
2284-
self._requeue_all_nodes()
2285-
else:
2286-
self._register_seed_structure()
2287-
2288-
# Copy config snapshot after directory creation (handled in __init__)
2289-
self._save_config_snapshot()
2290-
22912281
history_log = os.path.join(self.output_dir, "exploration_history.log")
22922282
priority_log = os.path.join(self.output_dir, "queue_priority.log")
22932283

2294-
# try/finally guarantees explored_log is flushed and closed
22952284
try:
2285+
if self.resume and os.path.isfile(self.graph_json_path):
2286+
self.graph.load(self.graph_json_path)
2287+
self._iteration = self.graph.last_iteration
2288+
self._requeue_all_nodes()
2289+
else:
2290+
self._register_seed_structure()
2291+
2292+
self._save_config_snapshot()
2293+
22962294
if self.n_parallel > 1:
22972295
self.queue.refresh_priorities(self.graph.reference_energy())
22982296
exhausted = self._run_parallel_rolling(history_log, priority_log)
@@ -2302,7 +2300,8 @@ def run(self) -> None:
23022300
self._run_sequential(history_log, priority_log)
23032301
finally:
23042302
self.graph.save(self.graph_json_path)
2305-
self.explored_log.close()
2303+
self.explored_log.close()
2304+
23062305

23072306
def _run_sequential(self, history_log: str, priority_log: str) -> None:
23082307
"""Sequential execution loop (n_parallel == 1).
@@ -2325,8 +2324,7 @@ def _run_sequential(self, history_log: str, priority_log: str) -> None:
23252324
still runs in a freshly spawned child process, so os.chdir() inside
23262325
_autots_worker cannot bleed across iterations.
23272326
"""
2328-
from concurrent.futures import BrokenProcessPool
2329-
2327+
23302328
def _make_executor() -> ProcessPoolExecutor:
23312329
return ProcessPoolExecutor(
23322330
max_workers=1,

0 commit comments

Comments
 (0)