Skip to content

Process manager

Pawel Plesniak edited this page Aug 9, 2024 · 7 revisions

process_manager

This app is responsible for the drunc processes, with the available process commands defined in available commands. If you are running with drunc-unified-shell, both the proces_manager and process-manager-shell outputs will be dumped to the drunc-unified-shell stdout. For a standalone process_manager you will need two shells - one shell to run the process_manager, and the other will interact with the process_manager through a process-manager-shell

Configurations

To boot a process_manager, you will need to choose the most appropriate configuration that applies to the use case. The configurations that are packaged with drunc are defined in drunc/src/data/process_manager/, which are

  • ssh-standalone.json - ssh based standalone implementation without a kafka feed.
  • ssh-kafka.json - ssh based implementation with kafka for message broadcasting.
  • ssh-CERN-kafka.json - ssh based implementation with kafka service running at ENH1.
  • k8s.json - kubernetes implementation (not recommended unless you are an expert user).

This is also the appropriate place to define new process_manager configurations should they be necessary.

Run a standalone process_manager

This goes as

drunc-process-manager file://<configuration_file_dir>

To spawn test-session, this looks like

(dbt) [pplesnia@np04-srv-019 drunc]$ drunc-process-manager file://src/drunc/data/process_manager/ssh-standalone.json 
Using 'file://src/drunc/data/process_manager/ssh-standalone.json' as the ProcessManager configuration
Starting 'SSHProcessManager'
[12:43:26] INFO     "BroadcastSenderConfHandler": None                                                                                                                                                  configuration.py:25
           INFO     "Controller": DummyAuthoriser ready                                                                                                                                              dummy_authoriser.py:13
ProcessManager was started on np04-srv-019:10054

Once this is done, you will not be able to send commands to the process from the current shell with the process_manager acting in the foreground. To interact with a standalone instance of process_manager you will need to connect to it.

Connect to a standalone process_manager

This is done directly with the address of the process manager in a separate shell. When spawning a standalone instance, the port to connect through is printed in the last line. Communication is done using gRPC. The connection command is

drunc-process-manager-shell grpc://<hostname>:<port>

For the test-session spawned above, in the process-manager-shell this is

drunc-process-manager-shell grpc://localhost:10054

Available commands

All the test-session examples provided in this section come from the test-session defined in the appmodel repository in test/config/test-session.data.xml.

boot

Spawns the DAQ system processes defined in a system configuration file. Required arguments (in this order):

  • boot_configuration: path to the system configuration file (written in OKS).
  • session_name: name of the session defined in the system configuration file.

Optional arguments:

  • --no-override-logs/--override-logs: decides whether to override the logs, if --override-logs is used the log filenames will not include a timestamp, otherwise if --no-overrride-logs is the log filenames will include a timestamp. By default, the logs are overwritten.
  • -l/--log-level: sets the log level.
  • -u/--user: assigns an owner to the spawned processes, default is $USER.

Caveats:

Note that in case you are running without a DUNE-DAQ environment, the OKS configuration type will not work. You will not be able to generate configuration files, however, you may be able to boot processes if the system configuration points to a valid DUNE-DAQ environment in the target host.

Also, note that you will not be able to start the connectivity server. This command will throw if you use a configuration generated with the boot.start_connectivity_server set to true.

It is most likely impossible to specify a user different from the one that is running the process_manager, simply because that user will likely not have the ssh keys necessary to ssh on a different host as a different user.

test-session output in the process-manager-shell

