diff --git a/tasks/build.py b/tasks/build.py index 0767366d..dafb29d1 100644 --- a/tasks/build.py +++ b/tasks/build.py @@ -24,6 +24,7 @@ BUILDENV = "buildenv" BUILD_JOB_SCRIPT = "build_job_script" +DEFAULT_JOB_TIME_LIMIT = "24:00:00" CVMFS_CUSTOMIZATIONS = "cvmfs_customizations" HTTP_PROXY = "http_proxy" HTTPS_PROXY = "https_proxy" @@ -264,13 +265,21 @@ def submit_job(job, submitted_jobs, build_env_cfg, ym, pr_id): - job_id(string): job_id of submitted job - symlink(string): symlink from main pr_ dir to job dir (job[0]) """ - # determine CPU target to use: job.arch_target, but without the linux/ part cpu_target = '/'.join(job.arch_target.split('/')[1:]) + # Add a default time limit of 24h to the command if nothing else is specified by the user + all_opts_str = " ".join([build_env_cfg[SLURM_PARAMS], job.slurm_opts]) + all_opts_list = all_opts_str.split(" ") + if any([(opt.startswith("--time") or opt.startswith("-t")) for opt in all_opts_list]): + time_limit = "" + else: + time_limit = f"--time={DEFAULT_JOB_TIME_LIMIT}" + command_line = ' '.join([ build_env_cfg[SUBMIT_COMMAND], build_env_cfg[SLURM_PARAMS], + time_limit, job.slurm_opts, # set $CPU_TARGET in job environment, which can be picked up by build job script; '--export=ALL,CPU_TARGET=%s' % cpu_target,