Skip to content

Commit

Permalink
CI for Powheg hvq
Browse files Browse the repository at this point in the history
  • Loading branch information
mseidel42 committed May 27, 2022
1 parent c878412 commit 5784e58
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 2 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# README

## Get VM

* Get VM at https://openstack.cern.ch
* Use CS8 image

## Basic setup

```
dnf install dnf-autoupdate bash-completion nano
nano /etc/dnf/automatic.conf -> apply_updates = yes
systemctl enable --now dnf-automatic.time
adduser runner
dnf install locmap-release
dnf install locmap
locmap --enable cvmfs
locmap --configure all
```

## Docker

```
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin
usermod -aG docker runner
systemctl enable --now docker.service
```

## Gitlab runner

Can be done multiple times in different directories for registering multiple runners on the same VM.

### Install+register as `runner`
* Follow instructions from https://github.com/cms-sw/genproductions/settings/actions/runners
* To cope with timeouts in registering the runner, use `--unattended`:
```
./config.sh --url https://github.com/cms-sw/genproductions --token <token> --unattended --replace --name <name>
```

### Enable as a service as `root`:
```
./svc.sh install runner
chcon system_u:object_r:usr_t:s0 runsvc.sh
./svc.sh start
```

After a few minutes, new runner should show up as up and "Idle".
32 changes: 32 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
powheg:
# The type of runner that the job will run on
runs-on: [self-hosted, linux, x64]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Build gridpack
run: docker run --rm -v /cvmfs:/cvmfs -v $PWD:$PWD -w $PWD gitlab-registry.cern.ch/cms-cloud/cmssw-docker/cc7-cms bash bin/Powheg/test/test_build.sh -r CMSSW_11_0_1 -p hvq

- name: Check pwg-stat.dat
run: git diff --exit-code bin/Powheg/test/pwg-stat.dat.hvq
4 changes: 2 additions & 2 deletions bin/Powheg/run_pwg_condor.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,8 +876,8 @@ def make_nnlo_rwl(folderName):

if QUEUE == 'none':
print 'Direct running in one shot... \n'
os.system('bash '+scriptName+' >& '+
scriptName.split('.sh')[0]+'.log &')
os.system('bash '+scriptName+' | tee '+
scriptName.split('.sh')[0]+'.log')
else:
print 'Submitting to condor queues \n'
condorfile = prepareCondorScript(tagName, '', '.', QUEUE, runInBatchDir=True)
Expand Down
6 changes: 6 additions & 0 deletions bin/Powheg/test/pwg-stat.dat.hvq
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
btilde pos. weights: 641.58726784236762 +- 0.50050146494956704
btilde |neg.| weights: 2.7265054612194910 +- 6.5743335888494514E-002
btilde Total (pos.-|neg.|): 638.86076238115515 +- 0.51030664871510201
Remnant cross section in pb 48.209050346881405 +- 8.5434566147202157E-002
total (btilde+remnants) cross section in pb 687.06981272803660 +- 0.51740887199157992
negative weight fraction: 3.9370622427248548E-003
58 changes: 58 additions & 0 deletions bin/Powheg/test/test_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

while getopts r:p: flag
do
case "${flag}" in
r) CMSSW_RELEASE=${OPTARG};;
p) PROC=${OPTARG};;
esac
done

if [ "$CMSSW_RELEASE" = "" ]; then
echo "Error: no CMSSW release specified. Use -r CMSSW_X_Y_Z"
exit 1
fi
if [ "$PROC" = "" ]; then
echo "Error: no Powheg process specified. Use -p proc"
exit 1
fi

# define test input for each process
case $PROC in
hvq) INPUT=production/2017/13TeV/TT_hvq/TT_hdamp_NNPDF31_NNLO_ljets.input;;
*) echo "Error: process $PROC not defined in test script"; exit 1;;
esac

POWHEG_DIR="$(dirname $(dirname $(realpath $0)))"
BASE_DIR=/tmp/$USER/test_$PROC

echo "CMSSW release: $CMSSW_RELEASE";
echo "Test process: $PROC";
echo "Test config: $INPUT"
echo "Base directory: $BASE_DIR"
echo "Powheg directory: $POWHEG_DIR"

# setup CMSSW
echo "Setting up $CMSSW_RELEASE in $BASE_DIR"
mkdir -p $BASE_DIR
cd $BASE_DIR
source /cvmfs/cms.cern.ch/cmsset_default.sh
/cvmfs/cms.cern.ch/common/scramv1 project CMSSW $CMSSW_RELEASE
if [ ! -e $CMSSW_RELEASE ]; then
echo "Error: no CMSSW area"
exit 1
fi
cd $CMSSW_RELEASE/src
eval `/cvmfs/cms.cern.ch/common/scramv1 runtime -sh`
ln -s $POWHEG_DIR/* .
# run Powheg
python run_pwg_condor.py -p f -i $INPUT -m $PROC -d 1
cp testProd/pwg-stat.dat test/pwg-stat.dat.$PROC

GRIDPACK=${PROC}_${SCRAM_ARCH}_${CMSSW_RELEASE}_testProd.tgz
if [ ! -f $GRIDPACK ]; then
echo "Error: gridpack $GRIDPACK not found"
exit 1
fi

# rm -rf $CMSSW_RELEASE

0 comments on commit 5784e58

Please sign in to comment.