How habibaaymannn/autocheck works
1. What this repository is
- AutoCheck is a Python-based checkpointing framework that wraps long-running training or HPC jobs and persists their state to the local filesystem.
- The core design goal is “zero code modification”: the training job keeps running, while AutoCheck observes it from the outside and saves/restores state.
2. Core runtime flow
- cli.py and the Controller module are the main runtime entry points for starting a checkpointing session.
- A controller/orchestrator coordinates three things: reading config, watching execution state, and invoking the checkpoint manager when a policy threshold is hit.
- The persistence target is a structured checkpoints/ tree with metadata files such as session_info.json.
3. Configuration subsystem
- config/ConfigManager.py loads YAML configuration from files like config.yaml, config_hpc*.yaml, config_nlp.yaml, config_sklearn.yaml, and config_torch.yaml.
- config/YamlOBJ/* contains typed config objects for different concerns: checkpoint settings, HPC settings/state, ML settings, notifications, and system-level options.
- This is the main boundary where policy is defined: intervals, session limits, framework choice, storage paths, and environment-specific settings.
4. Checkpoint management subsystem
- checkpointManager/CheckpointManager.py and GenericCheckpointManager.py define the abstract save/load contract.
- Framework-specific implementations exist for:
- KerasCheckpointManager.py
- PyTorchCheckpointManager.py
- SKLearnCheckpointManager.py
- serializers.py suggests the framework-agnostic portion is delegated to serializers for model state and metadata packaging.
5. State tracking subsystem
- stateTracker/ holds the live execution state used by the controller.
- HPCStateTracker.py and MLStateTracker.py separate job-level state from ML-training state.
- The tracked state likely includes progress markers such as epoch, batch, timing, loss/accuracy, and job/session status, which the controller uses to decide when to checkpoint.
6. Execution layers / instrumentation boundaries
- layers/ contains the abstraction for interacting with different execution environments.
- BaseLayer.py, BaseDebuggerLayer.py, TraceLayer.py, and SignalLayer.py indicate generic monitoring and interruption handling.
- CLayer.py, CppLayer.py, and JavaLayer.py show explicit support for native/HPC-style jobs in addition to Python workflows.
- Architecturally, this is the compatibility layer between AutoCheck and the job being monitored.
7. Provider and runner coordination
- provider/Provider.py likely acts as the access point for shared runtime services or environment-specific wiring.
- runnerscript/RunnerScript.py is the bridge between user code and the checkpointing runtime, matching the README’s “run the training loop normally, but let AutoCheck orchestrate around it” model.
- In the architecture diagram, this is the component that calls into the model/training loop while feeding state updates to the tracker.
8. Notifications, logging, and error handling
- notifications/NotificationService.py suggests optional user-facing alerts around checkpoint events, failures, or termination.
- Utilites/logger.py, Utilites/error.py, and Utilites/enums.py provide shared logging, exception, and enum definitions used across the system.
- The presence of per-component log files in Testing_phase/keras_testing_done_on/logs/ shows observability is part of the design, not just training logic.
9. Framework validation and experimental harness
- Testing_phase/ is a large validation sandbox covering multiple domains:
- TensorFlow/Keras (keras_testing_done_on/)
- PyTorch (pytorch_testing_done_on/)
- scikit-learn (sklearn_testing_done_on/)
- classic ML and regression models (SVM.py, SVR.py, Kmeans.py, logisticReg.py, etc.)
- HPC jobs in Java, C, and C++ (HPCJob.java, train_sim.c, traim_sim_cpp.cpp)
- This folder is best understood as a test/integration lab proving that the checkpointing architecture can span frameworks and languages.
10. Persistence model and artifacts
- Checkpoints are stored as versioned directories/files under checkpoints/, test_checkpoints/, and framework-specific subtrees.
- The saved state includes model weights or serialized models plus metadata/session info; examples include TensorFlow weight shards, PyTorch/Torch-style artifacts, and scikit-learn .joblib models.
- There is no database or remote storage layer in the repo; the storage boundary is the filesystem.
11. Packaging and generated outputs
- dist/ contains packaged artifacts and copied runtime assets, including a built AutoCheck.exe and model/checkpoint bundles.
- These are build outputs rather than source architecture, but they confirm the project is intended to be distributable and runnable outside the source tree.
12. What to draw as the main architecture boundaries
- Draw a clear separation between:
- configuration ingestion
- runtime orchestration
- state tracking
- framework/language adaptation layers
- checkpoint serialization/persistence
- logging/notification side services
- The central flow is: config → controller/runner → state tracker + layers → checkpoint manager → filesystem checkpoints, with notifications/logging as side channels and testing_phase as validation inputs.
Main entry points: Controller.py Controller · Testing_phase Testing Phase · BaseLayer.py Base Layer · CheckpointManager.py Checkpoint Manager
Components 25
Runtime
Entry points, orchestration, and execution bridge
- CLI · Starts a checkpointing session from the command line
cli.py - Controller · Coordinates config, state tracking, and checkpoint decisions
AtonomusController/Controller.py - Runner · Bridge between user code and the AutoCheck runtime
runnerscript/RunnerScript.py
Config
YAML policy and typed settings
- Config Manager · Loads session and framework configuration
config/ConfigManager.py - Config Objects · Structured YAML-backed settings objects
config/YamlOBJ/YamlObj.py
State
Live job and training state
- Base Tracker · Common execution-state interface
stateTracker/BaseTracker.py - HPC Tracker · Tracks non-ML or job-level execution state
stateTracker/HPCStateTracker.py - ML Tracker · Tracks training progress and metrics
stateTracker/MLStateTracker.py
Checkpointing
Save/load managers and serialization
- Checkpoint Manager · Abstract save/load contract
checkpointManager/CheckpointManager.py - Generic Manager · Shared checkpointing behavior and policy
checkpointManager/GenericCheckpointManager.py - Keras Manager · Checkpoint implementation for TensorFlow/Keras
checkpointManager/KerasCheckpointManager.py - PyTorch Manager · Checkpoint implementation for PyTorch
checkpointManager/PyTorchCheckpointManager.py - Sklearn Manager · Checkpoint implementation for scikit-learn
checkpointManager/SKLearnCheckpointManager.py - Serializers · Serializes model state and checkpoint metadata
checkpointManager/serializers.py
Layers
Execution adapters and interruption hooks
- Base Layer · Common layer abstraction for monitored execution
layers/BaseLayer.py - Trace Layer · Observes execution flow and state changes
layers/TraceLayer.py - Signal Layer · Handles stop and checkpoint trigger signals
layers/SignalLayer.py - C Layer · Execution adapter for C workloads
layers/CLayer.py - C++ Layer · Execution adapter for C++ workloads
layers/CppLayer.py - Java Layer · Execution adapter for Java workloads
layers/JavaLayer.py
Support
Provider, notifications, and utilities
Validation
Integration sandbox and packaged outputs
- Testing Phase · Cross-framework validation sandbox for checkpointing
Testing_phase
Storage
Filesystem checkpoint artifacts
- Checkpoints · Versioned checkpoint directories and session metadata
checkpoints
Connections 30
- CLI → Config Manager: loads config · CLI bootstraps session settings
- CLI → Controller: starts session · CLI hands control to the orchestrator
- Config Manager → Config Objects: parses into · YAML is mapped into typed config objects
- Config Manager → Controller: provides policy · Controller uses loaded checkpoint and runtime policy
- Controller → Runner: drives · Orchestrates the monitored execution loop
- Runner → Provider: requests services · Runner obtains runtime wiring and environment access
- Runner → Base Layer: attaches · Runner operates through execution layers
- Base Layer → Trace Layer: specializes · Tracing is one of the main monitoring paths
- Base Layer → Signal Layer: specializes · Signal handling is one of the main monitoring paths
- Base Layer → C Layer: specializes · Native C jobs use dedicated adapters
- Base Layer → C++ Layer: specializes · Native C++ jobs use dedicated adapters
- Base Layer → Java Layer: specializes · Java jobs use dedicated adapters
- Controller → Base Tracker: updates state · Controller consults the live execution state
- Base Tracker → HPC Tracker: specializes · HPC state is tracked separately
- Base Tracker → ML Tracker: specializes · ML training state is tracked separately
- Controller → Checkpoint Manager: triggers checkpoint · Policy thresholds invoke checkpoint save/load
- Checkpoint Manager → Generic Manager: implements · Concrete managers share common checkpoint behavior
- Generic Manager → Keras Manager: specializes · Keras/TensorFlow checkpointing path
- Generic Manager → PyTorch Manager: specializes · PyTorch checkpointing path
- Generic Manager → Sklearn Manager: specializes · scikit-learn checkpointing path
- Checkpoint Manager → Serializers: packages state · Framework state and metadata are serialized together
- Checkpoint Manager → Checkpoints: writes to · Checkpoints are persisted on the local filesystem
- Controller → Notifier: publishes events · Checkpoint and failure events can be reported
- Controller → Utilities: uses helpers · Logging and shared error handling support runtime flow
- Testing Phase → Keras Manager: validates · Keras validation artifacts exercise checkpointing
- Testing Phase → PyTorch Manager: validates · PyTorch validation artifacts exercise checkpointing
- Testing Phase → Sklearn Manager: validates · Sklearn validation artifacts exercise checkpointing
- Testing Phase → C Layer: validates · C integration examples exercise native adapters
- Testing Phase → C++ Layer: validates · C++ integration examples exercise native adapters
- Testing Phase → Java Layer: validates · Java integration examples exercise native adapters