diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 1a210c1fa..8330f87c5 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -40,6 +40,12 @@ unreleased [2.x] has been replaced. Pass the parent as first argument instead. +1.0rc4 (unreleased) +------------------- + +* setattr_argument and setattr_device add their key to kernel_invariants. + + 1.0rc3 ------ diff --git a/artiq/language/environment.py b/artiq/language/environment.py index c765d5bfa..53b3fa38f 100644 --- a/artiq/language/environment.py +++ b/artiq/language/environment.py @@ -216,8 +216,12 @@ class HasEnvironment: def setattr_argument(self, key, processor=None, group=None): """Sets an argument as attribute. The names of the argument and of the - attribute are the same.""" + attribute are the same. + + The key is added to the instance's kernel invariants.""" setattr(self, key, self.get_argument(key, processor, group)) + kernel_invariants = getattr(self, "kernel_invariants", set()) + self.kernel_invariants = kernel_invariants | {key} def get_device_db(self): """Returns the full contents of the device database.""" @@ -229,8 +233,12 @@ class HasEnvironment: def setattr_device(self, key): """Sets a device driver as attribute. The names of the device driver - and of the attribute are the same.""" + and of the attribute are the same. + + The key is added to the instance's kernel invariants.""" setattr(self, key, self.get_device(key)) + kernel_invariants = getattr(self, "kernel_invariants", set()) + self.kernel_invariants = kernel_invariants | {key} def set_dataset(self, key, value, broadcast=False, persist=False, save=True): diff --git a/artiq/test/coredevice/test_rtio.py b/artiq/test/coredevice/test_rtio.py index 9c2823e69..07a1a78f1 100644 --- a/artiq/test/coredevice/test_rtio.py +++ b/artiq/test/coredevice/test_rtio.py @@ -83,8 +83,6 @@ class ClockGeneratorLoopback(EnvExperiment): class PulseRate(EnvExperiment): - kernel_invariants = {"core", "ttl_out"} - def build(self): self.setattr_device("core") self.setattr_device("ttl_out") @@ -107,8 +105,6 @@ class PulseRate(EnvExperiment): class PulseRateDDS(EnvExperiment): - kernel_invariants = {"core", "core_dds", "dds0", "dds1"} - def build(self): self.setattr_device("core") self.setattr_device("core_dds")