Megatest

Check-in [1d078c2e7b]
Login
Overview
Comment:Refactor launch and run code
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | run-launch-cleanup
Files: files | file ages | folders
SHA1: 1d078c2e7b99243598638b29dac7e8d385d1ae72
User & Date: mrwellan on 2011-07-12 16:55:38
Other Links: branch diff | manifest | tags
Context
2011-07-12
17:25
Added run_id as key on setting test state and status (used in cleaning up before running) check-in: fa1cd94204 user: mrwellan tags: run-launch-cleanup
16:55
Refactor launch and run code check-in: 1d078c2e7b user: mrwellan tags: run-launch-cleanup
00:24
Added exit on issue launching cmd check-in: 62d813cd5f user: matt tags: trunk
Changes

Modified launch.scm from [fb3d7cd32a] to [19bdb69d40].

182
183
184
185
186
187
188
189
190





191
192
193


194
182
183
184
185
186
187
188


189
190
191
192
193
194
195

196
197
198







-
-
+
+
+
+
+


-
+
+

				  (car fullcmd)
				  print
				  (cdr fullcmd)))) ;;  launcher fullcmd)));; (apply cmd-run-proc-each-line launcher print fullcmd))) ;; (cmd-run->list fullcmd))
      (debug:print 2 "Launching completed, updating db")
      (debug:print 4 "Launch results: " launch-results)
      (if (not launch-results)
	  (begin
	    (print "ERROR: Failed to run " fullcmd ", exiting now")
	    (exit 1)))
	    (print "ERROR: Failed to run " (string-intersperse fullcmd " ") ", exiting now")
	    ;; (sqlite3:finalize! db)
	    ;; good ole "exit" seems not to work
	    ;; (_exit 9)
	    ))
      (alist->env-vars miscprevvals)
      (alist->env-vars testprevvals)
      (alist->env-vars commonprevvals))))
      (alist->env-vars commonprevvals)
      launch-results)))

Modified process.scm from [678870658d] to [a67e367861].

13
14
15
16
17
18
19
20

21
22

23
24
25
26
27



28

29
30
31
32
33
34
35
13
14
15
16
17
18
19

20
21

22
23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38







-
+

-
+





+
+
+
-
+







;; Process convience utils
;;======================================================================

(define (cmd-run-proc-each-line cmd proc . params)
  (handle-exceptions
   exn
   (begin
     (print "ERROR:  Failed to run command: " cmd (string-intersperse params " "))
     (print "ERROR:  Failed to run command: " cmd " " (string-intersperse params " "))
     #f)
   (let* ((fh (process cmd params)))
   (let-values (((fh fho pid) (process cmd params)))
     (let loop ((curr (read-line fh))
		(result  '()))
       (if (not (eof-object? curr))
	   (loop (read-line fh)
		 (append result (list (proc curr))))
	   (begin
	     (close-input-port fh)
	     (close-output-port fho)
	   result)))))
	     result))))))

(define (cmd-run-proc-each-line-alt cmd proc)
  (let* ((fh (open-input-pipe cmd))
         (res (port-proc->list fh proc))
         (status (close-input-pipe fh)))
    (if (eq? status 0) res #f)))

Modified runs.scm from [81b2c72b00] to [bd146b6003].

248
249
250
251
252
253
254


255
256
257
258
259
260
261
262
263









264
265
266
267
268
269
270
248
249
250
251
252
253
254
255
256









257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272







+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+







	      tests)
    res))