test/config/test-session.data.xml
[14:10:01] INFO     "_convert_oks_to_boot_request":                                                                                                                 process_manager_driver.py:35
                    /cvmfs/dunedaq-development.opensciencegrid.org/nightly/NB_DEV_240805_A9/spack-0.22.0/opt/spack/linux-almalinux9-x86_64/gcc-12.1.0/appmodel-NB_D                             
                    EV_240805_A9-ogm7fojt4qcerq2dcitwso2o3mmpld2y/share/test/config/test-session.data.xml                                                                                       
           INFO     "collect_apps": Ignoring disabled app ru-02                                                                                                                 oks_parser.py:95
           INFO     "collect_apps": Ignoring disabled app ru-03                                                                                                                 oks_parser.py:95
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'root-controller' (a61ffe46-dfa2-4a90-b888-7901fa5755b2) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'ru-controller' (d8541d0a-8c21-416f-870b-1dc0b0180857) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'ru-01' (5f75d23f-ee0a-4fa5-adfa-151ae8336683) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'df-controller' (0710d816-6a21-4501-b9ab-afb4bba08c23) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'tp-stream-writer' (ad84b119-595c-4489-9207-8f4929a5d53a) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'dfo-01' (fb45ef4d-a19e-433d-9b0b-35457c8666e1) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'df-01' (82615d14-dca5-4180-8f40-3f17180a9d87) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'df-02' (eefc8fce-2b4d-4de1-9d20-1c209902f98e) process started
[14:10:02] INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'trg-controller' (fbb8eacb-62e6-44eb-bb1c-4585cfbcd033) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'tc-maker-1' (9539be3d-6b51-4129-a474-12e3c268d2df) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'mlt' (e1f45c8c-1505-46b9-bb4f-a05b138ea314) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'hsi-to-tc-app' (ec82eee5-fed9-4906-992c-8721d3be6f7f) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'hsi-controller' (f1765e99-80bf-4a39-91f5-a56bc36962db) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'hsi-01' (cef1b4ff-6fff-4efc-a66a-08a9dce28c24) process started
           INFO     "process_manager_driver": RTE script was not supplied in the OKS configuration, using the one from local enviroment instead                     process_manager_driver.py:82
'local-connection-server' (1285a63b-637b-4ac8-a30a-62cd419505bc) process started
                                                ╭─────────────────────────────────────────────────────────────────────────────────────────────╮                                                 
                                                │                                                                                             │                                                 
                                                │                                                                                             │                                                 
                                                │      Controller endpoint: 'localhost:3333', point your 'drunc-controller-shell' to it.      │                                                 
                                                │                                                                                             │                                                 
                                                │                                                                                             │                                                 
                                                ╰─────────────────────────────────────────────────────────────────────────────────────────────╯     

test-session output in the process_manager

[14:10:01] INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "root-controller"                                                                                                                                                     
                    tree_id: "1.0.0"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted root-controller uid: a61ffe46-dfa2-4a90-b888-7901fa5755b2                                                           ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "ru-controller"                                                                                                                                                       
                    tree_id: "1.1.0"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted ru-controller uid: d8541d0a-8c21-416f-870b-1dc0b0180857                                                             ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "ru-01"                                                                                                                                                               
                    tree_id: "1.1.1"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted ru-01 uid: 5f75d23f-ee0a-4fa5-adfa-151ae8336683                                                                     ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "df-controller"                                                                                                                                                       
                    tree_id: "1.2.0"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted df-controller uid: 0710d816-6a21-4501-b9ab-afb4bba08c23                                                             ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "tp-stream-writer"                                                                                                                                                    
                    tree_id: "1.2.1"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted tp-stream-writer uid: ad84b119-595c-4489-9207-8f4929a5d53a                                                          ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "dfo-01"                                                                                                                                                              
                    tree_id: "1.2.2"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted dfo-01 uid: fb45ef4d-a19e-433d-9b0b-35457c8666e1                                                                    ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "df-01"                                                                                                                                                               
                    tree_id: "1.2.3"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted df-01 uid: 82615d14-dca5-4180-8f40-3f17180a9d87                                                                     ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "df-02"                                                                                                                                                               
                    tree_id: "1.2.4"                                                                                                                                                            
                                                                                                                                                                                                
