nils-braun / b2luigi

Task scheduling and batch running for basf2 jobs made simple
GNU General Public License v3.0
17 stars 11 forks source link

Gbasf2: Set default install directory (or `setup` script) to latest version on CVMFS #125

Closed meliache closed 3 years ago

meliache commented 3 years ago

Before gbasf2 cli or python interface can be used, the user has to source a setup script in the gbasf2 install directory, which sets different environment variables.

In the get_gbasf2_env function, I therefore use the b2luigi setting gbasf2_install_directory, which should be the path to the directory where gbasf2 is installed. The default was ~/gbasf2KEK, which was the install path used in the previous installation instructions. The get_gbasf2_env functions then joins this directory with the sub-path BelleDIRAC/gbasf2/tools/setup to get the full path to the setup file to be sourced.

However, since recently, gbasf2 is available on CVMFS, which is the recommended way to use it. On CVMFS, there are different gbasf2 install directories for different gbasf2 releases, e.g. to use the current release v5r1p3, the user can set in their settings.json the setting:

"gbasf2_install_directory": "/cvmfs/belle.kek.jp/grid/BelleDIRAC/Belle-BNL-Certification.v5r1p3"

However, it would be useful to have a default location which always points to the latest release. For that, there is already a symlink on CVMFS. The only "problem" is that it points to a subdirectory of what gbasf2 assumes to be the gbasf2_install_directory:

/cvmfs/belle.kek.jp/grid/gbasf2/pro → /cvmfs/belle.kek.jp/grid/BelleDIRAC/Belle-KEK.v5r1p3/BelleDIRAC/gbasf2 

I am considering setting the default gbasf2_install_directory to the real parent of that, i.e. to

os.path.realpath(os.path.join("/cvmfs/belle.kek.jp/grid/gbasf2/pro", os.pardir))

However, I am not sure how stable that symlink is, hopefully it is stable.

Since we don't need any other files from the gbasf2 install directory except the location of the setup script, in retrospect I think it was a mistake to make the setting point to the install directory, it would be better to have it point to the setup script. Otherwise, the function get_gbasf2_env might break if the location of the setup script within the install directory changes in the future. But now it's late. Maybe I could add a gbasf2_setup_path setting and add a DeprecationWarning when the install directory setting is used. Not sure about that though.