i am trying to execute this hook , working for resubmission but can not take submit arguments in rerun job
import os
import pbs
import sys
import datetime
try:
# If the requestor is the scheduler, and where appropriate, the server or MoM,
# allow the action to take place
#if pbs.event().requestor in [“PBS_Server”, “Scheduler”, “pbs_mom”]:
# pbs.event().accept()
batchq = "parallel_q"
e = pbs.event()
j = e.job
estatus = pbs.event().job.Exit_status
workdir = e.job.Variable_List["PBS_O_WORKDIR"]
#pbs.event().job.rerun()
pbs.logmsg(pbs.LOG_DEBUG, "executing execjob epilogue hook")
pbs.logmsg(pbs.LOG_DEBUG, "job status = %s" % (estatus))
pbs.logmsg(pbs.LOG_DEBUG, "Job working directory = %s" % (workdir))
file = os.path.join(workdir , "_hpc_job_requeue")
exists = os.path.isfile(file)
if exists:
pbs.logmsg(pbs.LOG_DEBUG, "file _hpc_job_requeue found in job working directory")
timediff = datetime.datetime.now() + datetime.timedelta(minutes = 3)
pass_args = timediff.strftime("%H%M")
pbs.event().job.Submit_arguments = '-a pass_args'
pbs.logmsg(pbs.LOG_DEBUG, "Time to resubmit job %s " % (pass_args))
pbs.event().job.rerun()
pbs.logmsg(pbs.LOG_DEBUG, "Job Id %s resubmited" % (j.id))
os.remove(file)
pbs.logmsg(pbs.LOG_DEBUG, "File _pbs_requeue deleted")
# Store configuration file values
else:
# Keep presets
pbs.logmsg(pbs.LOG_DEBUG, "file _pbs_requeue not found")
except SystemExit:
pass