2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-29 05:03:34 +08:00

language/environment: disable processors by default

This commit is contained in:
Sebastien Bourdeauducq 2015-12-22 11:45:34 +08:00
parent a250b5da21
commit fc299ca918
2 changed files with 11 additions and 4 deletions

View File

@ -122,13 +122,14 @@ class HasEnvironment:
"""Provides methods to manage the environment of an experiment (devices,
parameters, results, arguments)."""
def __init__(self, device_mgr=None, dataset_mgr=None, *, parent=None,
default_arg_none=False, **kwargs):
default_arg_none=False, enable_processors=False, **kwargs):
self.requested_args = OrderedDict()
self.__device_mgr = device_mgr
self.__dataset_mgr = dataset_mgr
self.__parent = parent
self.__default_arg_none = default_arg_none
self.__enable_processors = enable_processors
self.__kwargs = kwargs
self.__in_build = True
@ -187,7 +188,10 @@ class HasEnvironment:
return None
else:
raise
return processor.process(argval)
if self.__enable_processors:
return processor.process(argval)
else:
return argval
def setattr_argument(self, key, processor=None, group=None):
"""Sets an argument as attribute. The names of the argument and of the

View File

@ -153,7 +153,9 @@ def examine(device_mgr, dataset_mgr, file):
name = exp_class.__doc__.splitlines()[0].strip()
if name[-1] == ".":
name = name[:-1]
exp_inst = exp_class(device_mgr, dataset_mgr, default_arg_none=True)
exp_inst = exp_class(device_mgr, dataset_mgr,
default_arg_none=True,
enable_processors=True)
arginfo = OrderedDict(
(k, (proc.describe(), group))
for k, (proc, group) in exp_inst.requested_args.items())
@ -199,7 +201,8 @@ def main():
exp = get_exp(experiment_file, expid["class_name"])
device_mgr.virtual_devices["scheduler"].set_run_info(
rid, obj["pipeline_name"], expid, obj["priority"])
exp_inst = exp(device_mgr, dataset_mgr,
exp_inst = exp(
device_mgr, dataset_mgr, enable_processors=True,
**expid["arguments"])
put_object({"action": "completed"})
elif action == "prepare":