Skip to content

Commit

Permalink
make it configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
smoors committed Sep 3, 2024
1 parent 99f42b1 commit 4517ab2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
3 changes: 3 additions & 0 deletions app.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ build_permission =
# template for comment when user who set a label has no permission to trigger build jobs
no_build_permission_comment = Label `bot:build` has been set by user `{build_labeler}`, but this person does not have permission to trigger builds

# whether or not to allow updating the submit options via custom module det_submit_opts
allow_update_submit_opts = false


[deploycfg]
# script for uploading built software packages
Expand Down
1 change: 1 addition & 0 deletions eessi_bot_event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
config.BOT_CONTROL_SETTING_COMMAND_PERMISSION, # required
config.BOT_CONTROL_SETTING_COMMAND_RESPONSE_FMT], # required
config.SECTION_BUILDENV: [
# config.BUILDENV_SETTING_ALLOW_UPDATE_SUBMIT_OPTS # optional
config.BUILDENV_SETTING_BUILD_JOB_SCRIPT, # required
config.BUILDENV_SETTING_BUILD_LOGS_DIR, # optional+recommended
config.BUILDENV_SETTING_BUILD_PERMISSION, # optional+recommended
Expand Down
18 changes: 11 additions & 7 deletions tasks/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,15 +658,19 @@ def submit_job(job, cfg):
else:
time_limit = f"--time={DEFAULT_JOB_TIME_LIMIT}"

# update job.slurm_opts with det_submit_opts(job) in det_submit_opts.py if available
# update job.slurm_opts with det_submit_opts(job) in det_submit_opts.py if allowed and available
do_update_slurm_opts = False
sys.path.append(job.working_dir)
allow_update_slurm_opts = cfg[config.SECTION_BUILDENV].getboolean(config.BUILDENV_SETTING_ALLOW_UPDATE_SUBMIT_OPTS)

try:
from det_submit_opts import det_submit_opts # pylint:disable=import-outside-toplevel
do_update_slurm_opts = True
except ImportError:
log(f"{fn}(): not updating job.slurm_opts: cannot import function det_submit_opts from module det_submit_opts")
if allow_update_slurm_opts:
sys.path.append(job.working_dir)

try:
from det_submit_opts import det_submit_opts # pylint:disable=import-outside-toplevel
do_update_slurm_opts = True
except ImportError:
log(f"{fn}(): not updating job.slurm_opts: "
"cannot import function det_submit_opts from module det_submit_opts")

if do_update_slurm_opts:
job = job._replace(slurm_opts=det_submit_opts(job))
Expand Down
1 change: 1 addition & 0 deletions tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
BOT_CONTROL_SETTING_COMMAND_RESPONSE_FMT = 'command_response_fmt'

SECTION_BUILDENV = 'buildenv'
BUILDENV_SETTING_ALLOW_UPDATE_SUBMIT_OPTS = 'allow_update_submit_opts'
BUILDENV_SETTING_BUILD_JOB_SCRIPT = 'build_job_script'
BUILDENV_SETTING_BUILD_LOGS_DIR = 'build_logs_dir'
BUILDENV_SETTING_BUILD_PERMISSION = 'build_permission'
Expand Down

0 comments on commit 4517ab2

Please sign in to comment.