From 6fa6343bc63dc3d96e231bbce944f5cae8a4b0e1 Mon Sep 17 00:00:00 2001 From: Whitney Armstrong <warmstrong@anl.gov> Date: Sat, 21 Nov 2020 10:47:07 -0600 Subject: [PATCH] Fixed up the dvcs - added some dummy junit reports. --- .gitlab-ci.yml | 3 ++ config/env.sh | 2 +- dvcs/config.yml | 8 ++++- dvcs/dvcs.sh | 56 ++++++++++++------------------- dvcs/report.xml | 10 ++++++ dvcs/report2.xml | 12 +++++++ options/tracker_reconstruction.py | 6 +++- 7 files changed, 60 insertions(+), 37 deletions(-) create mode 100644 dvcs/report.xml create mode 100644 dvcs/report2.xml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5fc85d2d..58c30aac 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,3 +42,6 @@ summary: needs: ["dis:results", "dvcs:results", "dvmp:results"] script: - echo "All benchmarks passed" + artifacts: + reports: + junit: ["results/dvcs/report2.xml"] diff --git a/config/env.sh b/config/env.sh index 5abe4194..b07931e6 100755 --- a/config/env.sh +++ b/config/env.sh @@ -36,7 +36,7 @@ echo "JUGGLER_DETECTOR: ${JUGGLER_DETECTOR}" ## Number of events that will be processed by the reconstruction if [ ! -n "${JUGGLER_N_EVENTS}" ] ; then - export JUGGLER_N_EVENTS=100 + export JUGGLER_N_EVENTS=10 fi echo "JUGGLER_N_EVENTS: ${JUGGLER_N_EVENTS}" diff --git a/dvcs/config.yml b/dvcs/config.yml index 1255c602..0bd08d37 100644 --- a/dvcs/config.yml +++ b/dvcs/config.yml @@ -3,7 +3,7 @@ dvcs:process: timeout: 1 hour needs: ["detector"] script: - - echo "dvcd benchmark" + - bash dvcs/dvcs.sh artifacts: paths: - results @@ -13,3 +13,9 @@ dvcs:results: needs: ["dvcs:process"] script: - echo "All DVCS benchmarks successful" + artifacts: + paths: + - results + reports: + junit: ["results/dvcs/report.xml"] + diff --git a/dvcs/dvcs.sh b/dvcs/dvcs.sh index 32c1816d..ebab4c72 100644 --- a/dvcs/dvcs.sh +++ b/dvcs/dvcs.sh @@ -1,18 +1,5 @@ #!/bin/bash -if [[ ! -n "${JUGGLER_DETECTOR}" ]] ; then - export JUGGLER_DETECTOR="topside" -fi - -if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then - export JUGGLER_N_EVENTS=100 -fi - -# only used when running locally (not in CI) -if [[ ! -n "${JUGGLER_INSTALL_PREFIX}" ]] ; then - export JUGGLER_INSTALL_PREFIX="/usr/local" -fi - # these variables might not need exported. export JUGGLER_FILE_NAME_TAG="dvcs" @@ -23,18 +10,15 @@ echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" echo "JUGGLER_DETECTOR = ${JUGGLER_DETECTOR}" echo "JUGGLER_FILE_NAME_TAG = ${JUGGLER_FILE_NAME_TAG}" -### Build the detector constructors. -git clone https://eicweb.phy.anl.gov/EIC/detectors/${JUGGLER_DETECTOR}.git -git clone https://eicweb.phy.anl.gov/EIC/detectors/accelerator.git -pushd ${JUGGLER_DETECTOR} -ln -s ../accelerator/eic -popd -mkdir ${JUGGLER_DETECTOR}/build -pushd ${JUGGLER_DETECTOR}/build -cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j30 install -popd +## To run the reconstruction, we need the following global variables: +## - JUGGLER_INSTALL_PREFIX: Install prefix for Juggler (simu/recon) +## - JUGGLER_DETECTOR: the detector package we want to use for this benchmark +## - DETECTOR_PATH: full path to the detector definitions +## +## You can ready config/env.sh for more in-depth explanations of the variables +## and how they can be controlled. +source config/env.sh -pushd ${JUGGLER_DETECTOR} curl -o test_proton_dvcs_eic.hepmc "https://eicweb.phy.anl.gov/api/v4/projects/345/jobs/artifacts/master/raw/data/test_proton_dvcs_eic.hepmc?job=compile" if [[ "$?" -ne "0" ]] ; then @@ -42,33 +26,28 @@ if [[ "$?" -ne "0" ]] ; then exit 1 fi - ## run geant4 simulations npsim --runType batch \ --part.minimalKineticEnergy 1000*GeV \ - -v WARNING \ + -v ERROR \ --numberOfEvents ${JUGGLER_N_EVENTS} \ - --compactFile ${JUGGLER_DETECTOR}.xml \ + --compactFile ${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml \ --inputFiles test_proton_dvcs_eic.hepmc \ --outputFile ${JUGGLER_SIM_FILE} if [[ "$?" -ne "0" ]] ; then - echo "ERROR running script" + echo "ERROR running npsim" exit 1 fi # Need to figure out how to pass file name to juggler from the commandline xenv -x ${JUGGLER_INSTALL_PREFIX}/Juggler.xenv \ - gaudirun.py ../options/tracker_reconstruction.py + gaudirun.py options/tracker_reconstruction.py if [[ "$?" -ne "0" ]] ; then echo "ERROR running juggler" exit 1 fi -ls -l -popd -pwd mkdir -p results/dvcs - echo "STAND-IN FOR ANALYSIS SCRIPT" #root -b -q "dis/scripts/rec_dis_electrons.cxx(\"${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE}\")" #if [[ "$?" -ne "0" ]] ; then @@ -76,7 +55,16 @@ echo "STAND-IN FOR ANALYSIS SCRIPT" # exit 1 #fi +# copy data if it is not too big if [[ "${JUGGLER_N_EVENTS}" -lt "500" ]] ; then -cp ${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE} results/dvcs/. +cp ${JUGGLER_REC_FILE} results/dvcs/. fi +# Collect the results +cp dvcs/report.xml results/dvcs/. +cp dvcs/report2.xml results/dvcs/. + + + + + diff --git a/dvcs/report.xml b/dvcs/report.xml new file mode 100644 index 00000000..2ba9c6e4 --- /dev/null +++ b/dvcs/report.xml @@ -0,0 +1,10 @@ +<testsuites> + <testsuite name="DVCS" tests="3" failures="1"> + <testcase classname="foo1" name="ASuccessfulTest" time="10.0"/> + <testcase classname="foo2" name="AnotherSuccessfulTest" time="20.0"/> + <testcase classname="foo3" name="AFailingTest" time="30.0"> + <failure type="NotEnoughFoo"> details about failure </failure> + </testcase> + </testsuite> +</testsuites> + diff --git a/dvcs/report2.xml b/dvcs/report2.xml new file mode 100644 index 00000000..f437ef44 --- /dev/null +++ b/dvcs/report2.xml @@ -0,0 +1,12 @@ +<testsuite tests="3"> + <testcase time="1.00" classname="bar1" name="ASuccessfulTest2"/> + <testcase time="2.00" classname="bar2" name="AnotherSuccessfulTest2"> + <!-- + <system-out>[[ATTACHMENT|/absolute/path/to/some/file]]</system-out> + --> + </testcase> + <testcase time="3.00" classname="bar3" name="AFailingTest2"> + <failure type="NotEnoughFoo"> MORE details about failure </failure> + </testcase> +</testsuite> + diff --git a/options/tracker_reconstruction.py b/options/tracker_reconstruction.py index a3bc67cb..bcaa986e 100644 --- a/options/tracker_reconstruction.py +++ b/options/tracker_reconstruction.py @@ -12,7 +12,10 @@ if "JUGGLER_DETECTOR" in os.environ : input_sim_file = str(os.environ["JUGGLER_SIM_FILE"]) output_rec_file = str(os.environ["JUGGLER_REC_FILE"]) n_events = str(os.environ["JUGGLER_N_EVENTS"]) -detector_path = str(os.environ["JUGGLER_DETECTOR_PATH"]) + +detector_path = detector_name +if "DETECTOR_PATH" in os.environ : + detector_path = str(os.environ["DETECTOR_PATH"]) geo_service = GeoSvc("GeoSvc", detectors=["{}/{}.xml".format(detector_path, detector_name)]) @@ -205,3 +208,4 @@ ApplicationMgr( OutputLevel=DEBUG ) + -- GitLab