From 9b6341f7626777f2d800172537a96c9cb3ba52d2 Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Tue, 24 Mar 2020 14:55:37 -0700 Subject: [PATCH] More versions, use new location for release_setup.sh (#1426) * update to use /xAODAnaHelpers_setup.sh * 114 fails * allow for sample name custom configurations too --- .github/workflows/ci.yml | 7 ++++++- Dockerfile | 6 +++--- ci/motd | 4 ++-- ci/xAODAnaHelpers_setup.sh | 2 +- python/cli_options.py | 6 ++++++ scripts/xAH_run.py | 9 +++++++++ 6 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6a945b997..bfc3d85910 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,11 @@ jobs: - 21.2.106 - 21.2.107 - 21.2.108 + - 21.2.109 + - 21.2.110 + - 21.2.111 + - 21.2.112 + - 21.2.113 steps: - uses: actions/checkout@master @@ -53,7 +58,7 @@ jobs: docker run --rm ${DOCKER_TARGET_REPO}/${RELEASE_TYPE}:${RELEASE_VERSION}-latest /bin/bash -c "source ~/.bashrc" - name: "test xAH_run.py on ${{ env['DOCKER_TARGET_REPO'] }}/${{ env['RELEASE_TYPE'] }}:${{ env['RELEASE_VERSION'] }}" run: | - docker run --rm ${DOCKER_TARGET_REPO}/${RELEASE_TYPE}:${RELEASE_VERSION}-latest /bin/bash -c 'source xAODAnaHelpers_setup.sh; xAH_run.py -h' + docker run --rm ${DOCKER_TARGET_REPO}/${RELEASE_TYPE}:${RELEASE_VERSION}-latest /bin/bash -c 'source /xAODAnaHelpers_setup.sh; xAH_run.py -h' - name: timestamp the image run: | docker tag ${DOCKER_TARGET_REPO}/${RELEASE_TYPE}:${RELEASE_VERSION}-latest ${DOCKER_TARGET_REPO}/${RELEASE_TYPE}:${RELEASE_VERSION}-${GITHUB_SHA::6}-$(date +%Y%m%d) diff --git a/Dockerfile b/Dockerfile index 4b20fb983f..6dff2f7858 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ COPY ci/.rpmmacros /root/.rpmmacros # Use our MOTD (Message-of-the-Day) COPY ci/motd /etc/motd # Copy the environemnt setup script for xAH -COPY ci/xAODAnaHelpers_setup.sh /home/atlas/xAODAnaHelpers_setup.sh +COPY ci/xAODAnaHelpers_setup.sh /xAODAnaHelpers_setup.sh ### RUN COMMANDS HERE (AS ROOT) ### # Switch to ROOT user for now @@ -38,7 +38,7 @@ USER root # 6. Call the environment setup script in .bashrc RUN export RELEASE_TYPE=$([ "$DOCKER_IMG" == "analysisbase" ] && echo "AnalysisBase" || echo "AnalysisTop") \ && envsubst '\$RELEASE_TYPE' < /workarea/src/CMakeLists.txt.tmp > /workarea/src/CMakeLists.txt \ - && source /home/atlas/release_setup.sh \ + && source /release_setup.sh \ && mkdir -p /workarea/build \ && cd /workarea/build \ && time cmake ../src \ @@ -47,7 +47,7 @@ RUN export RELEASE_TYPE=$([ "$DOCKER_IMG" == "analysisbase" ] && echo "AnalysisB && rpm -i /workarea/build/*_*.rpm \ && rm -rf /workarea \ && echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' >> /home/atlas/.bashrc \ - && echo 'source $HOME/xAODAnaHelpers_setup.sh' >> /home/atlas/.bashrc + && echo 'source /xAODAnaHelpers_setup.sh' >> /home/atlas/.bashrc # set TMPDIR back ENV TMPDIR=/tmp diff --git a/ci/motd b/ci/motd index b08247b85a..b7fe4109a2 100644 --- a/ci/motd +++ b/ci/motd @@ -21,9 +21,9 @@ base release as well as xAODAnaHelpers. View our online documentation here: To set up xAODAnaHelpers + the analysis release of the image, please execute: - source /home/atlas/xAODAnaHelpers_setup.sh + source /xAODAnaHelpers_setup.sh To set up *only* the analysis release of the image, please execute: - source /home/atlas/release_setup.sh + source /release_setup.sh diff --git a/ci/xAODAnaHelpers_setup.sh b/ci/xAODAnaHelpers_setup.sh index e874e2f15c..5093881073 100644 --- a/ci/xAODAnaHelpers_setup.sh +++ b/ci/xAODAnaHelpers_setup.sh @@ -3,7 +3,7 @@ # Environment configuration file setting up the installed xAODAnaHelpers project. # Set up the base environment using the base image's setup script: -source /home/atlas/release_setup.sh +source /release_setup.sh # Set up the xAODAnaHelpers installation: source /usr/xAODAnaHelpers/*/InstallArea/*/setup.sh diff --git a/python/cli_options.py b/python/cli_options.py index ab91194dc3..860e312a41 100755 --- a/python/cli_options.py +++ b/python/cli_options.py @@ -115,6 +115,12 @@ "default": False, "help": "If enabled, will variable usage statistics.", }, + "sample-names": { + "help": "Specify the sample names for the input files if you need to change them from the default.", + "type": str, + "nargs": "+", + "default": [], + }, } # These are handled by xAH_run.py at the top level instead of down by drivers diff --git a/scripts/xAH_run.py b/scripts/xAH_run.py index 4751e4d624..d17d2574fb 100755 --- a/scripts/xAH_run.py +++ b/scripts/xAH_run.py @@ -364,6 +364,15 @@ def __call__(self, parser, namespace, values, option_string=None): sh_list = ROOT.SH.DiskListLocal(mother_dir) ROOT.SH.scanDir(sh_all, sh_list, fname_base, os.path.basename(sample_dir)) + # do we need to overwrite sample names? + if args.sample_names: + if len(args.sample_names) != len(sh_all): + raise ValueError("You specified to override the names of {0:d} samples, but we found {1:d} samples".format(len(args.sample_names), len(sh_all))) + else: + for sampleName, sample in zip(args.sample_names, sh_all): + MBJ_logger.info(" - changing sample name from {0:s} to {1:s}".format(sample.meta().getString(ROOT.SH.MetaFields.sampleName), sampleName)) + sample.meta().setString(ROOT.SH.MetaFields.sampleName, sampleName) + # print out the samples we found xAH_logger.info("\t%d different dataset(s) found", len(sh_all)) #if not args.use_scanRucio: