Use commandline prefix for controllers

This keeps them better organized and consistent with the artiq_* naming scheme.
Tab completion from aqctl_ also lists all the controllers installed on a machine.
This commit is contained in:
Sebastien Bourdeauducq 2017-05-22 00:22:10 +08:00
parent c83e15d040
commit 3ed70afaa1
14 changed files with 40 additions and 37 deletions

View File

@ -35,6 +35,7 @@ Release notes
an existing database, add ``device_db = `` at the beginning, and replace any PYON an existing database, add ``device_db = `` at the beginning, and replace any PYON
identifiers (``true``, ``null``, ...) with their Python equivalents identifiers (``true``, ``null``, ...) with their Python equivalents
(``True``, ``None` ...). (``True``, ``None` ...).
* Controllers are now named ``aqctl_XXX`` instead of ``XXX_controller``.
2.3 2.3

View File

@ -170,25 +170,25 @@ device_db = {
# that it always resolves to a network-visible IP address (see documentation). # that it always resolves to a network-visible IP address (see documentation).
"host": "::1", "host": "::1",
"port": 4000, "port": 4000,
"command": "pdq2_controller -p {port} --bind {bind} --simulation --dump qc_q1_0.bin" "command": "aqctl_pdq2 -p {port} --bind {bind} --simulation --dump qc_q1_0.bin"
}, },
"qc_q1_1": { "qc_q1_1": {
"type": "controller", "type": "controller",
"host": "::1", "host": "::1",
"port": 4001, "port": 4001,
"command": "pdq2_controller -p {port} --bind {bind} --simulation --dump qc_q1_1.bin" "command": "aqctl_pdq2 -p {port} --bind {bind} --simulation --dump qc_q1_1.bin"
}, },
"qc_q1_2": { "qc_q1_2": {
"type": "controller", "type": "controller",
"host": "::1", "host": "::1",
"port": 4002, "port": 4002,
"command": "pdq2_controller -p {port} --bind {bind} --simulation --dump qc_q1_2.bin" "command": "aqctl_pdq2 -p {port} --bind {bind} --simulation --dump qc_q1_2.bin"
}, },
"qc_q1_3": { "qc_q1_3": {
"type": "controller", "type": "controller",
"host": "::1", "host": "::1",
"port": 4003, "port": 4003,
"command": "pdq2_controller -p {port} --bind {bind} --simulation --dump qc_q1_3.bin" "command": "aqctl_pdq2 -p {port} --bind {bind} --simulation --dump qc_q1_3.bin"
}, },
"electrodes": { "electrodes": {
"type": "local", "type": "local",
@ -206,7 +206,7 @@ device_db = {
"best_effort": True, "best_effort": True,
"host": "::1", "host": "::1",
"port": 3253, "port": 3253,
"command": "lda_controller -p {port} --bind {bind} --simulation" "command": "aqctl_lda -p {port} --bind {bind} --simulation"
}, },
"camera_sim": { "camera_sim": {

View File

@ -27,7 +27,7 @@ class TestKoradKA3005P(GenericKoradKA3005PTest, GenericControllerCase):
"host": "::1", "host": "::1",
"port": 3256, "port": 3256,
"command": (sys.executable.replace("\\", "\\\\") "command": (sys.executable.replace("\\", "\\\\")
+ " -m artiq.frontend.korad_ka3005p_controller " + " -m artiq.frontend.aqctl_korad_ka3005p "
+ "-p {port} --simulation") + "-p {port} --simulation")
} }
} }

View File

@ -35,7 +35,7 @@ class TestNovatech409BSim(GenericNovatech409BTest, GenericControllerCase):
"host": "::1", "host": "::1",
"port": 3254, "port": 3254,
"command": (sys.executable.replace("\\", "\\\\") "command": (sys.executable.replace("\\", "\\\\")
+ " -m artiq.frontend.novatech409b_controller " + " -m artiq.frontend.aqctl_novatech409b "
+ "-p {port} --simulation") + "-p {port} --simulation")
} }
} }

View File

@ -146,7 +146,7 @@ class TestTdcSim(GenericControllerCase, GenericTdcTest):
"host": "::1", "host": "::1",
"port": 3255, "port": 3255,
"command": (sys.executable.replace("\\", "\\\\") "command": (sys.executable.replace("\\", "\\\\")
+ " -m artiq.frontend.thorlabs_tcube_controller " + " -m artiq.frontend.aqctl_thorlabs_tcube "
+ "-p {port} -P tdc001 --simulation") + "-p {port} -P tdc001 --simulation")
} }
} }
@ -172,7 +172,7 @@ class TestTpzSim(GenericControllerCase, GenericTpzTest):
"host": "::1", "host": "::1",
"port": 3255, "port": 3255,
"command": (sys.executable.replace("\\", "\\\\") "command": (sys.executable.replace("\\", "\\\\")
+ " -m artiq.frontend.thorlabs_tcube_controller " + " -m artiq.frontend.aqctl_thorlabs_tcube "
+ "-p {port} -P tpz001 --simulation") + "-p {port} -P tpz001 --simulation")
} }
} }

View File

