Megatest

Diff
Login

Differences From Artifact [a94610040e]:

To Artifact [68546da11d]:


447
448
449
450
451
452
453

















































454
455
456
457
458
459
460
      (thread-start! th2)
      (thread-join! th1)
      )
    )

  0)


















































;;======================================================================
;; TODO: for multiple areas, we will have multiple watchdogs; and multiple threads to manage
(define (common:watchdog)
  (debug:print-info 13 *default-log-port* "common:watchdog entered.")
  (if (launch:setup)
      (if (common:on-homehost?)
	  (let ((dbstruct (db:setup #t)))







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
      (thread-start! th2)
      (thread-join! th1)
      )
    )

  0)

(define (make-and-init-remote)
  (make-remote hh-dat:      (common:get-homehost)
	       server-info:  (if *toppath* (server:check-if-running *toppath*) #f)
	       server-timeout: (server:expiration-timeout)))

;; TODO: for multiple areas, we will have multiple watchdogs; and multiple threads to manage
(set! *watchdog* (make-thread
		    (lambda ()
		      (handle-exceptions
			  exn
			  (begin
			    (print-call-chain)
			    (print " message: " ((condition-property-accessor 'exn 'message) exn) ", exn=" exn))
			(common:watchdog)))
		    "Watchdog thread"))

     ;;(if (not (args:get-arg "-server"))
     ;;    (thread-start! *watchdog*)) ;; if starting a server; wait till we get to running state before kicking off watchdog
     (let* ((no-watchdog-args
            '("-list-runs"
              "-testdata-csv"
              "-list-servers"
              "-server"
     	 "-adjutant"
              "-list-disks"
              "-list-targets"
              "-show-runconfig"
              ;;"-list-db-targets"
              "-show-runconfig"
              "-show-config"
              "-show-cmdinfo"
     	 "-cleanup-db"
                 ))
            (no-watchdog-argvals (list '("-archive" . "replicate-db")))
            (start-watchdog-specail-arg-val (let loop ((hed  (car no-watchdog-argvals))
                                                       (tail (cdr   no-watchdog-argvals)))
                                                  ;; (print "hed" hed " arg " (args:get-arg (car hed)) " val:" (cdr hed)  " eql" (equal? (args:get-arg (car hed)) (cdr hed)))  
                                                  (if (equal? (args:get-arg (car hed)) (cdr hed))
                                                    #f
                                                    (if (null? tail)
                                                      #t
                                                      (loop (car tail) (cdr tail))))))      
            (no-watchdog-args-vals (filter (lambda (x) x)
                                           (map args:get-arg no-watchdog-args)))
            (start-watchdog (and (null? no-watchdog-args-vals) start-watchdog-specail-arg-val)))
            ;(print  "no-watchdog-args="no-watchdog-args "no-watchdog-args-vals="no-watchdog-args-vals " start-watchdog-specail-arg-val:" start-watchdog-specail-arg-val " start-watchdog:" start-watchdog) 
       (if start-watchdog
           (thread-start! *watchdog*)))
     
;;======================================================================
;; TODO: for multiple areas, we will have multiple watchdogs; and multiple threads to manage
(define (common:watchdog)
  (debug:print-info 13 *default-log-port* "common:watchdog entered.")
  (if (launch:setup)
      (if (common:on-homehost?)
	  (let ((dbstruct (db:setup #t)))
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
                  (debug:print-error 0 *default-log-port* "Unknown server/sync-method specified ("syncer") - valid values are brute-force-sync and delta-sync.")
                  (exit 1)))
                ;;(debug:print 1 *default-log-port* "INFO: ["(common:human-time)"] Syncer started (method="syncer")")
                )))
	    (debug:print-info 13 *default-log-port* "watchdog done."))
	  (debug:print-info 13 *default-log-port* "no need for watchdog on non-homehost"))))

(define (make-and-init-remote)
  (make-remote hh-dat:      (common:get-homehost)
	       server-info:  (if *toppath* (server:check-if-running *toppath*) #f)
	       server-timeout: (server:expiration-timeout)))
;;======================================================================
;; currently the primary job of the watchdog is to run the sync back to megatest.db from the db in /tmp
;; if we are on the homehost and we are a server (by definition we are on the homehost if we are a server)
;;
(define (common:readonly-watchdog dbstruct)
  (let ((just-testing 0.0501))
    (thread-sleep! just-testing)) ;; (/ 1 20)) ;; 0.051) ;; delay for startup







|
<
<
<







524
525
526
527
528
529
530
531



532
533
534
535
536
537
538
                  (debug:print-error 0 *default-log-port* "Unknown server/sync-method specified ("syncer") - valid values are brute-force-sync and delta-sync.")
                  (exit 1)))
                ;;(debug:print 1 *default-log-port* "INFO: ["(common:human-time)"] Syncer started (method="syncer")")
                )))
	    (debug:print-info 13 *default-log-port* "watchdog done."))
	  (debug:print-info 13 *default-log-port* "no need for watchdog on non-homehost"))))





;;======================================================================
;; currently the primary job of the watchdog is to run the sync back to megatest.db from the db in /tmp
;; if we are on the homehost and we are a server (by definition we are on the homehost if we are a server)
;;
(define (common:readonly-watchdog dbstruct)
  (let ((just-testing 0.0501))
    (thread-sleep! just-testing)) ;; (/ 1 20)) ;; 0.051) ;; delay for startup