Megatest

Diff
Login

Differences From Artifact [fb7acc7e32]:

To Artifact [363e2a7eb1]:


103
104
105
106
107
108
109


110

111
112
113
114
115
116
117
  ;; (tests:test-set-status! test-id "RUNNING" "n/a" #f #f)
  ;; Since we should have a clean slate at this time there is no need to do 
  ;; any of the other stuff that tests:test-set-status! does. Let's just 
  ;; force RUNNING/n/a

  ;; (thread-sleep! 0.3)
  ;; (tests:test-force-state-status! run-id test-id "RUNNING" "n/a")


  (rmt:set-state-status-and-roll-up-items run-id test-name item-path "RUNNING" #f #f) 

  ;; (thread-sleep! 0.3) ;; NFS slowness has caused grief here

  ;; if there is a runscript do it first
  (if fullrunscript
      (let ((pid (process-run fullrunscript)))
	(rmt:test-set-top-process-pid run-id test-id pid)
	(let loop ((i 0))







>
>
|
>







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
  ;; (tests:test-set-status! test-id "RUNNING" "n/a" #f #f)
  ;; Since we should have a clean slate at this time there is no need to do 
  ;; any of the other stuff that tests:test-set-status! does. Let's just 
  ;; force RUNNING/n/a

  ;; (thread-sleep! 0.3)
  ;; (tests:test-force-state-status! run-id test-id "RUNNING" "n/a")
  (common:soft-lock
   (lambda ()
     (rmt:set-state-status-and-roll-up-items run-id test-name item-path "RUNNING" #f #f))
    "set-state-status-roll-up")
  ;; (thread-sleep! 0.3) ;; NFS slowness has caused grief here

  ;; if there is a runscript do it first
  (if fullrunscript
      (let ((pid (process-run fullrunscript)))
	(rmt:test-set-top-process-pid run-id test-id pid)
	(let loop ((i 0))
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360




















1361
1362
1363
1364
1365
1366
1367
            #t)
           (else #f))))
    (when do-scan?
      (debug:print 1 *default-log-port* "INFO: search and mark zombie tests")
      (rmt:set-var key (current-seconds))
      (rmt:find-and-mark-incomplete run-id #f))))

























;; 1. look though disks list for disk with most space
;; 2. create run dir on disk, path name is meaningful
;; 3. create link from run dir to megatest runs area 
;; 4. remotely run the test on allocated host
;;    - could be ssh to host from hosts table (update regularly with load)
;;    - could be netbatch







|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
            #t)
           (else #f))))
    (when do-scan?
      (debug:print 1 *default-log-port* "INFO: search and mark zombie tests")
      (rmt:set-var key (current-seconds))
      (rmt:find-and-mark-incomplete run-id #f))))

;; weak locking - slow down concurrent activities but don't entirely stop them from
;; overlapping. wait for up to 5 seconds
;;
(define (common:soft-lock proc keyname #!key (wait-time 5))
  (let* ((start-time (current-seconds))
	 (my-key     (conc (current-process-id) "-" (get-host-name))))
    (let loop ((key-val (rmt:no-sync-get/default keyname #f)))
      (if (and key-val
	       (not (equal? key-val my-key))
	       (< (- (current-seconds) start-time) wait-time))
	  (begin
	    (thread-sleep! 0.5)
	    (debug:print-info 0 *default-log-port* "Still trying to lock for " keyname)
	    (loop (current-seconds))) ;; try again
	  (begin ;; either we got the lock or we timed out - proceed as if 
	    (rmt:no-sync-set keyname my-key)
	    (if (equal? (rmt:no-sync-get/default keyname #f) my-key)
		(begin
		  (debug:print-info 0 *default-log-port* "Got lock for " keyname)
		  (proc)
		  (rmt:no-sync-del! keyname)
		  (debug:print-info 0 *default-log-port* "Released lock for " keyname))
		(common:soft-lock proc keyname wait-time: wait-time)))))))

;; 1. look though disks list for disk with most space
;; 2. create run dir on disk, path name is meaningful
;; 3. create link from run dir to megatest runs area 
;; 4. remotely run the test on allocated host
;;    - could be ssh to host from hosts table (update regularly with load)
;;    - could be netbatch
1464
1465
1466
1467
1468
1469
1470


1471

1472
1473
1474
1475
1476
1477
1478
	    (debug:print-info 0 *default-log-port* "attempting to preclean directory " (db:test-get-rundir testinfo) " for test " test-name "/" item-path)
	    (runs:remove-test-directory testinfo 'remove-data-only))) ;; remove data only, do not perturb the record
      
      ;; prevent overlapping actions - set to LAUNCHED as early as possible
      ;;
      ;; the following call handles waiver propogation. cannot yet condense into roll-up-pass-fail
      (tests:test-set-status! run-id test-id "LAUNCHED" "n/a" #f #f) ;; (if launch-results launch-results "FAILED"))


      (rmt:set-state-status-and-roll-up-items run-id test-name item-path #f "LAUNCHED" #f)

      ;; (pp (hash-table->alist tconfig))
      (set! diskpath (get-best-disk *configdat* tconfig))
      (if diskpath
	  (let ((dat  (create-work-area run-id run-info keyvals test-id test-path diskpath test-name itemdat)))
	    (set! work-area (car dat))
	    (set! toptest-work-area (cadr dat))
	    (debug:print-info 2 *default-log-port* "Using work area " work-area))







>
>
|
>







1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
	    (debug:print-info 0 *default-log-port* "attempting to preclean directory " (db:test-get-rundir testinfo) " for test " test-name "/" item-path)
	    (runs:remove-test-directory testinfo 'remove-data-only))) ;; remove data only, do not perturb the record
      
      ;; prevent overlapping actions - set to LAUNCHED as early as possible
      ;;
      ;; the following call handles waiver propogation. cannot yet condense into roll-up-pass-fail
      (tests:test-set-status! run-id test-id "LAUNCHED" "n/a" #f #f) ;; (if launch-results launch-results "FAILED"))
      (common:soft-lock
       (lambda ()
	 (rmt:set-state-status-and-roll-up-items run-id test-name item-path #f "LAUNCHED" #f))
       "set-state-status-roll-up")
      ;; (pp (hash-table->alist tconfig))
      (set! diskpath (get-best-disk *configdat* tconfig))
      (if diskpath
	  (let ((dat  (create-work-area run-id run-info keyvals test-id test-path diskpath test-name itemdat)))
	    (set! work-area (car dat))
	    (set! toptest-work-area (cadr dat))
	    (debug:print-info 2 *default-log-port* "Using work area " work-area))