Hi,
I have followed the tutorial on NDSPs. I have a working controller, tested with sipyco_rpctool
and with the custom client shown in the tutorial. I am missing how to incorporate it into device_db.py
and use it in a custom experiment. I have tried to add to device_db.py
the following lines
device_db.update({
"hello": {
"type": "controller",
"host": "::1", #localhost
"port": 3249,
"best_effort": False,
"command": "python //Users/Javier/ARTIQ/Javier/artiq-master/aqctl_hello.py "
}
})
and tried to run a custom test script
from artiq.experiment import *
class hello_test(EnvExperiment):
'Test script for hello controller'
def build(self):
self.setattr_device("hello")
def run(self):
self.hello.message("Hello, World!")
directly from the commandline using artiq_run hello_test.py
but I get these error messages
(artiq5) C:\Users\Javier\ARTIQ\Javier\artiq-master>artiq_run hello_test.py
Traceback (most recent call last):
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\site-packages\artiq\master\worker_db.py", line 88, in get
dev = _create_device(desc, self)
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\site-packages\artiq\master\worker_db.py", line 38, in _create_device
return cls(desc["host"], desc["port"], target_name)
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\site-packages\sipyco\pc_rpc.py", line 97, in __init__
self.__socket = socket.create_connection((host, port), timeout)
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\socket.py", line 712, in create_connection
raise err
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\socket.py", line 703, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No se puede establecer una conexión ya que el equipo de destino denegó expresamente dicha conexión
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Javier\anaconda3\envs\artiq5\Scripts\artiq_run-script.py", line 9, in <module>
sys.exit(main())
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\site-packages\artiq\frontend\artiq_run.py", line 225, in main
return run(with_file=True)
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\site-packages\artiq\frontend\artiq_run.py", line 211, in run
raise exn
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\site-packages\artiq\frontend\artiq_run.py", line 202, in run
exp_inst = _build_experiment(device_mgr, dataset_mgr, args)
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\site-packages\artiq\frontend\artiq_run.py", line 188, in _build_experiment
return get_experiment(module, args.class_name)(managers)
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\site-packages\artiq\language\environment.py", line 220, in __init__
self.build(*args, **kwargs)
File "hello_test.py", line 7, in build
self.setattr_device("hello")
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\site-packages\artiq\language\environment.py", line 304, in setattr_device
setattr(self, key, self.get_device(key))
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\site-packages\artiq\language\environment.py", line 297, in get_device
return self.__device_mgr.get(key)
File "C:\Users\Javier\anaconda3\envs\artiq5\lib\site-packages\artiq\master\worker_db.py", line 91, in get
.format(name)) from e
artiq.master.worker_db.DeviceError: Failed to create device 'hello'
I'm probably missing important details in the tutorial. I have read some advice I don't fully understand, such as
- The controller, which ... artiq.frontend.aqctl_XXX. A setup.py entry must also be created to install it.
- An optional client, which ... are front-end tools (called artiq.frontend.aqcli_XXX) that have setup.py entries.
...
tip: Defining the main function instead of putting its code directly in the if name == "main" body enables the controller to be used as well as a setuptools entry point.
I think setuptools is a python library for packaging Python projects (maybe ARTIQ is packaged using it) but I'm not sure if that is related to getting the hello
controller to work in an experiment. Is the controller entry in device_db.py
wrong? I cannot get more descriptive error messages, not even with artiq_master -v -v
and artiq_run -v -v
. Should I do something with some setup.py
file?
Thanks for any help