forked from M-Labs/artiq
1
0
Fork 0

make set_dataset and mutate_dataset async RPCs

This commit is contained in:
Sebastien Bourdeauducq 2016-11-01 11:11:22 +08:00
parent 18ae8d54a3
commit 43cd970100
1 changed files with 3 additions and 0 deletions

View File

@ -3,6 +3,7 @@ from inspect import isclass
from artiq.protocols import pyon from artiq.protocols import pyon
from artiq.language import units from artiq.language import units
from artiq.language.core import rpc
__all__ = ["NoDefault", __all__ = ["NoDefault",
@ -274,6 +275,7 @@ class HasEnvironment:
kernel_invariants = getattr(self, "kernel_invariants", set()) kernel_invariants = getattr(self, "kernel_invariants", set())
self.kernel_invariants = kernel_invariants | {key} self.kernel_invariants = kernel_invariants | {key}
@rpc(flags={"async"})
def set_dataset(self, key, value, def set_dataset(self, key, value,
broadcast=False, persist=False, save=True): broadcast=False, persist=False, save=True):
"""Sets the contents and handling modes of a dataset. """Sets the contents and handling modes of a dataset.
@ -290,6 +292,7 @@ class HasEnvironment:
""" """
self.__dataset_mgr.set(key, value, broadcast, persist, save) self.__dataset_mgr.set(key, value, broadcast, persist, save)
@rpc(flags={"async"})
def mutate_dataset(self, key, index, value): def mutate_dataset(self, key, index, value):
"""Mutate an existing dataset at the given index (e.g. set a value at """Mutate an existing dataset at the given index (e.g. set a value at
a given position in a NumPy array) a given position in a NumPy array)