[14:10:02] INFO     "ssh-process-manager": Booted df-02 uid: eefc8fce-2b4d-4de1-9d20-1c209902f98e                                                                     ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "trg-controller"                                                                                                                                                      
                    tree_id: "1.3.0"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted trg-controller uid: fbb8eacb-62e6-44eb-bb1c-4585cfbcd033                                                            ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "tc-maker-1"                                                                                                                                                          
                    tree_id: "1.3.1"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted tc-maker-1 uid: 9539be3d-6b51-4129-a474-12e3c268d2df                                                                ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "mlt"                                                                                                                                                                 
                    tree_id: "1.3.2"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted mlt uid: e1f45c8c-1505-46b9-bb4f-a05b138ea314                                                                       ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "hsi-to-tc-app"                                                                                                                                                       
                    tree_id: "1.3.3"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted hsi-to-tc-app uid: ec82eee5-fed9-4906-992c-8721d3be6f7f                                                             ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "hsi-controller"                                                                                                                                                      
                    tree_id: "1.4.0"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted hsi-controller uid: f1765e99-80bf-4a39-91f5-a56bc36962db                                                            ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "hsi-01"                                                                                                                                                              
                    tree_id: "1.4.1"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted hsi-01 uid: cef1b4ff-6fff-4efc-a66a-08a9dce28c24                                                                    ssh_process_manager.py:299
           INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "local-connection-server"                                                                                                                                             
                    tree_id: "1.0.1"                                                                                                                                                            
                                                                                                                                                                                                
           INFO     "ssh-process-manager": Booted local-connection-server uid: 1285a63b-637b-4ac8-a30a-62cd419505bc                                                   ssh_process_manager.py:299

ps

Lists running processes.

There are no mandatory arguments. This command will by default list all the processes from any session, with any name, spawned by any user, and with any UUID as long as its under the management of the current instance of process_manger.

Options are:

  • --long-format/-l: get a long listing format.
  • --session/-s: list processes from a specific session.
  • --name/-n: list processes with a specific name.
  • --user/-u: list processes from a specific user.
  • --uuid: list processes with a specific unique identifier.

All options aside from --long-format/-l can be repeated as option-value pairs e.g. ps --uuid <ID1> --uuid <ID2> and can be mixed e.g. ps --uuid <ID> -n <name>. Regex is supported.

test-session output after running boot and ps in process-manager-shell

drunc-process-manager > ps
                                                      Processes running                                                       
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┓
┃ session      ┃ friendly name             ┃ user     ┃ host      ┃ uuid                                 ┃ alive ┃ exit-code ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━┩
│ test-session │ root-controller           │ pplesnia │ localhost │ a61ffe46-dfa2-4a90-b888-7901fa5755b2 │ True  │ 0         │
│ test-session │   local-connection-server │ pplesnia │ localhost │ 1285a63b-637b-4ac8-a30a-62cd419505bc │ True  │ 0         │
│ test-session │   ru-controller           │ pplesnia │ localhost │ d8541d0a-8c21-416f-870b-1dc0b0180857 │ True  │ 0         │
│ test-session │     ru-01                 │ pplesnia │ localhost │ 5f75d23f-ee0a-4fa5-adfa-151ae8336683 │ True  │ 0         │
│ test-session │   df-controller           │ pplesnia │ localhost │ 0710d816-6a21-4501-b9ab-afb4bba08c23 │ True  │ 0         │
│ test-session │     tp-stream-writer      │ pplesnia │ localhost │ ad84b119-595c-4489-9207-8f4929a5d53a │ True  │ 0         │
│ test-session │     dfo-01                │ pplesnia │ localhost │ fb45ef4d-a19e-433d-9b0b-35457c8666e1 │ True  │ 0         │
│ test-session │     df-01                 │ pplesnia │ localhost │ 82615d14-dca5-4180-8f40-3f17180a9d87 │ True  │ 0         │
│ test-session │     df-02                 │ pplesnia │ localhost │ eefc8fce-2b4d-4de1-9d20-1c209902f98e │ True  │ 0         │
│ test-session │   trg-controller          │ pplesnia │ localhost │ fbb8eacb-62e6-44eb-bb1c-4585cfbcd033 │ True  │ 0         │
│ test-session │     tc-maker-1            │ pplesnia │ localhost │ 9539be3d-6b51-4129-a474-12e3c268d2df │ True  │ 0         │
│ test-session │     mlt                   │ pplesnia │ localhost │ e1f45c8c-1505-46b9-bb4f-a05b138ea314 │ True  │ 0         │
│ test-session │     hsi-to-tc-app         │ pplesnia │ localhost │ ec82eee5-fed9-4906-992c-8721d3be6f7f │ True  │ 0         │
│ test-session │   hsi-controller          │ pplesnia │ localhost │ f1765e99-80bf-4a39-91f5-a56bc36962db │ True  │ 0         │
│ test-session │     hsi-01                │ pplesnia │ localhost │ cef1b4ff-6fff-4efc-a66a-08a9dce28c24 │ True  │ 0         │
└──────────────┴───────────────────────────┴──────────┴───────────┴──────────────────────────────────────┴───────┴───────────┘

