Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ EXTRA_DIST = acinclude.m4 \
autogen.sh \
CHANGELOG \
configure.ac \
cov_file_results.pl \
cov_file_results.py \
Doxyfile \
INSTALL \
INSTALL.GNU \
Makefile.am \
parse_cov_results.pl \
parse_cov_results.py \
PBS_License.txt \
README.array_changes \
README.coding_notes \
Expand All @@ -23,7 +23,7 @@ EXTRA_DIST = acinclude.m4 \
README.trqauthd \
README.building_40 \
Release_Notes \
run_report.pl \
run_report.py \
torque.setup \
torque.spec \
buildutils/config.mk \
Expand Down
67 changes: 36 additions & 31 deletions src/server/job_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ extern char *msg_err_noqueue;
extern int LOGLEVEL;
extern pthread_mutex_t *reroute_job_mutex;

int route_retry_interval = 5; /* time in seconds to check routing queues */

/*
* Add an entry to the list of bad destinations for a job.
*
Expand Down Expand Up @@ -533,43 +535,46 @@ void *queue_route(
return(NULL);
}

if (LOGLEVEL >= 7)
{
snprintf(log_buf, sizeof(log_buf), "queue name: %s", queue_name);
log_event(PBSEVENT_SYSTEM, PBS_EVENTCLASS_QUEUE, __func__, log_buf);
}

pthread_mutex_lock(reroute_job_mutex);

pque = find_queuebyname(queue_name);
if (pque == NULL)
while (1)
{
sprintf(log_buf, "Could not find queue %s", queue_name);
log_err(-1, __func__, log_buf);
free(queue_name);
pthread_mutex_unlock(reroute_job_mutex);
return(NULL);
}
if (LOGLEVEL >= 7)
{
snprintf(log_buf, sizeof(log_buf), "queue name: %s", queue_name);
log_event(PBSEVENT_SYSTEM, PBS_EVENTCLASS_QUEUE, __func__, log_buf);
}

pque = find_queuebyname(queue_name);
if (pque == NULL)
{
sprintf(log_buf, "Could not find queue %s", queue_name);
log_err(-1, __func__, log_buf);
free(queue_name);
pthread_mutex_unlock(reroute_job_mutex);
return(NULL);
}

while ((pjob = next_job(pque->qu_jobs,&iter)) != NULL)
{
/* the second condition says we only want to try if routing
* has been tried once - this is to let req_commit have the
* first crack at routing always */
unlock_queue(pque, __func__, (char *)NULL, 0);
if ((pjob->ji_qs.ji_un.ji_routet.ji_rteretry <= time_now - ROUTE_RETRY_TIME) &&
(pjob->ji_qs.ji_un.ji_routet.ji_rteretry != 0))
pthread_mutex_lock(reroute_job_mutex);
while ((pjob = next_job(pque->qu_jobs,&iter)) != NULL)
{
reroute_job(pjob, pque);
unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL);
/* the second condition says we only want to try if routing
* has been tried once - this is to let req_commit have the
* first crack at routing always */
unlock_queue(pque, __func__, (char *)NULL, 0);
if ((pjob->ji_qs.ji_un.ji_routet.ji_rteretry <= time_now - ROUTE_RETRY_TIME) &&
(pjob->ji_qs.ji_un.ji_routet.ji_rteretry != 0))
{
reroute_job(pjob, pque);
unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL);
}
else
unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL);
}
else
unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL);
}

unlock_queue(pque, __func__, (char *)NULL, 0);
pthread_mutex_unlock(reroute_job_mutex);
sleep(route_retry_interval);
}
free(queue_name);
unlock_queue(pque, __func__, (char *)NULL, 0);
pthread_mutex_unlock(reroute_job_mutex);
return(NULL);
} /* END queue_route() */

Expand Down
17 changes: 6 additions & 11 deletions src/server/pbsd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ int queue_rank = 0;
int a_opt_init = -1;
int wait_for_moms_hierarchy = FALSE;

int route_retry_interval = 5; /* time in seconds to check routing queues */
/* HA global data items */
long HALockCheckTime = 0;
long HALockUpdateTime = 0;
Expand Down Expand Up @@ -1158,19 +1157,15 @@ void *handle_queue_routing_retries(
char *queuename;
int iter = -1;

while(1)
while ((pque = next_queue(&svr_queues, &iter)) != NULL)
{
sleep(route_retry_interval);
while ((pque = next_queue(&svr_queues, &iter)) != NULL)
if (pque->qu_qs.qu_type == QTYPE_RoutePush)
{
if (pque->qu_qs.qu_type == QTYPE_RoutePush)
{
queuename = strdup(pque->qu_qs.qu_name); /* make sure this gets freed inside queue_route */
enqueue_threadpool_request(queue_route, queuename);
}

unlock_queue(pque, __func__, (char *)NULL, 0);
queuename = strdup(pque->qu_qs.qu_name); /* make sure this gets freed inside queue_route */
enqueue_threadpool_request(queue_route, queuename);
}

unlock_queue(pque, __func__, (char *)NULL, 0);
}

return(NULL);
Expand Down