From c2cc28721b9c7dd948df627c9f3c1ee3b6d8660e Mon Sep 17 00:00:00 2001 From: Jonas Qvigstad Date: Tue, 28 Feb 2023 20:01:34 +0100 Subject: [PATCH 1/6] Added 24h default time limit --- tasks/build.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tasks/build.py b/tasks/build.py index 0767366d..1f3ebaaf 100644 --- a/tasks/build.py +++ b/tasks/build.py @@ -265,12 +265,19 @@ def submit_job(job, submitted_jobs, build_env_cfg, ym, pr_id): - symlink(string): symlink from main pr_ dir to job dir (job[0]) """ + # Add a default time limit of 24h to the command if nothing else is specified by the user + if "--time=" not in build_env_cfg[SLURM_PARAMS]: + time_limit= "--time=24:00:00" + else: + time_limit = "" + # determine CPU target to use: job.arch_target, but without the linux/ part cpu_target = '/'.join(job.arch_target.split('/')[1:]) 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, From e9169f4a0cd2426fd6c1eda537a29e6af5eac64f Mon Sep 17 00:00:00 2001 From: Jonas Qvigstad Date: Tue, 28 Feb 2023 20:13:47 +0100 Subject: [PATCH 2/6] Fixed whitespace to be pep8 compliant --- tasks/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/build.py b/tasks/build.py index 1f3ebaaf..1920d25f 100644 --- a/tasks/build.py +++ b/tasks/build.py @@ -267,7 +267,7 @@ def submit_job(job, submitted_jobs, build_env_cfg, ym, pr_id): # Add a default time limit of 24h to the command if nothing else is specified by the user if "--time=" not in build_env_cfg[SLURM_PARAMS]: - time_limit= "--time=24:00:00" + time_limit = "--time=24:00:00" else: time_limit = "" From 78ecdb858fa352e12455cc119cdb4198b6cf40af Mon Sep 17 00:00:00 2001 From: Jonas Qvigstad Date: Mon, 6 Mar 2023 15:47:38 +0100 Subject: [PATCH 3/6] Added checks for short and long form of time flag --- tasks/build.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tasks/build.py b/tasks/build.py index 1920d25f..659b0eb0 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,15 +265,15 @@ 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 - if "--time=" not in build_env_cfg[SLURM_PARAMS]: - time_limit = "--time=24:00:00" - else: + all_opts = " ".join([build_env_cfg[SLURM_PARAMS], job.slurm_opts, '--export=ALL,CPU_TARGET=%s' % cpu_target]) + if ("--time" in all_opts) or ("-t" in all_opts): time_limit = "" - - # determine CPU target to use: job.arch_target, but without the linux/ part - cpu_target = '/'.join(job.arch_target.split('/')[1:]) + else: + time_limit = f"--time={DEFAULT_JOB_TIME_LIMIT}" command_line = ' '.join([ build_env_cfg[SUBMIT_COMMAND], From 2e2abc98f3dc67b33bfc1b51a2eb06ad0636f26d Mon Sep 17 00:00:00 2001 From: Jonas Qvigstad Date: Mon, 6 Mar 2023 15:50:28 +0100 Subject: [PATCH 4/6] Added whitespace around operator --- tasks/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/build.py b/tasks/build.py index 659b0eb0..ca969ab8 100644 --- a/tasks/build.py +++ b/tasks/build.py @@ -24,7 +24,7 @@ BUILDENV = "buildenv" BUILD_JOB_SCRIPT = "build_job_script" -DEFAULT_JOB_TIME_LIMIT="24:00:00" +DEFAULT_JOB_TIME_LIMIT = "24:00:00" CVMFS_CUSTOMIZATIONS = "cvmfs_customizations" HTTP_PROXY = "http_proxy" HTTPS_PROXY = "https_proxy" From 3fbc97a26e14298e47c997a173fa047d929c2e67 Mon Sep 17 00:00:00 2001 From: Jonas Qvigstad Date: Thu, 9 Mar 2023 17:25:56 +0100 Subject: [PATCH 5/6] Catching more cases in the time limit check --- tasks/build.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasks/build.py b/tasks/build.py index ca969ab8..b61640be 100644 --- a/tasks/build.py +++ b/tasks/build.py @@ -269,8 +269,9 @@ def submit_job(job, submitted_jobs, build_env_cfg, ym, pr_id): 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 = " ".join([build_env_cfg[SLURM_PARAMS], job.slurm_opts, '--export=ALL,CPU_TARGET=%s' % cpu_target]) - if ("--time" in all_opts) or ("-t" in all_opts): + all_opts_str = " ".join([build_env_cfg[SLURM_PARAMS], job.slurm_opts, '--export=ALL,CPU_TARGET=%s' % cpu_target]) + 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}" From 8bf9b1a2f1844a76567e1f02c416894566834b02 Mon Sep 17 00:00:00 2001 From: Jonas Qvigstad Date: Fri, 10 Mar 2023 10:51:28 +0100 Subject: [PATCH 6/6] Code polishing --- tasks/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/build.py b/tasks/build.py index b61640be..dafb29d1 100644 --- a/tasks/build.py +++ b/tasks/build.py @@ -269,7 +269,7 @@ def submit_job(job, submitted_jobs, build_env_cfg, ym, pr_id): 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, '--export=ALL,CPU_TARGET=%s' % cpu_target]) + 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 = ""