Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -464,14 +464,15 @@ ;; if not list or kill then start a client (if appropriate) (if (or (args-defined? "-h" "-version" "-gen-megatest-area" "-gen-megatest-test") (eq? (length (hash-table-keys args:arg-hash)) 0)) (debug:print-info 1 "Server connection not needed") (begin - (if run-id - (client:launch run-id) - (client:launch 0) ;; without run-id we'll start a server for "0" - ))))))) + ;; (if run-id + ;; (client:launch run-id) + ;; (client:launch 0) ;; without run-id we'll start a server for "0" + #t + )))))) ;; MAY STILL NEED THIS ;; (set! *megatest-db* (make-dbr:dbstruct path: *toppath* local: #t)))))))))) (if (or (args:get-arg "-list-servers") Index: rmt.scm ================================================================== --- rmt.scm +++ rmt.scm @@ -32,12 +32,14 @@ ;;====================================================================== ;; S U P P O R T F U N C T I O N S ;;====================================================================== +;; #t means - please start a server! +;; (define (rmt:write-frequency-over-limit? cmd run-id) - (or (member cmd api:read-only-queries) + (or (not (member cmd api:read-only-queries)) (let* ((tmprec (hash-table-ref/default *write-frequency* run-id #f)) (record (if tmprec tmprec (let ((v (vector (current-seconds) 0))) (hash-table-set! *write-frequency* run-id v) v))) @@ -47,11 +49,11 @@ (if (and (> count 10) (< (/ (- (current-seconds) start) count) ;; seconds per count 10)) (begin - (debug:print-info 1 "db write rate too high, starting a server") + (debug:print-info 1 "db write rate too high, starting a server, count=" count " start=" start " run-id=" run-id) #t) #f)))) ;; less than 10 seconds per count - start up a server ;; cmd is a symbol ;; vars is a json string encoding the parameters for the call @@ -73,10 +75,13 @@ (let ((res (client:setup run-id))) (if res (hash-table-ref/default *runremote* run-id #f) ;; client:setup filled this in (hopefully) (if (> numtries 0) (begin + ;; junk records can cause stuckness here. use this time to + ;; clean out + (open-run-close tasks:server-clean-out-old-records-for-run-id tasks:open-db run-id "auto-start-clean-up") (thread-sleep! 10) (loop (- numtries 1))) (begin (debug:print 0 "ERROR: 100 tries and no server, giving up") (exit 1)))))))))) Index: tasks.scm ================================================================== --- tasks.scm +++ tasks.scm @@ -155,11 +155,11 @@ (let ((res 0)) (sqlite3:for-each-row (lambda (num-in-queue) (set! res num-in-queue)) mdb - "SELECT count(id) FROM servers WHERE run_id=? AND state = 'available';" + "SELECT count(id) FROM servers WHERE run_id=? AND state = 'available' AND (strftime('%s','now') - start_time) < 30 ;" run-id) res)) (define (tasks:num-servers-non-zero-running mdb) (let ((res 0)) @@ -288,11 +288,11 @@ (let ((res #f)) (sqlite3:for-each-row (lambda (id) (set! res id)) mdb - "SELECT id FROM servers WHERE run_id=? AND state in ('running','available');" run-id) + "SELECT id FROM servers WHERE run_id=? AND (state = 'running' OR (state = 'available' AND (strftime('%s','now') - start_time) < 30));" run-id) res)) (define (tasks:get-all-servers mdb) (let ((res '())) (sqlite3:for-each-row Index: tests/fullrun/megatest.config ================================================================== --- tests/fullrun/megatest.config +++ tests/fullrun/megatest.config @@ -128,12 +128,12 @@ # This server will keep running this number of hours after last access. # Three minutes is 0.05 hours # timeout 0.025 timeout 0.01 -daemonize yes -hostname #{scheme (get-host-name)} +# daemonize yes +# hostname #{scheme (get-host-name)} ## disks are: ## name host:/path/to/area ## -or- ## name /path/to/area