forked from M-Labs/artiq
1
0
Fork 0

simple: refactor RPC client set_dataset

This commit is contained in:
Simon Renblad 2023-07-12 10:33:22 +08:00 committed by Sébastien Bourdeauducq
parent 16a3ce274f
commit d1f2727126
1 changed files with 9 additions and 2 deletions

View File

@ -49,8 +49,15 @@ class AppletControlRPC:
self.background_tasks.add(task) self.background_tasks.add(task)
task.add_done_callback(self.background_tasks.discard) task.add_done_callback(self.background_tasks.discard)
def set_dataset(self, key, value, persist=None): def set_dataset(self, key, value, unit=None, scale=None, precision=None, persist=None):
self._background(self.dataset_ctl.set, key, value, persist) metadata = {}
if unit is not None:
metadata["unit"] = unit
if scale is not None:
metadata["scale"] = scale
if precision is not None:
metadata["precision"] = precision
self._background(self.dataset_ctl.set, key, value, metadata=metadata, persist=persist)
def mutate_dataset(self, key, index, value): def mutate_dataset(self, key, index, value):
mod = {"action": "setitem", "path": [key, 1], "key": index, "value": value} mod = {"action": "setitem", "path": [key, 1], "key": index, "value": value}