Skip to content

setup_training_logger assumes every datastore exposes a private _config #709

Description

@sadamov

neural_lam/utils/logging.py:120 and :143 build the logger config with:

config=dict(training=vars(args), datastore=datastore._config)

_config is an MDP-specific private attribute, not part of the datastore interface, so any datastore that doesn't happen to carry one raises AttributeError the moment training starts:

AttributeError: 'DummyDatastore' object has no attribute '_config'. Did you mean: 'config'?

We already work around this in the test suite rather than fixing it: tests/test_cli.py:84, :112 and :145 each inject datastore._config = {} onto a mock before calling the training entry point.

The practical effect is that an in-memory datastore (e.g. tests/dummy_datastore.py::DummyDatastore) cannot be driven through the real training entry point without patching it first.

I suggest the minimal fix:

config=dict(training=vars(args), datastore=getattr(datastore, "_config", None))

Logging None for a datastore with no raw config file is fine. the cleaner option might be smth like a public accessor on the datastore interface, not sure...

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomershelp wantedExtra attention is neededmaintenanceRefactoring codebase, no new behaviour

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions