Overview
Comment: | wip |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.6569-multi-db-wip |
Files: | files | file ages | folders |
SHA1: |
276d34776eeef3c862b243b8e700f078 |
User & Date: | matt on 2021-02-12 09:00:33 |
Other Links: | branch diff | manifest | tags |
Context
2021-02-12
| ||
20:49 | statement caching in db:get-tests-for-run-state-status was broken. check-in: 80d870f848 user: matt tags: v1.6569-multi-db-wip (unpublished) | |
09:00 | wip check-in: 276d34776e user: matt tags: v1.6569-multi-db-wip (unpublished) | |
08:35 | wip check-in: 69dd64de99 user: matt tags: v1.6569-multi-db-wip (unpublished) | |
Changes
Modified commonmod.scm from [b29d1896a0] to [efff2e3b21].
︙ | ︙ | |||
301 302 303 304 305 306 307 | (define (debug:print-info n e . params) (if (debug:debug-mode n) (with-output-to-port (if (port? e) e (current-error-port)) (lambda () (apply print "INFO: (" n ") " params) ;; res) )))) | < < < < < < < < < < < < < | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | (define (debug:print-info n e . params) (if (debug:debug-mode n) (with-output-to-port (if (port? e) e (current-error-port)) (lambda () (apply print "INFO: (" n ") " params) ;; res) )))) ;;====================================================================== ;; Safe utilities ;;====================================================================== (define (common:false-on-exception thunk #!key (message #f)) (handle-exceptions exn (begin |
︙ | ︙ | |||
1004 1005 1006 1007 1008 1009 1010 | ;; Generic string database (define sdb:qry #f) ;; (make-sdb:qry)) ;; 'init #f) ;; Generic path database (define *fdb* #f) (define *last-launch* (current-seconds)) ;; use for throttling the launch rate. Would be better to use the db and last time of a test in LAUNCHED state. | < < < < < < < < < < | 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | ;; Generic string database (define sdb:qry #f) ;; (make-sdb:qry)) ;; 'init #f) ;; Generic path database (define *fdb* #f) (define *last-launch* (current-seconds)) ;; use for throttling the launch rate. Would be better to use the db and last time of a test in LAUNCHED state. (define (common:snapshot-file filepath #!key (subdir ".") ) (if (file-exists? filepath) (let* ((age-sec (lambda (file) (if (file-exists? file) (- (current-seconds) (file-modification-time file)) 1000000000))) ;; return really old value if file doesn't exist. we want to clobber it if old or not exist. (ok-flag #t) |
︙ | ︙ |
Modified dbmod.scm from [d4a1881c5a] to [7cfae9d6c6].
︙ | ︙ | |||
2819 2820 2821 2822 2823 2824 2825 | -1 "-" "-")) ;; ;; 1. cache tests-match-qry ;; 2. compile qry and store in hash ;; 3. convert for-each-row to fold ;; | | | > | > | | 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 | -1 "-" "-")) ;; ;; 1. cache tests-match-qry ;; 2. compile qry and store in hash ;; 3. convert for-each-row to fold ;; (define (db:get-tests-for-run-state-status dbstruct run-id testpatt #!optional (last-update 0)) (db:with-db dbstruct run-id #f (lambda (db) ` (let* ((res '()) (stmt-cache (dbr:dbstruct-stmt-cache dbstruct)) (stmth (let* ((sh (db:hoh-get stmt-cache db testpatt))) (or sh (let* ((tests-match-qry (tests:match->sqlqry testpatt)) (qry (conc "SELECT id,testname,item_path,state,status FROM tests WHERE run_id=? " " AND last_update > ? " (if tests-match-qry (conc " AND (" tests-match-qry ") ") ""))) (newsh (sqlite3:prepare db qry))) (debug:print-info 8 *default-log-port* "db:get-tests-for-run qry=" qry) (db:hoh-set! stmt-cache db testpatt newsh) newsh))))) (reverse (sqlite3:fold-row (lambda (res id testname item-path state status) ;; id,run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment (cons (vector id run-id testname state status -1 "" -1 -1 "" "-" item-path -1 "-" "-") res)) '() stmth run-id (or last-update 0))))))) #;(define (db:get-tests-for-run-state-status dbstruct run-id testpatt #!optional (last-update 0)) (let* ((res '()) (tests-match-qry (tests:match->sqlqry testpatt)) (qry (conc "SELECT id,testname,item_path,state,status,event_time,run_duration FROM tests WHERE run_id=? " " AND last_update > ? " (if tests-match-qry (conc " AND (" tests-match-qry ") ") "") ))) (debug:print-info 8 *default-log-port* "db:get-tests-for-run qry=" qry) |
︙ | ︙ | |||
3245 3246 3247 3248 3249 3250 3251 | db "SELECT rundir FROM tests WHERE id=?;" #f ;; default result test-id)))) (define (db:get-test-times dbstruct run-name target) (let ((res `()) | | | < < < < < < < < < < < < < < < | < | | | | | | | | 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 | db "SELECT rundir FROM tests WHERE id=?;" #f ;; default result test-id)))) (define (db:get-test-times dbstruct run-name target) (let ((res `()) (qry (conc "select testname, item_path, run_duration, " (string-join (db:get-keys dbstruct) " || '/' || ") " as target from tests inner join runs on tests.run_id = runs.id where runs.runname = ? and target = ? ;"))) (db:with-db dbstruct #f ;; this is for the main runs db #f ;; does not modify db (lambda (db) (sqlite3:for-each-row (lambda (test-name item-path test-time target ) (set! res (cons (vector test-name item-path test-time) res))) db qry run-name target) res)))) ;;====================================================================== ;; S T E P S ;;====================================================================== |
︙ | ︙ |