Index: common_records.scm ================================================================== --- common_records.scm +++ common_records.scm @@ -11,12 +11,13 @@ (use trace) (define (debug:calc-verbosity vstr) (cond + ((not vstr) #f) ((string-match "^\\s*$" vstr) #f) - (vstr (let ((debugvals (string-split vstr ","))) + (vstr (let ((debugvals (string-split vstr ","))) (cond ((> (length debugvals) 1)(map string->number debugvals)) ((> (length debugvals) 0)(string->number (car debugvals))) (else #f)))) ((args:get-arg "-v") 2) Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -986,11 +986,11 @@ (define (db:get-targets dbstruct) (let* ((res '()) (keys (db:get-keys dbstruct)) (header keys) ;; (map key:get-fieldname keys)) (keystr (keys->keystr keys)) - (qrystr (conc "SELECT " keystr " FROM runs;")) + (qrystr (conc "SELECT " keystr " FROM runs WHERE state != 'deleted';")) (seen (make-hash-table))) (sqlite3:for-each-row (lambda (a . x) (let ((targ (cons a x))) (if (not (hash-table-ref/default seen targ #f)) @@ -1034,11 +1034,11 @@ ;; First get all the runname/run-ids (sqlite3:for-each-row (lambda (run-id runname) (set! runs-info (cons (list run-id runname) runs-info))) (db:get-db dbstruct #f) - "SELECT id,runname FROM runs;") + "SELECT id,runname FROM runs WHERE state != 'deleted';") ;; for each run get stats data (for-each (lambda (run-info) (let ((run-id (car run-info)) (run-name (cadr run-info))) @@ -1217,11 +1217,11 @@ (lambda (db) (apply sqlite3:for-each-row (lambda (id) (set! prev-run-ids (cons id prev-run-ids))) db - (conc "SELECT id FROM runs WHERE " qrystr " AND id != ?;") (append kvalues (list run-id))))) + (conc "SELECT id FROM runs WHERE " qrystr " AND state != 'deleted' AND id != ?;") (append kvalues (list run-id))))) prev-run-ids))) ;;====================================================================== ;; T E S T S ;;====================================================================== @@ -1503,11 +1503,11 @@ (lambda (id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment shortdir) ;; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 (set! res (cons (vector id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment shortdir) res))) (db:get-db dbstruct run-id) - (conc "SELECT " db:test-record-qry-selector " FROM tests WHERE run_id=?;") + (conc "SELECT " db:test-record-qry-selector " FROM tests WHERE state != 'DELETED' AND run_id=?;") run-id) res)) (define (db:replace-test-records dbstruct run-id testrecs) (db:with-db dbstruct run-id #t Index: http-transport.scm ================================================================== --- http-transport.scm +++ http-transport.scm @@ -312,11 +312,12 @@ (server-timeout (let ((tmo (config-lookup *configdat* "server" "timeout"))) (if (and (string? tmo) (string->number tmo)) (* 60 60 (string->number tmo)) ;; (* 3 24 60 60) ;; default to three days - (* 60 1) ;; default to one minute + ;; (* 60 1) ;; default to one minute + (* 60 60 25) ;; default to 25 hours )))) (let loop ((count 0) (server-state 'available)) ;; Use this opportunity to sync the inmemdb to db (let ((start-time (current-milliseconds)) Index: tasks.scm ================================================================== --- tasks.scm +++ tasks.scm @@ -146,12 +146,14 @@ (conc "defunct" tag) (get-host-name) (current-process-id))) (define (tasks:server-delete-record mdb server-id tag) (sqlite3:execute mdb "UPDATE servers SET state=?,heartbeat=strftime('%s','now') WHERE id=?;" (conc "defunct" tag) server-id) - ;; use this opportuntity to clean out records over one month old - (sqlite3:execute mdb "DELETE FROM servers WHERE state not in ('running','shutting-down') AND (strftime('%s','now') - start_time) > 2628000;")) + ;; use this opportuntity to clean out records over one month old or over 10 minutes old with port = -1 (i.e. a never used placeholder) + (sqlite3:execute mdb "DELETE FROM servers WHERE state not in ('running','shutting-down') AND (strftime('%s','now') - start_time) > 2628000;") + (sqlite3:execute mdb "DELETE FROM servers WHERE state like 'defunct%' AND port=-1 AND (strftime('%s','now') - start_time) > 600;") + ) (define (tasks:server-set-state! mdb server-id state) (sqlite3:execute mdb "UPDATE servers SET state=?,heartbeat=strftime('%s','now') WHERE id=?;" state server-id)) (define (tasks:server-set-interface-port mdb server-id interface port) Index: tests/fullrun/megatest.config ================================================================== --- tests/fullrun/megatest.config +++ tests/fullrun/megatest.config @@ -116,11 +116,11 @@ port 8080 # This server will keep running this number of hours after last access. # Three minutes is 0.05 hours # timeout 0.025 -timeout 0.1 +timeout 0.25 ## disks are: ## name host:/path/to/area ## -or- ## name /path/to/area Index: tests/watch-monitor.sh ================================================================== --- tests/watch-monitor.sh +++ tests/watch-monitor.sh @@ -2,9 +2,9 @@ if [ -e fullrun/db/monitor.db ];then sqlite3 fullrun/db/monitor.db << EOF .header on .mode column -select * from servers; +select * from servers order by start_time desc; .q EOF fi