CQCL/pytket-docs

The telemetry module shouldn't write to config file on load

boschmitt opened this issue · 2 comments

When loading the telemetry module, t|ket> always write to the config file (telemetry/__init__.py):

def _on_module_load() -> None:
    [...]
    # assumes read_file can deal with old version of config on disc
    # and write out a valid new version
    config.write_file(pytket_config_file)
    [...]

This behaviour seems unecessary: If config.read_file can deal with old versions of config, then there should be no reason for it to rewrite the file. This behaviour is also troubling: When running different instances of t|ket> in parallel, this reading and writing obviously causes race conditions that break things from time to time.

Thank you, this was originally done to force overwrite some difficult to handle config files induced by an old version. As you say, that should no longer be a big problem, so we will move the config file write to happen only if there is no existing config file. This will be included in the next release, coming within the next week.

Released with pytket 0.11.0