runmanager is a graphical user interface (GUI) used to aid the compilation of labscript experiment scripts into hardware instructions to be executed on the hardware. Experiment parameters can be adjusted in the GUI, and lists of parameters can be used to create sequences of experiments, and scan over complex parameter spaces.
BSD 2-Clause "Simplified" License
0
stars
0
forks
source link
Batch compiler does not notice changes to unit conversions #28
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.
Original report (archived issue) by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).
Because
labscript
itself is whitelisted by theModuleWatcher
used inbatch_compiler.py
,labscript
and anything it imports do not get watched for changes and unloaded if they change.labscript
importslabscript_utils.unitconversions
, and sounitconversions
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 importunitconversions
.Users should probably import the
unitconversions
they need explicitly, at which point they will be handled as normal by theModuleWatcher
.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.