11"""Run orchestration for CodeEntropy.
22
3- This module provides the RunManager , which is responsible for:
3+ This module provides the CodeEntropyRunner , which is responsible for:
44- Creating a new job folder for each run
55- Loading YAML configuration and merging it with CLI arguments
66- Setting up logging and displaying a Rich splash screen
77- Building the MDAnalysis Universe (including optional force merging)
8- - Wiring dependencies and executing the EntropyManager workflow
8+ - Wiring dependencies and executing the EntropyWorkflow workflow
99- Providing physical-constants helpers used by entropy calculations
1010
1111Notes on design:
12- - RunManager focuses on orchestration and simple utilities only.
13- - Computational logic lives in EntropyManager and the level/entropy DAG modules.
12+ - CodeEntropyRunner focuses on orchestration and simple utilities only.
13+ - Computational logic lives in EntropyWorkflow and the level/entropy DAG modules.
1414"""
1515
1616from __future__ import annotations
3232from rich .table import Table
3333from rich .text import Text
3434
35- from CodeEntropy .config .argparse import ConfigManager
35+ from CodeEntropy .config .argparse import ConfigResolver
3636from CodeEntropy .core .logging import LoggingConfig
37- from CodeEntropy .entropy .manager import EntropyManager
38- from CodeEntropy .levels .dihedrals import DihedralAnalysis
37+ from CodeEntropy .entropy .workflow import EntropyWorkflow
38+ from CodeEntropy .levels .dihedrals import ConformationStateBuilder
3939from CodeEntropy .levels .mda import UniverseOperations
40- from CodeEntropy .molecules .grouping import GroupMolecules
41- from CodeEntropy .results .reporter import DataLogger
40+ from CodeEntropy .molecules .grouping import MoleculeGrouper
41+ from CodeEntropy .results .reporter import ResultsReporter
4242
4343logger = logging .getLogger (__name__ )
4444console = LoggingConfig .get_console ()
4545
4646
47- class RunManager :
47+ class CodeEntropyRunner :
4848 """Coordinate setup and execution of entropy analysis runs.
4949
5050 Responsibilities:
5151 - Bootstrapping: job folder, logging, splash screen
5252 - Configuration: YAML loading + CLI parsing + merge and validation
5353 - Universe creation: MDAnalysis Universe (optionally merging forces)
54- - Dependency wiring and execution: EntropyManager
54+ - Dependency wiring and execution: EntropyWorkflow
5555 - Utilities used by downstream modules: constants and unit conversions
5656
5757 Attributes:
@@ -62,7 +62,7 @@ class RunManager:
6262 _DEF_TEMPER = 298
6363
6464 def __init__ (self , folder : str ) -> None :
65- """Initialize a RunManager for a given working folder.
65+ """Initialize a CodeEntropyRunner for a given working folder.
6666
6767 This sets up configuration helpers, data logging, and logging configuration.
6868 It also defines physical constants used in entropy calculations.
@@ -71,8 +71,8 @@ def __init__(self, folder: str) -> None:
7171 folder: Job folder path where logs and outputs will be written.
7272 """
7373 self .folder = folder
74- self ._config_manager = ConfigManager ()
75- self ._data_logger = DataLogger ()
74+ self ._config_manager = ConfigResolver ()
75+ self ._reporter = ResultsReporter ()
7676 self ._logging_config = LoggingConfig (folder )
7777
7878 @property
@@ -227,20 +227,20 @@ def run_entropy_workflow(self) -> None:
227227 - Merges args with YAML per-run config
228228 - Builds the MDAnalysis Universe (with optional force merging)
229229 - Validates user parameters
230- - Constructs dependencies and executes EntropyManager
230+ - Constructs dependencies and executes EntropyWorkflow
231231 - Saves recorded console output to a log file
232232
233233 Raises:
234234 Exception: Re-raises any exception after logging with traceback.
235235 """
236236 try :
237- run_logger = self ._logging_config .setup_logging ()
237+ run_logger = self ._logging_config .configure ()
238238 self .show_splash ()
239239
240240 current_directory = os .getcwd ()
241241 config = self ._config_manager .load_config (current_directory )
242242
243- parser = self ._config_manager .setup_argparse ()
243+ parser = self ._config_manager .build_parser ()
244244 args , _ = parser .parse_known_args ()
245245 args .output_file = os .path .join (self .folder , args .output_file )
246246
@@ -251,12 +251,12 @@ def run_entropy_workflow(self) -> None:
251251 )
252252 continue
253253
254- args = self ._config_manager .merge_configs (args , run_config )
254+ args = self ._config_manager .resolve (args , run_config )
255255
256256 log_level = (
257257 logging .DEBUG if getattr (args , "verbose" , False ) else logging .INFO
258258 )
259- self ._logging_config .update_logging_level (log_level )
259+ self ._logging_config .set_level (log_level )
260260
261261 command = " " .join (os .sys .argv )
262262 logging .getLogger ("commands" ).info (command )
@@ -268,28 +268,28 @@ def run_entropy_workflow(self) -> None:
268268 universe_operations = UniverseOperations ()
269269 u = self ._build_universe (args , universe_operations )
270270
271- self ._config_manager .input_parameters_validation (u , args )
271+ self ._config_manager .validate_inputs (u , args )
272272
273- group_molecules = GroupMolecules ()
274- dihedral_analysis = DihedralAnalysis (
273+ group_molecules = MoleculeGrouper ()
274+ dihedral_analysis = ConformationStateBuilder (
275275 universe_operations = universe_operations
276276 )
277277
278- entropy_manager = EntropyManager (
278+ entropy_manager = EntropyWorkflow (
279279 run_manager = self ,
280280 args = args ,
281281 universe = u ,
282- data_logger = self ._data_logger ,
282+ reporter = self ._reporter ,
283283 group_molecules = group_molecules ,
284284 dihedral_analysis = dihedral_analysis ,
285285 universe_operations = universe_operations ,
286286 )
287287 entropy_manager .execute ()
288288
289- self ._logging_config .save_console_log ()
289+ self ._logging_config .export_console ()
290290
291291 except Exception as e :
292- logger .error ("RunManager encountered an error: %s" , e , exc_info = True )
292+ logger .error ("CodeEntropyRunner encountered an error: %s" , e , exc_info = True )
293293 raise
294294
295295 @staticmethod
0 commit comments