From b439b685530062ac090366e11cd0cfd7404b0feb Mon Sep 17 00:00:00 2001 From: Ryan Hamel Date: Thu, 14 Nov 2019 17:08:18 -0500 Subject: [PATCH] Only unset (o)ther holdtype if the job was submitted with an after dependency --- .../pbspro/files/default/submit_hook.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/specs/default/chef/site-cookbooks/pbspro/files/default/submit_hook.py b/specs/default/chef/site-cookbooks/pbspro/files/default/submit_hook.py index 29df8af..d3590b2 100644 --- a/specs/default/chef/site-cookbooks/pbspro/files/default/submit_hook.py +++ b/specs/default/chef/site-cookbooks/pbspro/files/default/submit_hook.py @@ -100,6 +100,14 @@ def format_place(place_dict): QSTAT_EXE = os.path.join(pbs.pbs_conf['PBS_EXEC'], 'bin', 'qstat') QALTER_EXE = os.path.join(pbs.pbs_conf['PBS_EXEC'], 'bin', 'qalter') QRLS_EXE = os.path.join(pbs.pbs_conf['PBS_EXEC'], 'bin', 'qrls') +QHOLD_EXE = os.path.join(pbs.pbs_conf['PBS_EXEC'], 'bin', 'qhold') + + +def unset_hold_so(job_id, job): + if "depend" in job and not job["depend"].startswith("before"): + run_cmd([QRLS_EXE, "-h", "o", job_id]) + else: + run_cmd([QRLS_EXE, "-h", "so", job_id]) def periodic_release_hook(hook_config, e): @@ -135,8 +143,7 @@ def periodic_release_hook(hook_config, e): debug("Key: %s\nValue: %s" % (job_id, job)) if str(job["Resource_List"].get("ungrouped")).lower() == "true": debug("Skipping ungrouped job %s" % job_id) - qrls_cmd = [QRLS_EXE, "-h", "so", job_id] - run_cmd(qrls_cmd) + unset_hold_so(job_id, job) continue j_queue = job["queue"] @@ -212,8 +219,7 @@ def periodic_release_hook(hook_config, e): debug("stdout %s" % stdout) debug("Release the hold on job %s" % job_id) - qrls_cmd = [QRLS_EXE, "-h", "so", job_id] - run_cmd(qrls_cmd) + unset_hold_so(job_id, job) e.accept()