(define (runs:can-run-more-tests db)
  (let ((num-running (db:get-count-tests-running db))
	(max-concurrent-jobs (config-lookup *configdat* "setup" "max_concurrent_jobs")))
    (debug:print 2 "max-concurrent-jobs: " max-concurrent-jobs ", num-running: " num-running)
    (if (not (eq? 0 *globalexitstatus*))
	#f
    (if (or (not max-concurrent-jobs)
	    (and max-concurrent-jobs
		 (string->number max-concurrent-jobs)
		 (not (>= num-running (string->number max-concurrent-jobs)))))
	#t
	(begin 
	  (debug:print 0 "WARNING: Max running jobs exceeded, current number running: " num-running 
			 ", max_concurrent_jobs: " max-concurrent-jobs)
	  #f))))
	(if (or (not max-concurrent-jobs)
		(and max-concurrent-jobs
		     (string->number max-concurrent-jobs)
		     (not (>= num-running (string->number max-concurrent-jobs)))))
	    #t
	    (begin 
	      (debug:print 0 "WARNING: Max running jobs exceeded, current number running: " num-running 
			   ", max_concurrent_jobs: " max-concurrent-jobs)
	      #f)))))
  
(define (run-tests db test-names)
  (let* ((keys        (db-get-keys db))
	 (keyvallst   (keys->vallist keys #t))
	 (run-id      (register-run db keys))) ;;  test-name)))
    ;; on the first pass or call to run-tests set FAILS to NOT_STARTED if
    ;; -keepgoing is specified
280
281
282
283
284
285
286
287


288
289
290
291
292


293
294
295
296
297
298
299
282
283
284
285
286
287
288

289
290
291
292
293
294

295
296
297
298
299
300
301
302
303







-
+
+




-
+
+







    (set! *passnum* (+ *passnum* 1))
    (let loop ((numtimes 0))
      (for-each 
       (lambda (test-name)
	 (if (runs:can-run-more-tests db)
	     (run-one-test db run-id test-name keyvallst)
	     ;; add some delay 
	     (sleep 2)))
	     ;(sleep 2)
	     ))
       test-names)
      ;; (run-waiting-tests db)
      (if (args:get-arg "-keepgoing")
	  (let ((estrem (db:estimated-tests-remaining db run-id)))
	    (if (> estrem 0)
	    (if (and (> estrem 0)
		     (eq? *globalexitstatus* 0))
		(begin
		  (debug:print 1 "Keep going, estimated " estrem " tests remaining to run, will continue in 3 seconds ...")
		  (sleep 3)
		  (run-waiting-tests db)
		  (loop (+ numtimes 1)))))))))
	   
;; VERY INEFFICIENT! Move stuff that should be done once up to calling proc
413
414
415
416
417
418
419
420





421
422
423
424
425
426
427
417
418
419
420
421
422
423

424
425
426
427
428
429
430
431
432
433
434
435







-
+
+
+
+
+







			     (let* ((get-prereqs-cmd (lambda ()
						       (db-get-prereqs-not-met db run-id waiton))) ;; check before running ....
				    (launch-cmd      (lambda ()
						       (launch-test db run-id test-conf keyvallst test-name test-path itemdat)))
				    (testrundat      (list get-prereqs-cmd launch-cmd)))
			       (if (or (args:get-arg "-force")
				       (null? ((car testrundat)))) ;; are there any tests that must be run before this one...
				   ((cadr testrundat)) ;; this is the line that launches the test to the remote host
				   (if (not ((cadr testrundat))) ;; this is the line that launches the test to the remote host
				       (begin
					 (print "ERROR: Failed to launch the test. Exiting as soon as possible")
					 (set! *globalexitstatus* 1) ;; 
					 (exit 1)))
				   (if (not (args:get-arg "-keepgoing"))
				       (hash-table-set! *waiting-queue* new-test-name testrundat)))))))
		      ((KILLED) 
		       (debug:print 1 "NOTE: " new-test-name " is already running or was explictly killed, use -force to launch it."))
		      ((LAUNCHED REMOTEHOSTSTART RUNNING)  
		       (if (> (- (current-seconds)(+ (db:test-get-event_time testdat)
						     (db:test-get-run_duration testdat)))

Modified tests/megatest.config from [814128c313] to [83e247dec0].

8
9
10
11
12
13
14
15


16
17
18
19
20
21
22
8
9
10
11
12
13
14

15
16
17
18
19
20
21
22
23







-
+
+







# max_concurrent_jobs 4
runsdir /tmp/runs

[jobtools]
# ## launcher launches jobs, the job is managed on the target host
## by megatest, comment out launcher to run local
# workhosts localhost hermes
launcher nbfake
# launcher nbfake
launcher nodanggood

## use "xterm -e csi -- " as a launcher to examine the launch environment.
## exit with (exit)
## get a shell with (system "bash")
# launcher xterm -e csi --

[validvalues]

Modified utils/installall.sh from [dc0f7cb2ec] to [0ace91fc09].

89
90
91
92
93
94
95
96

97
98
99
100
101
102
103
89
90
91
92
93
94
95

96
97
98
99
100
101
102
103







-
+







	CSC_OPTIONS="-I$PREFIX/include -L$PREFIX/lib" chicken-install $PROX sqlite3
    fi
fi

if [[ `uname -a | grep x86_64` == "" ]]; then 
    export files="cd-5.4.1_Linux${KTYPE}_lib.tar.gz im-3.6.3_Linux${KTYPE}_lib.tar.gz iup-3.5_Linux${KTYPE}_lib.tar.gz"
else
    export files="cd-5.4.1_Linux${KTYPE}_64_lib.tar.gz im-3.6.3_Linux${KTYPE}_64_lib.tar.gz iup-3.4_Linux${KTYPE}_64_lib.tar.gz"
    export files="cd-5.4.1_Linux${KTYPE}_64_lib.tar.gz im-3.6.3_Linux${KTYPE}_64_lib.tar.gz iup-3.5_Linux${KTYPE}_64_lib.tar.gz"
fi

mkdir $PREFIX/iuplib
for a in `echo $files` ; do
    if ! [[ -e $a ]] ; then
	wget http://www.kiatoa.com/matt/iup/$a
    fi