@ -14,8 +14,8 @@ Certain devices (such as the PDQ2) may still perform real-time operations by hav
A network device support package (NDSP) is composed of several parts: A network device support package (NDSP) is composed of several parts:
1. The `driver`, which contains the Python API functions to be called over the network, and performs the I/O to the device. The top-level module of the driver is called ``artiq.devices.XXX.driver``. 1. The `driver`, which contains the Python API functions to be called over the network, and performs the I/O to the device. The top-level module of the driver is called ``artiq.devices.XXX.driver``.
2. The `controller`, which instantiates, initializes and terminates the driver, and sets up the RPC server. The controller is a front-end command-line tool to the user and is called ``artiq.frontend.XXX_controller``. A ``setup.py`` entry must also be created to install it. 2. The `controller`, which instantiates, initializes and terminates the driver, and sets up the RPC server. The controller is a front-end command-line tool to the user and is called ``artiq.frontend.aqctl_XXX``. A ``setup.py`` entry must also be created to install it.
3. An optional `client`, which connects to the controller and exposes the functions of the driver as a command-line interface. Clients are front-end tools (called ``artiq.frontend.XXX_client``) that have ``setup.py`` entries. In most cases, a custom client is not needed and the generic ``artiq_rpctool`` utility can be used instead. Custom clients are only required when large amounts of data must be transferred over the network API, that would be unwieldy to pass as ``artiq_rpctool`` command-line parameters. 3. An optional `client`, which connects to the controller and exposes the functions of the driver as a command-line interface. Clients are front-end tools (called ``artiq.frontend.aqcli_XXX``) that have ``setup.py`` entries. In most cases, a custom client is not needed and the generic ``artiq_rpctool`` utility can be used instead. Custom clients are only required when large amounts of data must be transferred over the network API, that would be unwieldy to pass as ``artiq_rpctool`` command-line parameters.
4. An optional `mediator`, which is code executed on the client that supplements the network API. A mediator may contain kernels that control real-time signals such as TTL lines connected to the device. Simple devices use the network API directly and do not have a mediator. Mediator modules are called ``artiq.devices.XXX.mediator`` and their public classes are exported at the ``artiq.devices.XXX`` level (via ``__init__.py``) for direct import and use by the experiments. 4. An optional `mediator`, which is code executed on the client that supplements the network API. A mediator may contain kernels that control real-time signals such as TTL lines connected to the device. Simple devices use the network API directly and do not have a mediator. Mediator modules are called ``artiq.devices.XXX.mediator`` and their public classes are exported at the ``artiq.devices.XXX`` level (via ``__init__.py``) for direct import and use by the experiments.
The driver and controller The driver and controller
@ -51,13 +51,13 @@ The parameters ``::1`` and ``3249`` are respectively the address to bind the ser
#!/usr/bin/env python3 #!/usr/bin/env python3
at the beginning of the file, save it to ``hello_controller.py`` and set its execution permissions: :: at the beginning of the file, save it to ``aqctl_hello.py`` and set its execution permissions: ::
$ chmod 755 hello_controller.py $ chmod 755 aqctl_hello.py
Run it as: :: Run it as: ::
$ ./hello_controller.py $ ./aqctl_hello.py
and verify that you can connect to the TCP port: :: and verify that you can connect to the TCP port: ::
@ -81,7 +81,7 @@ Clients are small command-line utilities that expose certain functionalities of
$ artiq_rpctool ::1 3249 list-methods $ artiq_rpctool ::1 3249 list-methods
$ artiq_rpctool ::1 3249 call message test $ artiq_rpctool ::1 3249 call message test
In case you are developing a NDSP that is complex enough to need a custom client, we will see how to develop one. Create a ``hello_client.py`` file with the following contents: :: In case you are developing a NDSP that is complex enough to need a custom client, we will see how to develop one. Create a ``aqcli_hello.py`` file with the following contents: ::
#!/usr/bin/env python3 #!/usr/bin/env python3
@ -100,7 +100,7 @@ In case you are developing a NDSP that is complex enough to need a custom client
Run it as before, while the controller is running. You should see the message appearing on the controller's terminal: :: Run it as before, while the controller is running. You should see the message appearing on the controller's terminal: ::
$ ./hello_controller.py $ ./aqctl_hello.py
message: Hello World! message: Hello World!
When using the driver in an experiment, the ``Client`` instance can be returned by the environment mechanism (via the ``get_device`` and ``attr_device`` methods of :class:`artiq.language.environment.HasEnvironment`) and used normally as a device. When using the driver in an experiment, the ``Client`` instance can be returned by the environment mechanism (via the ``get_device`` and ``attr_device`` methods of :class:`artiq.language.environment.HasEnvironment`) and used normally as a device.

View File

