Skip to content

Commit d78f7e2

Browse files
author
Joachim Gabler
committed
added workaround for CS-1597 to issue_1941 test
1 parent 7c669e7 commit d78f7e2

File tree

3 files changed

+41
-12
lines changed

3 files changed

+41
-12
lines changed

src/checktree/bugs/issuezilla/1741/check.exp

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,14 @@ proc issue_check_unsuspended_queue {} {
302302
wait_for_load_from_all_queues
303303

304304
# check queue state of b.q
305-
set state [get_queue_state $bq]
306-
if {$state != ""} {
307-
ts_log_severe "Queue b.q is not in state running, it is in state $state"
305+
# @todo CS-1597 load values are spooled, so wait_for_load_from_all_queues returned immediately
306+
if {0} {
307+
set state [get_queue_state $bq]
308+
if {$state != ""} {
309+
ts_log_severe "Queue b.q is not in state running, it is in state $state"
310+
}
311+
} else {
312+
wait_for_queue_state $bq "" 60
308313
}
309314

310315
# check state state of job
@@ -367,15 +372,25 @@ proc issue_check_unsuspended_queue_with_more_slots {} {
367372
wait_for_load_from_all_queues
368373

369374
# check queue state of b.q
370-
set state [get_queue_state $bq]
371-
if {$state != ""} {
372-
ts_log_severe "Queue b.q is not in state running, it is in state $state"
375+
# @todo CS-1597 load values are spooled, so wait_for_load_from_all_queues returned immediately
376+
if {0} {
377+
set state [get_queue_state $bq qstat_output]
378+
if {$state != ""} {
379+
ts_log_severe "Queue b.q is not in state running, it is in state $state\n$qstat_output"
380+
}
381+
} else {
382+
wait_for_queue_state $bq "" 60
373383
}
374384

375385
# check queue state of a.q
376-
set state [get_queue_state $aq]
377-
if {$state != ""} {
378-
ts_log_severe "Queue a.q is not in state running, it is in state $state"
386+
# @todo CS-1597 load values are spooled, so wait_for_load_from_all_queues returned immediately
387+
if {0} {
388+
set state [get_queue_state $aq qstat_output]
389+
if {$state != ""} {
390+
ts_log_severe "Queue a.q is not in state running, it is in state $state\n$qstat_output"
391+
}
392+
} else {
393+
wait_for_queue_state $aq "" 60
379394
}
380395

381396
# check if both jobs are running

src/tcl_files/sge_procedures.tcl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3514,8 +3514,16 @@ proc wait_for_queue_state {queue state wait_timeout} {
35143514
ts_log_progress
35153515
after 500
35163516
set q_state [get_queue_state $queue]
3517-
if {[string first $state $q_state] >= 0} {
3518-
return $q_state
3517+
# we might want to wait for state "" = no special state = queue is running
3518+
# need to handle this special case as we cannot pass "" into string first
3519+
if {$state eq ""} {
3520+
if {$q_state eq ""} {
3521+
return $q_state
3522+
}
3523+
} else {
3524+
if {[string first $state $q_state] >= 0} {
3525+
return $q_state
3526+
}
35193527
}
35203528
if {[clock seconds] > $my_timeout} {
35213529
set qstat_output [start_sge_bin "qstat" "-f -q $queue"]

src/tcl_files/sge_queue.tcl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,8 @@ proc mod_queue_state { queuelist state } {
671671
#
672672
# INPUTS
673673
# queue - name of the queue
674+
# qstat_output_var - if given, the name of a variable which will return the output
675+
# of the qstat command called to get the queue state
674676
#
675677
# RESULT
676678
# The return value can contain more than one state. Here is a list of possible
@@ -687,9 +689,13 @@ proc mod_queue_state { queuelist state } {
687689
# E(rror)
688690
#
689691
#*******************************
690-
proc get_queue_state { queue_name } {
692+
proc get_queue_state {queue_name {qstat_output_var ""}} {
691693
get_current_cluster_config_array ts_config
692694

695+
if {$qstat_output_var ne ""} {
696+
upvar $qstat_output_var result
697+
}
698+
693699
# resolve the queue name
694700
set queue [resolve_queue $queue_name 0]
695701
# long queue names would be truncated by plain qstat, e.g.

0 commit comments

Comments
 (0)