Skip to content

Commit

Permalink
Set the job's priority based on the number of cores requested (#49)
Browse files Browse the repository at this point in the history
Avoid this kind of job to suffer from big delays if several MC validation jobs are in the queue.
  • Loading branch information
ggonzr authored Jul 17, 2024
1 parent f3b97f7 commit f6dd503
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gridpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,16 @@ def prepare_script(self):

os.system(f"chmod a+x {script_path}")

def get_job_priority(self):
"""
Get the job's priority based on the
CPU cores requested.
"""
cores = self.get_cores()
if 1 <= cores <= 16:
return 3
return 0

def prepare_jds_file(self):
"""
Make condor job description file
Expand All @@ -545,6 +555,7 @@ def prepare_jds_file(self):
f"RequestDisk = {30 * DISK_FACTOR_KB_TO_GB}",
'requirements = (OpSysAndVer =?= "AlmaLinux9")',
f'+AccountingGroup = "{chosen_group}"',
f"+JobPrio = {self.get_job_priority()}",
# pylint: disable=line-too-long
"leave_in_queue = JobStatus == 4 && (CompletionDate =?= UNDEFINED || ((CurrentTime - CompletionDate) < 7200))",
"queue",
Expand Down

0 comments on commit f6dd503

Please sign in to comment.