@ -21,15 +21,15 @@ Controller
++++++++++ ++++++++++
.. argparse:: .. argparse::
:ref: artiq.frontend.pdq2_controller.get_argparser :ref: artiq.frontend.aqctl_pdq2.get_argparser
:prog: pdq2_controller :prog: aqctl_pdq2
Client Client
++++++ ++++++
.. argparse:: .. argparse::
:ref: artiq.frontend.pdq2_client.get_argparser :ref: artiq.frontend.aqcli_pdq2.get_argparser
:prog: pdq2_client :prog: aqcli_pdq2
Lab Brick Digital Attenuator (LDA) Lab Brick Digital Attenuator (LDA)
---------------------------------- ----------------------------------
@ -58,7 +58,7 @@ You must also unplug/replug your device if it was already plugged in.
Then, to run the Lab Brick Digital Attenuator (LDA) controller:: Then, to run the Lab Brick Digital Attenuator (LDA) controller::
$ lda_controller -d SN:xxxxx $ aqctl_lda -d SN:xxxxx
The serial number must contain exactly 5 digits, prepend it with the necessary number of 0s. The serial number must contain exactly 5 digits, prepend it with the necessary number of 0s.
Also, the ``SN:`` prefix is mandatory. Also, the ``SN:`` prefix is mandatory.
@ -66,8 +66,8 @@ Also, the ``SN:`` prefix is mandatory.
You can choose the LDA model with the ``-P`` parameter. The default is LDA-102. You can choose the LDA model with the ``-P`` parameter. The default is LDA-102.
.. argparse:: .. argparse::
:ref: artiq.frontend.lda_controller.get_argparser :ref: artiq.frontend.aqctl_lda.get_argparser
:prog: lda_controller :prog: aqctl_lda
Korad KA3005P Korad KA3005P
------------- -------------
@ -82,8 +82,8 @@ Controller
++++++++++ ++++++++++
.. argparse:: .. argparse::
:ref: artiq.frontend.korad_ka3005p_controller.get_argparser :ref: artiq.frontend.aqctl_korad_ka3005p.get_argparser
:prog: korad_ka3005p_controller :prog: aqctl_korad_ka3005p
Novatech 409B Novatech 409B
------------- -------------
@ -98,8 +98,8 @@ Controller
++++++++++ ++++++++++
.. argparse:: .. argparse::
:ref: artiq.frontend.novatech409b_controller.get_argparser :ref: artiq.frontend.aqctl_novatech409b.get_argparser
:prog: novatech409b_controller :prog: aqctl_novatech409b
Thorlabs T-Cube Thorlabs T-Cube
--------------- ---------------
@ -123,8 +123,8 @@ Controller
++++++++++ ++++++++++
.. argparse:: .. argparse::
:ref: artiq.frontend.thorlabs_tcube_controller.get_argparser :ref: artiq.frontend.aqctl_thorlabs_tcube.get_argparser
:prog: thorlabs_controller :prog: aqctl_thorlabs
.. _tdc001-controller-usage-example: .. _tdc001-controller-usage-example:
@ -133,7 +133,7 @@ TDC001 controller usage example
First, run the TDC001 controller:: First, run the TDC001 controller::
$ thorlabs_tcube_controller -P TDC001 -d /dev/ttyUSBx $ aqctl_thorlabs_tcube -P TDC001 -d /dev/ttyUSBx
.. note:: .. note::
On Windows the serial port (the ``-d`` argument) will be of the form ``COMx``. On Windows the serial port (the ``-d`` argument) will be of the form ``COMx``.
@ -166,7 +166,7 @@ TPZ001 controller usage example
First, run the TPZ001 controller:: First, run the TPZ001 controller::
$ thorlabs_tcube_controller -P TPZ001 -d /dev/ttyUSBx $ aqctl_thorlabs_tcube -P TPZ001 -d /dev/ttyUSBx
.. note:: .. note::
On Windows the serial port (the ``-d`` argument) will be of the form ``COMx``. On Windows the serial port (the ``-d`` argument) will be of the form ``COMx``.

View File

@ -35,12 +35,14 @@ console_scripts = [
"artiq_rpctool=artiq.frontend.artiq_rpctool:main", "artiq_rpctool=artiq.frontend.artiq_rpctool:main",
"artiq_run=artiq.frontend.artiq_run:main", "artiq_run=artiq.frontend.artiq_run:main",
"artiq_flash=artiq.frontend.artiq_flash:main", "artiq_flash=artiq.frontend.artiq_flash:main",
"lda_controller=artiq.frontend.lda_controller:main",
"novatech409b_controller=artiq.frontend.novatech409b_controller:main", "aqctl_lda=artiq.frontend.aqctl_lda:main",
"korad_ka3005p_controller=artiq.frontend.korad_ka3005p_controller:main", "aqctl_novatech409b=artiq.frontend.aqctl_novatech409b:main",
"pdq2_client=artiq.frontend.pdq2_client:main", "aqctl_korad_ka3005p=artiq.frontend.aqctl_korad_ka3005p:main",
"pdq2_controller=artiq.frontend.pdq2_controller:main", "aqctl_pdq2=artiq.frontend.aqctl_pdq2:main",
"thorlabs_tcube_controller=artiq.frontend.thorlabs_tcube_controller:main", "aqctl_thorlabs_tcube=artiq.frontend.aqctl_thorlabs_tcube:main",
"aqcli_pdq2=artiq.frontend.aqcli_pdq2:main",
] ]
gui_scripts = [ gui_scripts = [