There is no output in process_manager when using this command.

kill

Kills processes and frees their memory. killed processes will not appear with ps.

There are no mandatory arguments. This command will by default not kill anything.

Options are:

  • --session/-s: kill processes from a specific session.
  • --name/-n: kill processes with a specific name.
  • --user/-u: kill processes from a specific user.
  • --uuid: kill processes with a specific unique identifier.

All options can be repeated as option-value pairs e.g. kill --uuid <ID1> --uuid <ID2> and can be mixed e.g. kill --uuid <ID> -n <name>. Regex is supported.

test-session output after running boot and ps in process-manager-shell

drunc-process-manager > kill -n mlt 
                                                  Killed process                                                  
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┓
┃ session      ┃ friendly name ┃ user     ┃ host      ┃ uuid                                 ┃ alive ┃ exit-code ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━┩
│ test-session │     mlt       │ pplesnia │ localhost │ e1f45c8c-1505-46b9-bb4f-a05b138ea314 │ False │ 255       │
└──────────────┴───────────────┴──────────┴───────────┴──────────────────────────────────────┴───────┴───────────┘

test-session output after running boot and ps in process_manager

[14:13:44] INFO     "ssh-process-manager": Killing                                                                                                                    ssh_process_manager.py:416
           WARNING  "ssh-process-manager": Killing all the known processes before exiting                                                                             ssh_process_manager.py:418
           INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to 'e1f45c8c-1505-46b9-bb4f-a05b138ea314'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'mlt' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                                ssh_process_manager.py:198

flush

Removes dead processes from process_manager memory, effectively rendering them not restartable and not appearing in ps.

There are no mandatory arguments. This command will by default flush all the dead processes.

Options are:

  • --session/-s: flush processes from a specific session.
  • --name/-n: flush processes with a specific name.
  • --user/-u: flush processes from a specific user.
  • --uuid: flush processes with a specific unique identifier.

All options can be repeated as option-value pairs e.g. flush --uuid <ID1> --uuid <ID2> and can be mixed e.g. flush --uuid <ID> -n <name>. Regex is supported.

test-session output after running boot, ps, kill, and killing hsi-to-tc-app (in a separate shell) in process-manager-shell

