Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions scripts/smart-dispatch
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ from smartdispatch.filelock import open_with_lock
import logging
import smartdispatch

# For cluster job_id mismatch
import re

LOGS_FOLDERNAME = "SMART_DISPATCH_LOGS"
CLUSTER_NAME = utils.detect_cluster()
AVAILABLE_QUEUES = get_available_queues(CLUSTER_NAME)
Expand Down Expand Up @@ -138,6 +141,14 @@ def main():
qsub_output = check_output('{launcher} {pbs_filename}'.format(launcher=LAUNCHER if args.launcher is None else args.launcher, pbs_filename=pbs_filename), shell=True)
jobs_id += [qsub_output.strip()]

# On some clusters, SRMJID and PBS_JOBID don't match
if CLUSTER_NAME in ['helios']:
qstat_out = check_output(['qstat', '-f']).split('Job Id: ')
for job in qstat_out:
if re.search(r"SRMJID:{job_id}".format(job_id=jobs_id[-1]), job):
pbs_job_id = re.match(r"[0-9a-zA-Z.-]*", job).group()
jobs_id[-1] = '{pbs}'.format(pbs=pbs_job_id)

with open_with_lock(pjoin(path_job, "jobs_id.txt"), 'a') as jobs_id_file:
jobs_id_file.writelines(t.strftime("## %Y-%m-%d %H:%M:%S ##\n"))
jobs_id_file.writelines("\n".join(jobs_id) + "\n")
Expand Down