PBS Server is restarting Python interpreter too often

Description

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.
This function:
def countJobs(username,queue,breakpoint):
Count user jobs in job destination queue
jobs_Q=0
jobs_R=0
JOB_STATE_RUNNING=str(pbs.JOB_STATE_RUNNING)
JOB_STATE_QUEUED=str(pbs.JOB_STATE_QUEUED)
for job in queue.jobs():
if username == job.Job_Owner.split('@')[0] :
if str(job.job_state) == JOB_STATE_RUNNING :
jobs_R+=1
elif str(job.job_state) == JOB_STATE_QUEUED :
jobs_Q+=1
Break is we are over TheLimit
if jobs_Q > breakpoint:
break
return(jobs_Q, jobs_R)
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?

Acceptance Criteria

None

Status

Assignee

Suresh Thelkar

Reporter

Suresh Thelkar

Severity

None

OS

None

Start Date

None

Pull Request URL

None

Story Points

1

Components

Priority

Highest
Configure