Skip to content
Pierre Lasorak edited this page Oct 19, 2021 · 5 revisions

nanorc Wiki

How to run/test the run registry implementation

First you need to clone nanorc (not in sourcecode) and checkout the correct branch:

> git clone git@github.com:DUNE-DAQ/nanorc.git
> git checkout feature/plasorak_run_registry # you only need to do that before PR31 gets approved

You also need the the dotnanorc file, which holds the credentials of the databases and their addresses. You can symlink /nfs/home/plasorak/.nanorc.json to your home directory (which is the default location)

Next, you can fire up nano04rc, with the configuration (which in this case will be mdapp_fake to follow the example in the minidaq app):

> nano04rc mdapp_fake
╭──────────────────────────────────────────────────────────────────────────╮
│                              Shonky NanoRC                               │
│  This is an admittedly shonky nanp RC to control DUNE-DAQ applications.  │
│    Give it a command and it will do your biddings,                       │
│    but trust it and it will betray you!                                  │
│  Use it with care!                                                       │
╰──────────────────────────────────────────────────────────────────────────╯
Loading /nfs/home/plasorak/.nanorc.json
[14:26:00] INFO     RunDB socket http://np04-srv-021:5000/
           INFO     RunRegistryDB socket http://np04-srv-021:5005/
shonky np04rc> 

You are now inside nanorc run control! Let's boot, configure and init:

shonky np04rc> boot
[...]
shonky np04rc> conf
[...]
shonky np04rc> init
[...]
                                 Apps
┏━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ name     ┃ host         ┃ alive ┃ pings ┃ last cmd ┃ last succ. cmd ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ dataflow │ np04-srv-010 │ True  │ True  │ conf     │ conf           │
│ hsi      │ np04-srv-010 │ True  │ True  │ conf     │ conf           │
│ ruemu0   │ np04-srv-010 │ True  │ True  │ conf     │ conf           │
│ trigger  │ np04-srv-010 │ True  │ True  │ conf     │ conf           │
└──────────┴──────────────┴───────┴───────┴──────────┴────────────────┘

Assuming everything went well, you should get that the last successful command is conf, and that all the apps ping and are alive.

Let's start the run:

shonky np04rc> start TEST
[...]
[14:32:22] Started run #127, saving run data in ('.//RunConf_127/', 'RunConf_127.tgz', 'run_registry_db')                                                                                        core.py:221
[...]

Note the run run number (in this case 127) is retrieved from the run number database. At this stage, the run registry database is also used to save the configuration.

Let the run be for some time, and then you can stop the run, scrap, terminate the apps, and exit nanorc:

shonky np04rc> stop
[...]
[14:34:13] Stopped run #127
[...]
shonky np04rc> scrap
[...]
shonky np04rc> terminate
[...]
shonky np04rc> quit

Now, in theory, there should be a new entry in the run number database, and in the run registry. You can check that by directly interacting with their 2 rest APIs.

Let's have a look at the last entry on run number database (you should change USRNAME:PASSWORD with whatever is in the dotnanorc):

> curl -u USRNAME:PASSWORD -X GET np04-srv-021:5000/
Best thing since sliced bread # Yep, it's up and running
> curl -u USRNAME:PASSWORD -X GET np04-srv-021:5000/runnumber/get
[[[127]]] # That looks like the run number we were using

Now for the run registry (make sure you change the trailing 127 to the correct run number):

> curl -u USRNAME:PASSWORD -X GET np04-srv-021:5005/
Best thing since sliced bread! # Again, up and running
> curl -u USRNAME:PASSWORD -X GET np04-srv-021:5005/runregistry/getRunMeta/127
[
  [
    [
      127, # run number, filled at start
      "Tue, 19 Oct 2021 14:32:22 GMT", # run start timestamp, filled at start
      "Tue, 19 Oct 2021 14:34:13 GMT", # run end timestamp, filled at stop
      "dataflow_hsi_ruemu0_trigger", # det_id (the apps you were running)
      "TEST" # run type, filled at start
    ]
  ]
]

So far so good, but what about the configuration files? Again, change the 127 with the run number and use the correct password and username:

> curl -u USRNAME:PASSWORD -X GET -J np04-srv-021:5005/runregistry/getRunBlob/127 > config_r127.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6331  100  6331    0     0  1695k      0 --:--:-- --:--:-- --:--:-- 2060k
> mkdir config_r127
> tar -xvf config_r127.tgz -C config_r127

Now the directory config_r127 contains the configuration of run 127, which should be identical to what is in ./RunConf_127, except for resume_parsed*.json.