Skip to content

Commit

Permalink
More versions, use new location for release_setup.sh (#1426)
Browse files Browse the repository at this point in the history
* update to use /xAODAnaHelpers_setup.sh

* 114 fails

* allow for sample name custom configurations too
  • Loading branch information
kratsg authored Mar 24, 2020
1 parent 88e14f4 commit 9b6341f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ci/motd
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion ci/xAODAnaHelpers_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions python/cli_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions scripts/xAH_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9b6341f

Please sign in to comment.