Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -1147,11 +1147,23 @@ (keyvals (runs:dat-keyvals runsdat)) (run-info (runs:dat-run-info runsdat)) (all-tests-registry (runs:dat-all-tests-registry runsdat)) (run-limits-info (runs:dat-can-run-more-tests runsdat)) ;; (runs:can-run-more-tests run-id jobgroup max-concurrent-jobs)) ;; look at the test jobgroup and tot jobs running - (have-resources (car run-limits-info)) + (have-resources (and (if *journal-stats* + (let* ((dbfname (conc + (dbfile:run-id->dbnum run-id) + ".db")) + (stats (tt:get-journal-stats)) + (load (or (alist-ref dbfname stats equal?) 0))) + (if (> load 0.1) ;; dbs too busy to start more tests + (begin + (debug:print-info 0 *default-log-port* "Gating launch due to db load "load" based on journal file observations for "dbfname) + #f) + #t)) + #t) ;; if journal monitoring not started do not gate + (car run-limits-info))) (num-running (list-ref run-limits-info 1)) (num-running-in-jobgroup(list-ref run-limits-info 2)) (max-concurrent-jobs (list-ref run-limits-info 3)) (job-group-limit (list-ref run-limits-info 4)) ;; (prereqs-not-met (rmt:get-prereqs-not-met run-id waitons hed item-path mode: testmode itemmaps: itemmaps)) Index: tcp-transportmod.scm ================================================================== --- tcp-transportmod.scm +++ tcp-transportmod.scm @@ -1196,10 +1196,11 @@ (thread-sleep! (/ (random 1000) 100.0)) (loop))) ;; call this to start a thread that is keeping the journal-stats up to date. (define (tt:start-stats dbdir) + (thread-start! (make-thread (lambda ()(tt:journal-stats-run dbdir)) "Journal stats collection thread"))) (define (tt:get-journal-stats) @@ -1228,12 +1229,11 @@ (let ((tot (min (jstats-count result) 1)) ;; avoid divide by zero (hits (jstats-jcount result))) ;; 1.db => count (hash-table-map hits (lambda (fname hitcount) - (cons fname (/ hitcount tot))))) - )) + (cons fname (/ hitcount tot))))))) ;; megatest> (import tcp-transportmod) ;; megatest> (tt:write-load-tracking ".mtdb") ;; megatest> (hash-table-keys *journal-stats*) ;; (172060297)