Skip to content

The Node

pomalley edited this page Aug 21, 2014 · 10 revisions

The LabRAD Node is a server that is used for starting and stopping other servers.

There are three files that are relevant to the node:

Each of these is documented (in the module docstring, at least) with their relevant purposes and requirements (including e.g. registry keys).

Running the Node

The node is currently implemented as a Twisted plugin. As long as twisted.plugins.labrad_node is in your pythonpath, you can run the plugin like this:

twistd -n labradnode

where -n means "don't daemonize" and labradnode is the name of the plugin. (Note that either installing pylabrad with setup.py or putting the labrad/ folder in your pythonpath is sufficient.) Running the node as a plugin is handy because if you restart the manager, it will automatically attempt to reconnect.

There is also a new script in the scripts folder of pylabrad, labradnode.py. All this does is the equivalent of the twistd command given earlier. This makes it easy to start the node without a command line (e.g. in Windows).

Using the Node

Each node has a name--either the environment variable LABRADNODE or the system's hostname.

You must point the node to the folder where your servers are stored. There is a folder in the registry for the node, >> Nodes >> [node name], with the key "Directories", which is a list of directories (strings) that the node looks to for servers. (This registry directory may be created automatically when the node is first run with a given node name.)

The node is fairly self-explanatory to use; key settings are available_servers, running_servers, start, stop, status, etc.

Modifying the Node

Note that if you change the node such that there's a syntax error (i.e. so that the file errors on import) then the plugin will not show up in the list of twisted plugins (from twistd --help). You can check for import errors by simply doing import labrad.node.

The twisted plugin docs are here.

Known issues

If the node can start a server but then can't find it after it has started it (this manifests in the browser as an eternally spinning icon) then you probably just have the names mismatched. Python class variable for the server name must match the name in the node info section of the server. See the documentation here and the ini file documentation here for more info.

Clone this wiki locally