drunc-process-manager > ps
                                                      Processes running                                                       
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┓
┃ session      ┃ friendly name             ┃ user     ┃ host      ┃ uuid                                 ┃ alive ┃ exit-code ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━┩
│ test-session │ root-controller           │ pplesnia │ localhost │ a61ffe46-dfa2-4a90-b888-7901fa5755b2 │ True  │ 0         │
│ test-session │   local-connection-server │ pplesnia │ localhost │ 1285a63b-637b-4ac8-a30a-62cd419505bc │ True  │ 0         │
│ test-session │   ru-controller           │ pplesnia │ localhost │ d8541d0a-8c21-416f-870b-1dc0b0180857 │ True  │ 0         │
│ test-session │     ru-01                 │ pplesnia │ localhost │ 5f75d23f-ee0a-4fa5-adfa-151ae8336683 │ True  │ 0         │
│ test-session │   df-controller           │ pplesnia │ localhost │ 0710d816-6a21-4501-b9ab-afb4bba08c23 │ True  │ 0         │
│ test-session │     tp-stream-writer      │ pplesnia │ localhost │ ad84b119-595c-4489-9207-8f4929a5d53a │ True  │ 0         │
│ test-session │     dfo-01                │ pplesnia │ localhost │ fb45ef4d-a19e-433d-9b0b-35457c8666e1 │ True  │ 0         │
│ test-session │     df-01                 │ pplesnia │ localhost │ 82615d14-dca5-4180-8f40-3f17180a9d87 │ True  │ 0         │
│ test-session │     df-02                 │ pplesnia │ localhost │ eefc8fce-2b4d-4de1-9d20-1c209902f98e │ True  │ 0         │
│ test-session │   trg-controller          │ pplesnia │ localhost │ fbb8eacb-62e6-44eb-bb1c-4585cfbcd033 │ True  │ 0         │
│ test-session │     tc-maker-1            │ pplesnia │ localhost │ 9539be3d-6b51-4129-a474-12e3c268d2df │ True  │ 0         │
│ test-session │     hsi-to-tc-app         │ pplesnia │ localhost │ ec82eee5-fed9-4906-992c-8721d3be6f7f │ False │ 143       │
│ test-session │   hsi-controller          │ pplesnia │ localhost │ f1765e99-80bf-4a39-91f5-a56bc36962db │ True  │ 0         │
│ test-session │     hsi-01                │ pplesnia │ localhost │ cef1b4ff-6fff-4efc-a66a-08a9dce28c24 │ True  │ 0         │
└──────────────┴───────────────────────────┴──────────┴───────────┴──────────────────────────────────────┴───────┴───────────┘
drunc-process-manager > flush
                                                   Flushed process                                                    
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┓
┃ session      ┃ friendly name     ┃ user     ┃ host      ┃ uuid                                 ┃ alive ┃ exit-code ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━┩
│ test-session │     hsi-to-tc-app │ pplesnia │ localhost │ ec82eee5-fed9-4906-992c-8721d3be6f7f │ False │ 143       │
└──────────────┴───────────────────┴──────────┴───────────┴──────────────────────────────────────┴───────┴───────────┘
drunc-process-manager > ps
                                                      Processes running                                                       
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┓
┃ session      ┃ friendly name             ┃ user     ┃ host      ┃ uuid                                 ┃ alive ┃ exit-code ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━┩
│ test-session │ root-controller           │ pplesnia │ localhost │ a61ffe46-dfa2-4a90-b888-7901fa5755b2 │ True  │ 0         │
│ test-session │   local-connection-server │ pplesnia │ localhost │ 1285a63b-637b-4ac8-a30a-62cd419505bc │ True  │ 0         │
│ test-session │   ru-controller           │ pplesnia │ localhost │ d8541d0a-8c21-416f-870b-1dc0b0180857 │ True  │ 0         │
│ test-session │     ru-01                 │ pplesnia │ localhost │ 5f75d23f-ee0a-4fa5-adfa-151ae8336683 │ True  │ 0         │
│ test-session │   df-controller           │ pplesnia │ localhost │ 0710d816-6a21-4501-b9ab-afb4bba08c23 │ True  │ 0         │
│ test-session │     tp-stream-writer      │ pplesnia │ localhost │ ad84b119-595c-4489-9207-8f4929a5d53a │ True  │ 0         │
│ test-session │     dfo-01                │ pplesnia │ localhost │ fb45ef4d-a19e-433d-9b0b-35457c8666e1 │ True  │ 0         │
│ test-session │     df-01                 │ pplesnia │ localhost │ 82615d14-dca5-4180-8f40-3f17180a9d87 │ True  │ 0         │
│ test-session │     df-02                 │ pplesnia │ localhost │ eefc8fce-2b4d-4de1-9d20-1c209902f98e │ True  │ 0         │
│ test-session │   trg-controller          │ pplesnia │ localhost │ fbb8eacb-62e6-44eb-bb1c-4585cfbcd033 │ True  │ 0         │
│ test-session │     tc-maker-1            │ pplesnia │ localhost │ 9539be3d-6b51-4129-a474-12e3c268d2df │ True  │ 0         │
│ test-session │   hsi-controller          │ pplesnia │ localhost │ f1765e99-80bf-4a39-91f5-a56bc36962db │ True  │ 0         │
│ test-session │     hsi-01                │ pplesnia │ localhost │ cef1b4ff-6fff-4efc-a66a-08a9dce28c24 │ True  │ 0         │
└──────────────┴───────────────────────────┴──────────┴───────────┴──────────────────────────────────────┴───────┴───────────┘

test-session output after running boot, ps, kill, and killing hsi-to-tc-app (in a separate shell) in process_manager

