Running athena in swan? ATLAS software/Swan

Hello,

I am trying to make a simple example of running the atlas software framework athena.

There are many things not working, but, as a start, I have the impression that part of the problem is a mismatch between the releases I can get in swan (LCG_106a) and the one attached to the athena version I am trying to run (LCG_106b_ATLAS_1). Also, it is not clear how to make sure that the environment set up by athena is actually picked up by the python environment of swan.

Any tips?

Dabbling in the dark arts again Denis :stuck_out_tongue:
So I figured out the correct incantations, I’ll share them with you here. I’m always worried something will happen to make this spell stop working, so would appreciate any more robust support for this functionality from the SWAN team.

  1. Determine the “site-packages” path for the LCG release you will be setting up on SWAN. The default currently is 109; I setup a SWAN session and look at $PYTHONPATH to extract the path, which is: /cvmfs/sft.cern.ch/lcg/views/LCG_109_swan/x86_64-el9-gcc13-opt/lib/python3.13/site-packages
  2. Prepare a shell script with the following content:
unset PYTHONHOME
unset PYTHONPATH
unset ROOTSYS
unset CPPYY_BACKEND_LIBRARY
export ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase
source ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh
asetup Athena,main,latest
export JUPYTER_PATH=$ROOTSYS/etc/notebook
export PYTHONPATH=/cvmfs/sft.cern.ch/lcg/views/LCG_109_swan/x86_64-el9-gcc13-opt/lib/python3.13/site-packages:$PYTHONPATH

in the last line, that’s where the path you determined in step 1 is put. This is necessary so that jupyter can still function after the asetup call.

  1. Start a new session in SWAN using your shell script for the “Environment Script” in the setup page.
  2. If all goes well, you will find you Athena functionality inside notebooks now (not guaranteeing everything works, but works for quite a lot of stuff … also be patient on the first import ROOT call while it caches everything from cvmfs) :

I never stopped using and developing. I want to do that in a notebook.

I assume the real secret is in the unsetting thing. This is great.

Thanks!

That said.. I just tried your solution. It seems like it blocks from running. even a simple command such as print(“something”) blocks. I am using a fixed release (Athena,24.0.140)

Well.. With that release, it starts to work, but it fails in another thing. I will try with another Athena,LCG combination.

I tried swapping latest,main to 24.0.140 like you suggest and indeed it doesn’t work. It doesn’t block … the kernal actually dies. Clues about what is incompatible here can come from running commands like jupyter notebook on the terminal in the swan session. E.g. with latest,main I dont see an import errors, but I do get import errors with 24.0.140 and hence the notebook will just die.

Figuring out what is incompatible can be a real pain though.

Can you not use main branch, since it seems compatible?

In the end it worked with 24.0.140 and LCG_6a.. So.. I am happy now.. I am trying to run the upgraded DarkAlgo algorithm together with athena…

Actually.. I take a step back..

It only works perfectly with the LCG109 and Athena,main,latest. I am running with this and that is ok. But, I wonder why LCG106b_ATLAS_1 is not one of the possible LCG “flavours” available in Swan? Also, it would be great to have a variable in Swan itself for the special path you add to the PYTHONPATH to facilitate that re-insertion of the variable (in an automatic manner). Also, I added the script with a configurable parameter for the athena release. The swan interface does not accept that (something like $CERNBOX_HOME/hltcalo_analysismacros/scripts/AthenaSetupInSwan.sh Athena,main,latest). Maybe it would be an interesting addition too.