Developping guidelines - DUNE-DAQ/drunc GitHub Wiki

Thanks to the RSE at Imperial, we now have quite extensive testing and linting facilities included in drunc. Here are some information to use them.

Generate a

Make GitHub and pip available at NP04

If you are coding at NP04, you need to be able to access the pip repos and GitHub, this is achieved by creating these files:

$ cat ~/.config/pip/pip.conf
[global]
        proxy = http://np04-web-proxy.cern.ch:3128
# and
$ cat ~/.gitconfig
[http]
        proxy = http://np04-web-proxy.cern.ch:3128
        sslVerify = false
# and
$ cat ~/.ssh/config
Host github.com
  ProxyCommand ssh -q lxplus nc %h %p

Setup ssh keys on GitHub

Is done by doing:

$ ssh-keygen # if you haven't done that already (i.e. if the next steps fails)
# Press enter 3 times for a passwordless ssh key in the default location
# and then
$ cat ~/.ssh/id_rsa.pub # Note the .pub here, for public!
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB...

You can then link the ssh key to your GitHub account:

  • Log on GitHub
  • Click on your mug/avatar on the top right
  • Click on Settings
  • Click on SSH and GPG keys in the Access section
  • Click on New SSH key (green icon)
  • Give it a name (NP04?)
  • Copy and paste the output of cat ~/.ssh/id_rsa.pub in there
  • Click add SSH key.

Done.

Install the DAQ and drunc

Follow instructions here: https://github.com/DUNE-DAQ/daqconf/wiki/

Then, clone drunc:

$ git clone [email protected]:DUNE-DAQ/drunc.git
$ pip install -e .[develop] # note the [develop]!
$ pre-commit install

You can now follow standard procedure to develop the run control, but every time you commit you will get:

$ git commit
[INFO] Initializing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Installing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
ruff.....................................................................Failed
- hook id: ruff
- exit code: 1
- files were modified by this hook

Found 3 errors (3 fixed, 0 remaining).

ruff-format..............................................................Failed
- hook id: ruff-format
- files were modified by this hook

1 file reformatted

If you have a failure, git commit won't work, and then you will get changes in your work directory, that you need to git add again. You can have a look at the output of git status:

$ git status
On branch plasorak/differentiate-session-conf
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   src/drunc/process_manager/configuration.py

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   src/drunc/process_manager/configuration.py

Here is an example where it ends well:

$ git commit -m "sorted with pre-commit"
ruff.....................................................................Passed
ruff-format..............................................................Passed
[plasorak/differentiate-session-conf 6753a1b] sorted with pre-commit
 1 file changed, 11 insertions(+), 6 deletions(-)
⚠️ **GitHub.com Fallback** ⚠️