[14:15:07] INFO     "ssh-process-manager": Process 'hsi-to-tc-app' (session: 'test-session', user: 'pplesnia') process exited with exit code 143                      ssh_process_manager.py:198
[14:17:11] INFO     "ssh-process-manager": Booting user: "pplesnia"                                                                                                   ssh_process_manager.py:220
                    session: "test-session"                                                                                                                                                     
                    name: "df-02"                                                                                                                                                               
                    hostname: "localhost"                                                                                                                                                       
                    tree_id: "1.2.4"                                                                                                                                                            

restart

Restarts a process_manager process. If the process is alive, it kills it and boots it again.

There are no mandatory arguments. process_manager will ensure that you are restarting one and only one process. The CLI will check that you have provided at least one option below.

Options are:

  • --session/-s: restart processes from a specific session.
  • --name/-n: restart processes with a specific name.
  • --user/-u: restart processes from a specific user.
  • --uuid: restart processes with a specific unique identifier.

Options cannot be repeated. Applications are restarted individually.

test-session output after running boot, ps, kill, ps, and restart in process-manager-shell

drunc-process-manager > restart -n df-02

test-session output after running boot, ps, kill, ps, and restart in process_manager

           INFO     "ssh-process-manager": Process 'df-02' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                              ssh_process_manager.py:198
[14:17:14] INFO     "ssh-process-manager": Booted df-02 uid: eefc8fce-2b4d-4de1-9d20-1c209902f98e                                                                     ssh_process_manager.py:299

logs

Prints logs from individual processes.

The process_manager will ensure that you are trying to fetch the logs from exactly one process. At least one of these arguments is required

  • --session/-s: fetch logs from the processes in the provided session.
  • --name/-n: fetch logs from the process with the provided name.
  • --user/-u: fetch logs from the processes spawned by the provided user.
  • --uuid: fetch logs from the process with the provided unique identifier.

The options can be repeated, but can only refer to a single process so typically options are not repeated here. Note - for --session/-s and --user/-u this choice will typically select multiple processes which logs will not process, and so are rarely used.

You can also provide the following options

  • --how-far: how many lines to fetch.
  • --grep: grep for a specific pattern in the logs.

test-session output after running boot, ps, kill, ps, restart, ps and logs in process-manager-shell

drunc-process-manager > logs -n root-controller --how-far 5
────────────────────────────────────────────────────────────────────────── a61ffe46-dfa2-4a90-b888-7901fa5755b2 logs ───────────────────────────────────────────────────────────────────────────
           INFO     "Controller": 'df-controller@localhost:5600' (type ChildNodeType.gRPC)                                           controller.py:123
           INFO     "Controller": 'trg-controller@localhost:5700' (type ChildNodeType.gRPC)                                          controller.py:123
           INFO     "Controller": 'hsi-controller@localhost:5800' (type ChildNodeType.gRPC)                                          controller.py:123
           INFO     "Broadcast": ready                                                                                          broadcast_sender.py:65
root-controller was started on localhost:3333
───────────────────────────────────────────────────────────────────────────────────────────── End ──────────────────────────────────────────────────────────────────────────────────────────────

There is no log in the process_manager.

terminate

Kills all running processes controlled by the process manager. There are no arguments required.

test-session output after running all the previous commands and terminate in process-manager-shell

