Overview
Comment: | Enabled first round rpc |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | test-specific-db | v1.4607 |
Files: | files | file ages | folders |
SHA1: |
bc191e17069f24ab730c2509374bd208 |
User & Date: | matt on 2012-09-30 22:12:57 |
Other Links: | branch diff | manifest | tags |
Context
2012-09-30
| ||
23:28 | bumped version check-in: 9d1014508a user: fdk71adm tags: test-specific-db | |
22:12 | Enabled first round rpc check-in: bc191e1706 user: matt tags: test-specific-db, v1.4607 | |
2012-09-28
| ||
18:28 | Bumped jobs to 200 check-in: cf1e5bff8c user: matt tags: test-specific-db, v1.4606 | |
Changes
Modified db.scm from [a162544976] to [b3c7d02de9].
︙ | ︙ | |||
1009 1010 1011 1012 1013 1014 1015 | qrystr) res)) ;;====================================================================== ;; QUEUE UP META, TEST STATUS AND STEPS ;;====================================================================== | | | | | | | | | | | | | | | | | | | | < | | | | | | | | | | | | | | | | | | | | | | | < | 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 | qrystr) res)) ;;====================================================================== ;; QUEUE UP META, TEST STATUS AND STEPS ;;====================================================================== (define (db:updater db) (let loop ((start-time (current-time))) (thread-sleep! 0.5) ;; move save time around to minimize regular collisions? (db:write-cached-data db) (loop start-time))) (define (remote:test-update-meta-info db test-id minutes cpuload diskfree tmpfree) (mutex-lock! *incoming-mutex*) (set! *incoming-data* (cons (vector 'meta-info (current-seconds) (list cpuload diskfree minutes test-id)) ;; run-id test-name item-path minutes cpuload diskfree tmpfree) *incoming-data*)) (mutex-unlock! *incoming-mutex*) (if *cache-on* (debug:print 6 "INFO: *cache-on* is " *cache-on* ", skipping cache write as part of test-update-meta-info") (db:write-cached-data db))) (define (db:write-cached-data db) (let ((meta-stmt (sqlite3:prepare db "UPDATE tests SET cpuload=?,diskfree=?,run_duration=?,state='RUNNING' WHERE id=? AND state NOT IN ('COMPLETED','KILLREQ','KILLED');")) (step-stmt (sqlite3:prepare db "INSERT OR REPLACE into test_steps (test_id,stepname,state,status,event_time,comment,logfile) VALUES(?,?,?,?,?,?,?);")) ;; strftime('%s','now')#f) (data (sort *incoming-data* (lambda (a b)(< (vector-ref a 1)(vector-ref b 1)))))) (if (> (length data) 0) (debug:print 4 "Writing cached data " data)) (mutex-lock! *incoming-mutex*) (sqlite3:with-transaction db (lambda () (for-each (lambda (entry) (case (vector-ref entry 0) ((meta-info) (apply sqlite3:execute meta-stmt (vector-ref entry 2))) ((step-status) (apply sqlite3:execute step-stmt (vector-ref entry 2))) (else (debug:print 0 "ERROR: Queued entry not recognised " entry)))) data))) (sqlite3:finalize! meta-stmt) ;; sqlite is the bottleneck, clear the statements asap? (sqlite3:finalize! step-stmt) (set! *incoming-data* '()) (mutex-unlock! *incoming-mutex*))) (define (db:roll-up-pass-fail-counts db run-id test-name item-path status) (if (and (not (equal? item-path "")) (or (equal? status "PASS") (equal? status "WARN") (equal? status "FAIL") (equal? status "WAIVED") |
︙ | ︙ | |||
1084 1085 1086 1087 1088 1089 1090 | 'RUNNING' ELSE 'COMPLETED' END, status=CASE WHEN fail_count > 0 THEN 'FAIL' WHEN pass_count > 0 AND fail_count=0 THEN 'PASS' ELSE 'UNKNOWN' END WHERE run_id=? AND testname=? AND item_path='';" run-id test-name run-id test-name)) #f) #f)) | < | 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 | 'RUNNING' ELSE 'COMPLETED' END, status=CASE WHEN fail_count > 0 THEN 'FAIL' WHEN pass_count > 0 AND fail_count=0 THEN 'PASS' ELSE 'UNKNOWN' END WHERE run_id=? AND testname=? AND item_path='';" run-id test-name run-id test-name)) #f) #f)) ;;====================================================================== ;; Tests meta data ;;====================================================================== ;; read the record given a testname (define (db:testmeta-get-record db testname) |
︙ | ︙ | |||
1721 1722 1723 1724 1725 1726 1727 | (define (rdb:test-get-paths-matching db keynames target fname) (if *runremote* (let ((host (vector-ref *runremote* 0)) (port (vector-ref *runremote* 1))) ((rpc:procedure 'rdb:test-get-paths-matching host port) keynames target fname)) (db:test-get-paths-matching db keynames target fname))) | > > > > > > | | 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 | (define (rdb:test-get-paths-matching db keynames target fname) (if *runremote* (let ((host (vector-ref *runremote* 0)) (port (vector-ref *runremote* 1))) ((rpc:procedure 'rdb:test-get-paths-matching host port) keynames target fname)) (db:test-get-paths-matching db keynames target fname))) (define (rdb:open-run-close procname . remargs) (if *runremote* (let ((host (vector-ref *runremote* 0)) (port (vector-ref *runremote* 1))) (apply (rpc:procedure 'rdb:open-run-close host port) procname remargs)) (apply open-run-close (eval procname) remargs))) |
Modified megatest.scm from [f47e8f14e8] to [95fcbb68a8].
︙ | ︙ | |||
729 730 731 732 733 734 735 | (or (not state) (not status))) (begin (debug:print 0 "ERROR: You must specify :state and :status with every call to -test-status\n" help) ;; (sqlite3:finalize! db) (exit 6))) (let ((msg (args:get-arg "-m"))) | > | | 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | (or (not state) (not status))) (begin (debug:print 0 "ERROR: You must specify :state and :status with every call to -test-status\n" help) ;; (sqlite3:finalize! db) (exit 6))) (let ((msg (args:get-arg "-m"))) ;; Convert to rpc (rdb:open-run-close 'tests:test-set-status! #f test-id state newstatus msg otherdata)))) (if db (sqlite3:finalize! db)) (set! *didsomething* #t)))) ;;====================================================================== ;; Various helper commands can go below here ;;====================================================================== |
︙ | ︙ |
Modified server.scm from [1e3bbfdee9] to [3dd064bd19].
︙ | ︙ | |||
25 26 27 28 29 30 31 | ;; procstr is the name of the procedure to be called as a string (define (server:autoremote procstr params) (handle-exceptions exn (begin (debug:print 1 "Remote failed for " proc " " params) | | | | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | ;; procstr is the name of the procedure to be called as a string (define (server:autoremote procstr params) (handle-exceptions exn (begin (debug:print 1 "Remote failed for " proc " " params) (apply (eval (string->symbol procstr)) params)) ;; (if *runremote* ;; (apply (eval (string->symbol (conc "remote:" procstr))) params) (apply (eval (string->symbol procstr)) params))) (define (server:start db hostn) (debug:print 0 "Attempting to start the server ...") (let* ((rpc:listener (server:find-free-port-and-open (rpc:default-server-port))) (th1 (make-thread (cute (rpc:make-server rpc:listener) "rpc:server") 'rpc:server)) |
︙ | ︙ | |||
57 58 59 60 61 62 63 64 65 66 67 68 69 70 | (lambda (procstr . params) (server:autoremote procstr params))) ;;====================================================================== ;; db specials here ;;====================================================================== ;; ** set-tests-state-status (rpc:publish-procedure! 'rdb:set-tests-state-status (lambda (run-id testnames currstate currstatus newstate newstatus) (set! *last-db-access* (current-seconds)) (db:set-tests-state-status db run-id testnames currstate currstatus newstate newstatus))) (rpc:publish-procedure! | > > > > > > > | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | (lambda (procstr . params) (server:autoremote procstr params))) ;;====================================================================== ;; db specials here ;;====================================================================== ;; ** set-tests-state-status (rpc:publish-procedure! 'rdb:open-run-close (lambda (procname . remargs) (debug:print 4 "INFO: rdb:open-run-close " procname " " remargs) (set! *last-db-access* (current-seconds)) (apply open-run-close (eval procname) remargs))) (rpc:publish-procedure! 'rdb:set-tests-state-status (lambda (run-id testnames currstate currstatus newstate newstatus) (set! *last-db-access* (current-seconds)) (db:set-tests-state-status db run-id testnames currstate currstatus newstate newstatus))) (rpc:publish-procedure! |
︙ | ︙ |