Interfacing with the remote processes¶
The attpcdaq.daq.workertasks
module contains a class that uses the Paramiko SSH library to connect to the nodes
running the data router and ECC server in order to, for example, organize files at the end of a run. It can also
check whether these processes are running.
This class should typically be used as a context manager (i.e., with a with
statement). For example, to organize
files, you could try the following:
with WorkerInterface(data_router_ip_address) as wint:
wint.organize_files(experiment_name, run_number)
When used in this manner, the SSH session will automatically be opened when entering the with
block and closed
when leaving it.
The WorkerInterface class¶
-
class
attpcdaq.daq.workertasks.
WorkerInterface
(hostname, port=22, username=None, config_path=None)[source]¶ An interface to perform tasks on the DAQ worker nodes.
This is used perform tasks on the computers running the data router and the ECC server. This includes things like cleaning up the data files at the end of each run.
The connection is made using SSH, and the SSH config file at
config_path
is honored in making the connection. Additionally, the server must accept connections authenticated using a public key, and this public key must be available in your.ssh
directory.Parameters: - hostname (str) – The hostname to connect to.
- port (int, optional) – The port that the SSH server is listening on. The default is 22.
- username (str, optional) – The username to use. If it isn’t provided, a username will be read from the SSH config file. If no username is listed there, the name of the user running the code will be used.
- config_path (str, optional) – The path to the SSH config file. The default is
~/.ssh/config
.
Methods
find_data_router () |
Find the working directory of the data router process. |
get_graw_list () |
Get a list of GRAW files in the data router’s working directory. |
working_dir_is_clean () |
Check if there are GRAW files in the data router’s working directory. |
check_ecc_server_status () |
Checks if the ECC server is running. |
check_data_router_status () |
Checks if the data router is running. |
organize_files (experiment_name, run_number) |
Organize the GRAW files at the end of a run. |
tail_file (path[, num_lines]) |
Retrieve the tail of a text file on the remote host. |