From 10943b89db0d821306ae05d26ab34a608e64a131 Mon Sep 17 00:00:00 2001 From: Kati Lassila-Perini Date: Wed, 5 Apr 2023 16:14:17 +0200 Subject: [PATCH] production-pfnano: add pfnano prod and test workflow --- .github/workflows/PFNanoProd.yml | 41 ++++++++++++++++++------------ production/pfnano/pf_production.sh | 40 +++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 16 deletions(-) create mode 100644 production/pfnano/pf_production.sh diff --git a/.github/workflows/PFNanoProd.yml b/.github/workflows/PFNanoProd.yml index d09a392..5315a05 100644 --- a/.github/workflows/PFNanoProd.yml +++ b/.github/workflows/PFNanoProd.yml @@ -1,4 +1,4 @@ -name: PFNano Production Analysis +name: PFNano production test on: push: @@ -10,26 +10,35 @@ on: default: '24103' type: string jobs: - analysis: - runs-on: coffeateam/coffea-base + test-production: + runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v1 + uses: actions/checkout@v3 - - name: Install dependencies - run: git clone git@github.com:cms-dpoa/cat-hackathon.git - - - name: Run analysis + - name: Prepare directories run: | - cd cat-hackathon/analysis/coffea/ - python coffea_plot.py - - - name: Save results + mkdir outputs + echo ls -l `ls -l ` + + - name: Mount cvmfs + uses: cvmfs-contrib/github-action-cvmfs@v2 + run: | + echo "### Dump default.local ###" + cat /etc/cvmfs/default.local + echo "### Test /cvmfs/cms.cern.ch ###" + ls /cvmfs/cms.cern.ch + echo "### /cvmfs/cms-opendata-conddb.cern.ch/ ###" + ls /cvmfs/cms-opendata-conddb.cern.ch/ + + - name: Run production run: | - echo "save results" + docker run -v $(pwd):/mnt/vol -v /cvmfs:/cvmfs:shared -w /home/cmsusr gitlab-registry.cern.ch/cms-cloud/cmssw-docker/cc7-cvmfs:2023-04-04-131be08c /bin/bash /mnt/vol/production/pfnano/pf_production.sh github + echo ls -l `ls -l ` + cp *.root outputs - name: Upload results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: - name: Analysis Results - path: results/ + name: output + path: outputs/ diff --git a/production/pfnano/pf_production.sh b/production/pfnano/pf_production.sh new file mode 100644 index 0000000..e7ecc22 --- /dev/null +++ b/production/pfnano/pf_production.sh @@ -0,0 +1,40 @@ +# parameters: $1 runas, $2 number of events, $3 inputfile +# if running outside github actions, give any other 1st paramater than github i.e. commands.sh mywork (or omit the paramaters) +# defaults: +if [ -z "$1" ]; then runas=other; else runas=$1; fi +if [ -z "$2" ]; then nevents=20; else nevents=$2; fi +if [ -z "$3" ]; then inputfile=root://eospublic.cern.ch//eos/opendata/cms/Run2015D/DoubleEG/MINIAOD/08Jun2016-v1/10000/00387F48-342F-E611-AB5D-0CC47A4D76AC.root; else inputfile=$3; fi + +set -e + +# For the plain github action with docker, the area would be available in /mnt/vol +# if [ $runas = github ] +# then + sudo chown $USER /mnt/vol + ls -l /mnt/vol +# cp -r /mnt/vol cat-hackathon +# fi + +# Expect to be in /code +source /cvmfs/cms.cern.ch/cmsset_default.sh +cmsrel CMSSW_10_6_30 +cd CMSSW_10_6_30/src/ +cmsenv +git cms-init --upstream-only +git config user.email "me@me.com" +git config user.name "me" +git cms-merge-topic 39040 +git clone -b opendata https://github.com/DAZSLE/PFNano.git PhysicsTools/PFNano +scram b -j 4 + +cmsDriver.py --python_filename doubleeg_cfg.py --eventcontent NANOAOD --datatier NANOAOD \ + --fileout file:doubleeg_nanoaod.root --conditions 106X_dataRun2_v36 --step NANO \ + --filein $inputfile --era Run2_25ns,run2_nanoAOD_106X2015 --no_exec --data -n $nevents \ + --customise PhysicsTools/PFNano/pfnano_cff.PFnano_customizeData_onlyPF + +# if [ $runas = github ] +# then + cp *.root /mnt/vol/ + echo ls -l /mnt/vol + ls -l /mnt/vol +# fi \ No newline at end of file