labscript-suite / runmanager

๐—ฟ๐˜‚๐—ป๐—บ๐—ฎ๐—ป๐—ฎ๐—ด๐—ฒ๐—ฟ is an intuitive graphical interface for controlling ๐˜ญ๐˜ข๐˜ฃ๐˜ด๐˜ค๐˜ณ๐˜ช๐˜ฑ๐˜ต ๐˜ด๐˜ถ๐˜ช๐˜ต๐˜ฆ experiments. Includes multi-dimensional parameter scans and a remote programming interface for automation.
http://labscriptsuite.org
Other
3 stars 45 forks source link

Batch compiler does not notice changes to unit conversions #28

Open philipstarkey opened 10 years ago

philipstarkey commented 10 years ago

Original report (archived issue) by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Because labscript itself is whitelisted by the ModuleWatcher used in batch_compiler.py, labscript and anything it imports do not get watched for changes and unloaded if they change.

labscript imports labscript_utils.unitconversions, and so unitconversions is whitelisted and not reloaded. This is a problem! Unit conversions change, and new ones are introduced! We were making new ones today and were absolutely perplexed that our labscript code could not import them, until we realised what the problem was.

Perhaps batch_compiler.py can remove unitconversions from the its ModuleWatcher's whitelist.

But a better solution would probably be to have labscript not import unitconversions.

Users should probably import the unitconversions they need explicitly, at which point they will be handled as normal by the ModuleWatcher.

It's true that some devices have default unit conversions they rely on, but these devices are not in labscript core, but rather in labscript_devices.

If a device in labscript core requires a unit conversions class, it should be imported explicitly so that only its module ends up on the whitelist.

To ensure all unit conversion modules don't get run whenever a single one is imported, the gathering of unit conversion classes (for BLACS to look them up by name for example) should be done on a function call, rather than an import. That way anyone can import a specific unit conversions class without worrying that unitconversions/__init__.py will go and import everyone else's code, and we won't accidentally white listthings for theModuleWatcher that we didn't realise we were importing.