Due to a pbs_sched performance issue we wrote a hook to dynamically set max_queued limits but hit a performance issue within pbs_server.
Count user jobs in job destination queue
for job in queue.jobs():
if username == job.Job_Owner.split('@') :
if str(job.job_state) == JOB_STATE_RUNNING :
elif str(job.job_state) == JOB_STATE_QUEUED :
Break is we are over TheLimit
if jobs_Q > breakpoint:
Takes long because of a long job history that causes the iteration on "pbs.event().job.queue.jobs()" to trigger the Python interpreter restart.
As we need to find all of this user jobs there really seems to be no way around to iterate on all of the user's jobs.
How could we make the function be smoother and not trigger the Python interpreter restart?