Overview
Comment: | More rpc related changes |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c810f51721aff371ae20ab0220c9fc55 |
User & Date: | matt on 2012-02-26 01:11:37 |
Other Links: | manifest | tags |
Context
2012-02-26
| ||
07:47 | Broke connection to server out of open-db check-in: 35d5a09470 user: matt tags: trunk | |
01:11 | More rpc related changes check-in: c810f51721 user: matt tags: trunk | |
2012-02-25
| ||
22:32 | Most db: routines enabled for rpc check-in: 2c8647e6a0 user: matt tags: trunk | |
Changes
Modified dashboard-tests.scm from [e6478c69b6] to [3477ef2c51].
︙ | ︙ | |||
245 246 247 248 249 250 251 | btns)))))) ;;====================================================================== ;; ;;====================================================================== (define (examine-test db test-id) ;; run-id run-key origtest) | | > > > > | | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | btns)))))) ;;====================================================================== ;; ;;====================================================================== (define (examine-test db test-id) ;; run-id run-key origtest) (let* ((testdat (db:get-test-data-by-id db test-id))) (if (not testdat) (begin (debug:print 0 "ERROR: No test data found for test " test-id ", exiting") (exit 1)) (let* ((run-id (if testdat (db:test-get-run_id testdat) #f)) (keydat (if testdat (rdb:get-key-val-pairs db run-id) #f)) (rundat (if testdat (rdb:get-run-info db run-id) #f)) (runname (if testdat (db:get-value-by-header (db:get-row rundat) (db:get-header rundat) "runname") #f)) ;(teststeps (if testdat (db:get-steps-for-test db test-id) #f)) (logfile "/this/dir/better/not/exist") |
︙ | ︙ | |||
468 469 470 471 472 473 474 | (lambda (key) ;; (print "Updating " key) ((hash-table-ref widgets key) testdat)) (hash-table-keys widgets)) (update-state-status-buttons testdat) ; (iup:refresh self) (if *exit-started* | | | 472 473 474 475 476 477 478 479 480 | (lambda (key) ;; (print "Updating " key) ((hash-table-ref widgets key) testdat)) (hash-table-keys widgets)) (update-state-status-buttons testdat) ; (iup:refresh self) (if *exit-started* (set! *exit-started* 'ok)))))))))) |
Modified db.scm from [2e903ce541] to [df4f1d4f19].
︙ | ︙ | |||
1205 1206 1207 1208 1209 1210 1211 | (db:get-test-data-by-id db test-id))) (define (rdb:get-run-info db run-id) (if *runremote* (let ((host (vector-ref *runremote* 0)) (port (vector-ref *runremote* 1))) ((rpc:procedure 'rdb:get-run-info host port) run-id)) | | | | > > > > > > > | 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 | (db:get-test-data-by-id db test-id))) (define (rdb:get-run-info db run-id) (if *runremote* (let ((host (vector-ref *runremote* 0)) (port (vector-ref *runremote* 1))) ((rpc:procedure 'rdb:get-run-info host port) run-id)) (db:get-run-info db run-id))) (define (rdb:get-steps-for-test db test-id) (if *runremote* (let ((host (vector-ref *runremote* 0)) (port (vector-ref *runremote* 1))) ((rpc:procedure 'rdb:get-steps-for-test host port) test-id)) (db:get-steps-for-test db test-id))) (define (rdb:get-steps-table db test-id) (if *runremote* (let ((host (vector-ref *runremote* 0)) (port (vector-ref *runremote* 1))) ((rpc:procedure 'rdb:get-steps-table host port) test-id)) (db:get-steps-table db test-id))) (define (rdb:read-test-data db test-id categorypatt) (if *runremote* (let ((host (vector-ref *runremote* 0)) (port (vector-ref *runremote* 1))) ((rpc:procedure 'rdb:read-test-data host port) test-id categorypatt)) (db:read-test-data db test-id categorypatt))) (define (rdb:get-test-info db run-id testname item-path) (if *runremote* (let ((host (vector-ref *runremote* 0)) (port (vector-ref *runremote* 1))) ((rpc:procedure 'rdb:get-test-info host port) run-id testname item-path)) (db:get-test-info db run-id testname item-path))) (define (rdb:delete-test-records db test-id) (if *runremote* (let ((host (vector-ref *runremote* 0)) (port (vector-ref *runremote* 1))) ((rpc:procedure 'rdb:delete-test-records host port) test-id)) (db:delete-test-records db test-id))) |
Modified megatest.scm from [38b244e9f7] to [c404370efb].
︙ | ︙ | |||
283 284 285 286 287 288 289 | (debug:print 2 "Run: " (string-intersperse (map (lambda (x) (db:get-value-by-header run header x)) keynames) "/") "/" (db:get-value-by-header run header "runname")) (let ((run-id (db:get-value-by-header run header "id"))) | | | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | (debug:print 2 "Run: " (string-intersperse (map (lambda (x) (db:get-value-by-header run header x)) keynames) "/") "/" (db:get-value-by-header run header "runname")) (let ((run-id (db:get-value-by-header run header "id"))) (let ((tests (rdb:get-tests-for-run db run-id testpatt itempatt '() '()))) ;; Each test (for-each (lambda (test) (format #t " Test: ~25a State: ~15a Status: ~15a Runtime: ~5@as Time: ~22a Host: ~10a\n" (conc (db:test-get-testname test) (if (equal? (db:test-get-item-path test) "") |
︙ | ︙ |
Modified runs.scm from [f7b1ada784] to [87f314f9eb].
︙ | ︙ | |||
486 487 488 489 490 491 492 | (debug:print 1 "Header: " header) (for-each (lambda (run) (let ((runkey (string-intersperse (map (lambda (k) (db:get-value-by-header run header (vector-ref k 0))) keys) "/")) (dirs-to-remove (make-hash-table))) (let* ((run-id (db:get-value-by-header run header "id") ) | | | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | (debug:print 1 "Header: " header) (for-each (lambda (run) (let ((runkey (string-intersperse (map (lambda (k) (db:get-value-by-header run header (vector-ref k 0))) keys) "/")) (dirs-to-remove (make-hash-table))) (let* ((run-id (db:get-value-by-header run header "id") ) (tests (rdb:get-tests-for-run db (db:get-value-by-header run header "id") testpatt itempatt '() '())) (lasttpath "/does/not/exist/I/hope")) (if (not (null? tests)) (begin (debug:print 1 "Removing tests for run: " runkey " " (db:get-value-by-header run header "runname")) (for-each (lambda (test) |
︙ | ︙ | |||
537 538 539 540 541 542 543 | (debug:print 2 "Removing directory with zero db references: " dir-to-remove) (system (conc "rm -rf " dir-to-remove)) (hash-table-delete! dirs-to-remove dir-to-remove)) (debug:print 2 "Skipping removal of " dir-to-remove " for now as it still has references in the database"))))) (sort (hash-table-keys dirs-to-remove) (lambda (a b)(> (string-length a)(string-length b))))) ;; remove the run if zero tests remain | | | 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | (debug:print 2 "Removing directory with zero db references: " dir-to-remove) (system (conc "rm -rf " dir-to-remove)) (hash-table-delete! dirs-to-remove dir-to-remove)) (debug:print 2 "Skipping removal of " dir-to-remove " for now as it still has references in the database"))))) (sort (hash-table-keys dirs-to-remove) (lambda (a b)(> (string-length a)(string-length b))))) ;; remove the run if zero tests remain (let ((remtests (rdb:get-tests-for-run db (db:get-value-by-header run header "id") #f #f '() '()))) (if (null? remtests) ;; no more tests remaining (let* ((dparts (string-split lasttpath "/")) (runpath (conc "/" (string-intersperse (take dparts (- (length dparts) 1)) "/")))) (debug:print 1 "Removing run: " runkey " " (db:get-value-by-header run header "runname")) (db:delete-run db run-id) |
︙ | ︙ | |||
580 581 582 583 584 585 586 | (let ((db #f) (keys #f)) (if (not (setup-for-run)) (begin (debug:print 0 "Failed to setup, exiting") (exit 1))) (set! db (open-db)) | | | 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | (let ((db #f) (keys #f)) (if (not (setup-for-run)) (begin (debug:print 0 "Failed to setup, exiting") (exit 1))) (set! db (open-db)) (set! keys (rdb:get-keys db)) ;; have enough to process -target or -reqtarg here (if (args:get-arg "-reqtarg") (let* ((runconfigf (conc *toppath* "/runconfigs.config")) ;; DO NOT EVALUATE ALL (runconfig (read-config runconfigf #f #f environ-patt: #f))) (if (hash-table-ref/default runconfig (args:get-arg "-reqtarg") #f) (keys:target-set-args keys (args:get-arg "-reqtarg") args:arg-hash) (begin |
︙ | ︙ | |||
647 648 649 650 651 652 653 | ;; This could probably be refactored into one complex query ... (define (runs:rollup-run db keys keyvallst runname user) ;; was target, now keyvallst (debug:print 4 "runs:rollup-run, keys: " keys " keyvallst: " keyvallst " :runname " runname " user: " user) (let* (; (keyvalllst (keys:target->keyval keys target)) (new-run-id (runs:register-run db keys keyvallst runname "new" "n/a" user)) (prev-tests (test:get-matching-previous-test-run-records db new-run-id "%" "%")) | | | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | ;; This could probably be refactored into one complex query ... (define (runs:rollup-run db keys keyvallst runname user) ;; was target, now keyvallst (debug:print 4 "runs:rollup-run, keys: " keys " keyvallst: " keyvallst " :runname " runname " user: " user) (let* (; (keyvalllst (keys:target->keyval keys target)) (new-run-id (runs:register-run db keys keyvallst runname "new" "n/a" user)) (prev-tests (test:get-matching-previous-test-run-records db new-run-id "%" "%")) (curr-tests (rdb:get-tests-for-run db new-run-id "%" "%" '() '())) (curr-tests-hash (make-hash-table))) (db:update-run-event_time db new-run-id) ;; index the already saved tests by testname and itemdat in curr-tests-hash (for-each (lambda (testdat) (let* ((testname (db:test-get-testname testdat)) (item-path (db:test-get-item-path testdat)) |
︙ | ︙ | |||
675 676 677 678 679 680 681 | (new-test-record #f)) ;; replace these with insert ... select (apply sqlite3:execute db (conc "INSERT OR REPLACE INTO tests (run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment) " "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?);") new-run-id (cddr (vector->list testdat))) | | | 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 | (new-test-record #f)) ;; replace these with insert ... select (apply sqlite3:execute db (conc "INSERT OR REPLACE INTO tests (run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment) " "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?);") new-run-id (cddr (vector->list testdat))) (set! new-testdat (car (rdb:get-tests-for-run db new-run-id testname item-path '() '()))) (hash-table-set! curr-tests-hash full-name new-testdat) ;; this could be confusing, which record should go into the lookup table? ;; Now duplicate the test steps (debug:print 4 "Copying records in test_steps from test_id=" (db:test-get-id testdat) " to " (db:test-get-id new-testdat)) (sqlite3:execute db (conc "INSERT OR REPLACE INTO test_steps (test_id,stepname,state,status,event_time,comment) " "SELECT " (db:test-get-id new-testdat) ",stepname,state,status,event_time,comment FROM test_steps WHERE test_id=?;") |
︙ | ︙ |
Modified server.scm from [606a86810a] to [91a0daa68e].
︙ | ︙ | |||
178 179 180 181 182 183 184 185 186 187 188 189 190 191 | (db:read-test-data db test-id categorypatt))) (rpc:publish-procedure! 'rdb:get-test-info (lambda (run-id testname item-path) (db:get-test-info db run-id testname item-path))) (set! *rpc:listener* rpc:listener) (on-exit (lambda () (sqlite3:execute db "DELETE FROM metadat WHERE var='SERVER' and val=?;" host:port) (sqlite3:finalize! db))) (thread-start! th1) (thread-join! th1))) ;; rpc:server))) | > > > > > | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | (db:read-test-data db test-id categorypatt))) (rpc:publish-procedure! 'rdb:get-test-info (lambda (run-id testname item-path) (db:get-test-info db run-id testname item-path))) (rpc:publish-procedure! 'rdb:delete-test-records (lambda (test-id) (db:delete-test-records db test-id))) (set! *rpc:listener* rpc:listener) (on-exit (lambda () (sqlite3:execute db "DELETE FROM metadat WHERE var='SERVER' and val=?;" host:port) (sqlite3:finalize! db))) (thread-start! th1) (thread-join! th1))) ;; rpc:server))) |
︙ | ︙ |
Modified tests.scm from [a1ec853995] to [ded3e6a05b].
︙ | ︙ | |||
50 51 52 53 54 55 56 | (conc "SELECT id FROM runs WHERE " qrystr " AND id != ?;") (append keyvals (list run-id))) ;; for each run starting with the most recent look to see if there is a matching test ;; if found then return that matching test record (debug:print 4 "selstr: " selstr ", qrystr: " qrystr ", keyvals: " keyvals ", previous run ids found: " prev-run-ids) (if (null? prev-run-ids) #f (let loop ((hed (car prev-run-ids)) (tal (cdr prev-run-ids))) | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | (conc "SELECT id FROM runs WHERE " qrystr " AND id != ?;") (append keyvals (list run-id))) ;; for each run starting with the most recent look to see if there is a matching test ;; if found then return that matching test record (debug:print 4 "selstr: " selstr ", qrystr: " qrystr ", keyvals: " keyvals ", previous run ids found: " prev-run-ids) (if (null? prev-run-ids) #f (let loop ((hed (car prev-run-ids)) (tal (cdr prev-run-ids))) (let ((results (rdb:get-tests-for-run db hed test-name item-path '() '()))) (debug:print 4 "Got tests for run-id " run-id ", test-name " test-name ", item-path " item-path ": " results) (if (and (null? results) (not (null? tal))) (loop (car tal)(cdr tal)) (if (null? results) #f (car results)))))))))) |
︙ | ︙ | |||
88 89 90 91 92 93 94 | ;; collect all matching tests for the runs then ;; extract the most recent test and return that. (debug:print 4 "selstr: " selstr ", qrystr: " qrystr ", keyvals: " keyvals ", previous run ids found: " prev-run-ids) (if (null? prev-run-ids) '() ;; no previous runs? return null (let loop ((hed (car prev-run-ids)) (tal (cdr prev-run-ids))) | | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | ;; collect all matching tests for the runs then ;; extract the most recent test and return that. (debug:print 4 "selstr: " selstr ", qrystr: " qrystr ", keyvals: " keyvals ", previous run ids found: " prev-run-ids) (if (null? prev-run-ids) '() ;; no previous runs? return null (let loop ((hed (car prev-run-ids)) (tal (cdr prev-run-ids))) (let ((results (rdb:get-tests-for-run db hed test-name item-path '() '()))) (debug:print 4 "Got tests for run-id " run-id ", test-name " test-name ", item-path " item-path " results: " (intersperse results "\n")) ;; Keep only the youngest of any test/item combination (for-each (lambda (testdat) (let* ((full-testname (conc (db:test-get-testname testdat) "/" (db:test-get-item-path testdat))) (stored-test (hash-table-ref/default tests-hash full-testname #f))) |
︙ | ︙ |