drunc-process-manager > terminate
                                                      Terminated process                                                      
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┓
┃ session      ┃ friendly name             ┃ user     ┃ host      ┃ uuid                                 ┃ alive ┃ exit-code ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━┩
│ test-session │ root-controller           │ pplesnia │ localhost │ a61ffe46-dfa2-4a90-b888-7901fa5755b2 │ False │ 255       │
│ test-session │   local-connection-server │ pplesnia │ localhost │ 1285a63b-637b-4ac8-a30a-62cd419505bc │ False │ 255       │
│ test-session │   ru-controller           │ pplesnia │ localhost │ d8541d0a-8c21-416f-870b-1dc0b0180857 │ False │ 255       │
│ test-session │     ru-01                 │ pplesnia │ localhost │ 5f75d23f-ee0a-4fa5-adfa-151ae8336683 │ False │ 255       │
│ test-session │   df-controller           │ pplesnia │ localhost │ 0710d816-6a21-4501-b9ab-afb4bba08c23 │ False │ 255       │
│ test-session │     tp-stream-writer      │ pplesnia │ localhost │ ad84b119-595c-4489-9207-8f4929a5d53a │ False │ 255       │
│ test-session │     dfo-01                │ pplesnia │ localhost │ fb45ef4d-a19e-433d-9b0b-35457c8666e1 │ False │ 255       │
│ test-session │     df-01                 │ pplesnia │ localhost │ 82615d14-dca5-4180-8f40-3f17180a9d87 │ False │ 255       │
│ test-session │     df-02                 │ pplesnia │ localhost │ eefc8fce-2b4d-4de1-9d20-1c209902f98e │ False │ 255       │
│ test-session │   trg-controller          │ pplesnia │ localhost │ fbb8eacb-62e6-44eb-bb1c-4585cfbcd033 │ False │ 255       │
│ test-session │     tc-maker-1            │ pplesnia │ localhost │ 9539be3d-6b51-4129-a474-12e3c268d2df │ False │ 255       │
│ test-session │   hsi-controller          │ pplesnia │ localhost │ f1765e99-80bf-4a39-91f5-a56bc36962db │ False │ 255       │
│ test-session │     hsi-01                │ pplesnia │ localhost │ cef1b4ff-6fff-4efc-a66a-08a9dce28c24 │ False │ 255       │
└──────────────┴───────────────────────────┴──────────┴───────────┴──────────────────────────────────────┴───────┴───────────┘
drunc-process-manager > ps
                         Processes running                          
┏━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━━┳━━━━━━━━━━━┓
┃ session ┃ friendly name ┃ user ┃ host ┃ uuid ┃ alive ┃ exit-code ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━╇━━━━━━╇━━━━━━━╇━━━━━━━━━━━┩

test-session output after running all the previous commands and terminate in process_manager

[14:33:00] INFO     "ssh-process-manager": Terminating                                                                                                                ssh_process_manager.py:132
           WARNING  "ssh-process-manager": Killing all the known processes before exiting                                                                             ssh_process_manager.py:134
           INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to 'a61ffe46-dfa2-4a90-b888-7901fa5755b2'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'root-controller' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                    ssh_process_manager.py:198
[14:33:01] INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to 'd8541d0a-8c21-416f-870b-1dc0b0180857'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'ru-controller' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                      ssh_process_manager.py:198
           INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to '5f75d23f-ee0a-4fa5-adfa-151ae8336683'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'ru-01' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                              ssh_process_manager.py:198
[14:33:02] INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to '0710d816-6a21-4501-b9ab-afb4bba08c23'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'df-controller' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                      ssh_process_manager.py:198
           INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to 'ad84b119-595c-4489-9207-8f4929a5d53a'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'tp-stream-writer' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                   ssh_process_manager.py:198
[14:33:03] INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to 'fb45ef4d-a19e-433d-9b0b-35457c8666e1'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'dfo-01' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                             ssh_process_manager.py:198
           INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to '82615d14-dca5-4180-8f40-3f17180a9d87'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'df-01' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                              ssh_process_manager.py:198
[14:33:04] INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to 'fbb8eacb-62e6-44eb-bb1c-4585cfbcd033'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'trg-controller' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                     ssh_process_manager.py:198
           INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to '9539be3d-6b51-4129-a474-12e3c268d2df'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'tc-maker-1' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                         ssh_process_manager.py:198
[14:33:05] INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to 'f1765e99-80bf-4a39-91f5-a56bc36962db'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'hsi-controller' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                     ssh_process_manager.py:198
           INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to 'cef1b4ff-6fff-4efc-a66a-08a9dce28c24'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'hsi-01' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                             ssh_process_manager.py:198
[14:33:06] INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to '1285a63b-637b-4ac8-a30a-62cd419505bc'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'local-connection-server' (session: 'test-session', user: 'pplesnia') process exited with exit code 255            ssh_process_manager.py:198
           INFO     "process_manager": Sending signal 'Signals.SIGQUIT' to 'eefc8fce-2b4d-4de1-9d20-1c209902f98e'                                                      ssh_process_manager.py:95
           INFO     "ssh-process-manager": Process 'df-02' (session: 'test-session', user: 'pplesnia') process exited with exit code 255                              ssh_process_manager.py:198

process_manager_shell

Clone this wiki locally