Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to virtual environment with EasyBuild and build_tools #34

Merged
merged 4 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions bin/submit_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,27 @@
import sys

from vsc.utils import fancylogger
from vsc.utils.script_tools import SimpleOption
from vsc.utils.run import RunNoShell
from vsc.utils.script_tools import SimpleOption

from build_tools import hooks_hydra
from build_tools.clusters import ARCHS, PARTITIONS
from build_tools.filetools import APPS_BRUSSEL
from build_tools import hooks_hydra
from build_tools.hooks_hydra import (SUBDIR_MODULES_BWRAP, SUFFIX_MODULES_PATH, SUFFIX_MODULES_SYMLINK,
VALID_MODULES_SUBDIRS)
from build_tools.hooks_hydra import (
SUBDIR_MODULES_BWRAP,
SUFFIX_MODULES_PATH,
SUFFIX_MODULES_SYMLINK,
VALID_MODULES_SUBDIRS,
)
from build_tools.lmodtools import submit_lmod_cache_job
from build_tools.softinstall import mk_job_name, submit_build_job

logger = fancylogger.getLogger()
fancylogger.logToScreen(True)
fancylogger.setLogLevelInfo()

# repositories with easyconfigs
VSCSOFTSTACK_ROOT = os.path.expanduser("~/vsc-software-stack")
VSCSOFTSTACK_ROOT = os.path.join(os.path.dirname(os.getenv("VIRTUAL_ENV", "")), "vsc-software-stack")
EASYCONFIG_REPOS = [
# our site repo (https://github.com/vscentrum/vsc-software-stack/tree/site-vub)
os.path.join("site-vub", "easyconfigs"),
Expand All @@ -46,10 +53,6 @@
]
EASYBLOCK_REPO = os.path.join("site-vub", "easyblocks", "*", "*.py")

logger = fancylogger.getLogger()
fancylogger.logToScreen(True)
fancylogger.setLogLevelInfo()

DEFAULT_ARCHS = [arch for (arch, prop) in ARCHS.items() if prop['default']]
LOCAL_ARCH = os.getenv('VSC_ARCH_LOCAL', '') + os.getenv('VSC_ARCH_SUFFIX', '')
if LOCAL_ARCH not in ARCHS:
Expand Down Expand Up @@ -120,6 +123,13 @@ def main():
logger.error("No easyconfig is given...")
sys.exit(1)

if not os.path.isdir(VSCSOFTSTACK_ROOT):
logger.error(
f"Cannot locate 'vsc-software-stack' repo in: {VSCSOFTSTACK_ROOT} - "
"Please clone that repo in the parent folder of your virtual environment directory"
)
sys.exit(1)

easyconfig = ' '.join(opts.args)
job['easyconfig'] = easyconfig
logger.info("Preparing to install %s", easyconfig)
Expand Down
6 changes: 2 additions & 4 deletions src/build_tools/jobtemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,18 @@
#SBATCH --gpus-per-node=${gpus}
#SBATCH --partition=${partition}
test -n "$$PREFIX_EB" || { echo "ERROR: environment variable PREFIX_EB not set"; exit 1; }
# activate build_tools virtual environment
source "$$VSC_SCRATCH_VO_USER/EB4/eb4env/bin/activate"
# set environment
export BUILD_TOOLS_LOAD_DUMMY_MODULES=1
export LANG=${langcode}
export PATH=$$PREFIX_EB/easybuild-framework:$$PATH
export PYTHONPATH=$$PREFIX_EB/easybuild-easyconfigs:$$PREFIX_EB/easybuild-easyblocks:$$PREFIX_EB/easybuild-framework:$$PREFIX_EB/vsc-base/lib
SUBDIR_MODULES="modules"
SUBDIR_MODULES_BWRAP=".modules_bwrap"
SUFFIX_MODULES_PATH="collection"
SUFFIX_MODULES_SYMLINK="all"
# make build directory
if [ -z $$SLURM_JOB_ID ]; then
export TMPDIR=${tmp}/$$USER/
Expand Down
2 changes: 1 addition & 1 deletion src/build_tools/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@author: Alex Domingo (Vrije Universiteit Brussel)
"""

VERSION = '4.0.2'
VERSION = '4.0.3'

AUTHOR = {
'wp': 'Ward Poelmans',
Expand Down
6 changes: 2 additions & 4 deletions tests/input/build_job_01.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@
#SBATCH --gpus-per-node=0
#SBATCH --partition=skylake_mpi

test -n "$PREFIX_EB" || { echo "ERROR: environment variable PREFIX_EB not set"; exit 1; }
# activate build_tools virtual environment
source "$VSC_SCRATCH_VO_USER/EB4/eb4env/bin/activate"

# set environment
export BUILD_TOOLS_LOAD_DUMMY_MODULES=1
export LANG=C
export PATH=$PREFIX_EB/easybuild-framework:$PATH
export PYTHONPATH=$PREFIX_EB/easybuild-easyconfigs:$PREFIX_EB/easybuild-easyblocks:$PREFIX_EB/easybuild-framework:$PREFIX_EB/vsc-base/lib

SUBDIR_MODULES="modules"
SUBDIR_MODULES_BWRAP=".modules_bwrap"
SUFFIX_MODULES_PATH="collection"
SUFFIX_MODULES_SYMLINK="all"


# make build directory
if [ -z $SLURM_JOB_ID ]; then
export TMPDIR=/tmp/eb-test-build/$USER/
Expand Down
6 changes: 2 additions & 4 deletions tests/input/build_job_02.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@
#SBATCH --gpus-per-node=1
#SBATCH --partition=ampere_gpu

test -n "$PREFIX_EB" || { echo "ERROR: environment variable PREFIX_EB not set"; exit 1; }
# activate build_tools virtual environment
source "$VSC_SCRATCH_VO_USER/EB4/eb4env/bin/activate"

# set environment
export BUILD_TOOLS_LOAD_DUMMY_MODULES=1
export LANG=C
export PATH=$PREFIX_EB/easybuild-framework:$PATH
export PYTHONPATH=$PREFIX_EB/easybuild-easyconfigs:$PREFIX_EB/easybuild-easyblocks:$PREFIX_EB/easybuild-framework:$PREFIX_EB/vsc-base/lib

SUBDIR_MODULES="modules"
SUBDIR_MODULES_BWRAP=".modules_bwrap"
SUFFIX_MODULES_PATH="collection"
SUFFIX_MODULES_SYMLINK="all"


# make build directory
if [ -z $SLURM_JOB_ID ]; then
export TMPDIR=/tmp/eb-test-build/$USER/
Expand Down