Index: api.scm ================================================================== --- api.scm +++ api.scm @@ -121,11 +121,11 @@ ;;=============================================== ;; READ/WRITE QUERIES ;;=============================================== ;; SERVERS - ((start-server) (apply server:kind-run params)) + ((start-server) (apply server:kind-run params area-dat)) ((kill-server) (set! *server-run* #f)) ;; TESTS ((test-set-state-status-by-id) (apply db:test-set-state-status-by-id dbstruct area-dat params)) ((delete-test-records) (apply db:delete-test-records dbstruct area-dat params)) @@ -154,15 +154,15 @@ ((sync-inmem->db) (let ((run-id (car params))) (db:sync-touched dbstruct area-dat run-id force-sync: #t))) ((mark-incomplete) (apply db:find-and-mark-incomplete dbstruct area-dat params)) ;; TESTMETA - ((testmeta-add-record) (apply db:testmeta-add-record dbstruct area-dat params)) - ((testmeta-update-field) (apply db:testmeta-update-field dbstruct area-dat params)) + ((testmeta-add-record) (apply db:testmeta-add-record dbstruct area-dat params)) + ((testmeta-update-field) (apply db:testmeta-update-field dbstruct area-dat params)) ;; TASKS - ((tasks-add) (apply tasks:add dbstruct area-dat params)) + ((tasks-add) (apply tasks:add dbstruct area-dat params)) ((tasks-set-state-given-param-key) (apply tasks:set-state-given-param-key dbstruct area-dat params)) ;; ARCHIVES ;; ((archive-get-allocations) ((archive-register-disk) (apply db:archive-register-disk dbstruct area-dat params)) @@ -223,11 +223,11 @@ ((general-call) (let ((stmtname (car params)) (run-id (cadr params)) (realparams (cddr params))) (db:with-db dbstruct area-dat run-id #t ;; these are all for modifying the db (lambda (db) - (db:general-call db stmtname realparams))))) + (db:general-call db stmtname realparams area-dat))))) ((sdb-qry) (apply sdb:qry params)) ((ping) (current-process-id)) ;; TESTMETA ((testmeta-get-record) (apply db:testmeta-get-record dbstruct area-dat params)) Index: client.scm ================================================================== --- client.scm +++ client.scm @@ -170,12 +170,12 @@ (port (tasks:hostinfo-get-port server-dat)) (start-res (case transport-type ((http)(http-transport:client-connect iface port)) ((nmsg)(nmsg-transport:client-connect hostname port)))) (ping-res (case transport-type - ((http)(rmt:login-no-auto-client-setup start-res run-id)) - ((nmsg)(let ((logininfo (rmt:login-no-auto-client-setup start-res run-id))) + ((http)(rmt:login-no-auto-client-setup start-res run-id area-dat)) + ((nmsg)(let ((logininfo (rmt:login-no-auto-client-setup start-res run-id area-dat))) (if logininfo (car (vector-ref logininfo 1)) #f)))))) (if (and start-res ping-res) Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -71,11 +71,11 @@ (define *task-db* #f) ;; (vector db path-to-db) (define *db-access-allowed* #t) ;; flag to allow access (define *db-access-mutex* (make-mutex)) ;; SERVER -;; (define *my-client-signature* #f) +(define *my-client-signature* #f) ;; (define *transport-type* 'http) ;; override with [server] transport http|rpc|nmsg ;; (define *runremote* (make-hash-table)) ;; if set up for server communication this will hold (define (common:get-remote remote run-id) (let ((ht (or remote *runremote*))) Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -378,11 +378,11 @@ (db:close-main dbstruct area-dat) (let ((locdbs (dbr:dbstruct-get-locdbs dbstruct))) (if (hash-table? locdbs) (for-each (lambda (run-id) - (db:close-run-db dbstruct run-id)) + (db:close-run-db dbstruct area-dat run-id)) (hash-table-keys locdbs)))) ;; (let* ((local (dbr:dbstruct-get-local dbstruct)) ;; (rundb (db:dbdat-get-db (dbr:dbstruct-get-rundb dbstruct)))) ;; (if local @@ -640,19 +640,19 @@ ;; 'closeall - close all opened dbs ;; ;; run-ids: '(1 2 3 ...) or #f (for all) ;; (define (db:multi-db-sync run-ids area-dat . options) - (let* ((toppath (launch:setup-for-run)) + (let* ((toppath (launch:setup-for-run area-dat)) (dbstruct (if toppath (make-dbr:dbstruct path: toppath) #f)) (mtdb (if toppath (db:open-megatest-db area-dat))) (allow-cleanup (if run-ids #f #t)) (run-ids (if run-ids run-ids (if toppath (begin (db:delay-if-busy mtdb area-dat) - (db:get-all-run-ids mtdb))))) + (db:get-all-run-ids mtdb area-dat))))) (tdbdat (tasks:open-db area-dat)) (servers (tasks:get-all-servers (db:delay-if-busy tdbdat area-dat)))) ;; kill servers (if (member 'killservers options) @@ -672,11 +672,11 @@ ;; adjust test-ids to fit into proper range ;; (if (member 'adj-testids options) (begin (db:delay-if-busy mtdb area-dat) - (db:prep-megatest.db-for-migration mtdb))) + (db:prep-megatest.db-for-migration mtdb area-dat))) ;; sync runs, test_meta etc. ;; (if (member 'old2new options) (begin @@ -694,11 +694,11 @@ ;; now ensure all newdb data are synced to megatest.db ;; do not use the run-ids list passed in to the function ;; (if (member 'new2old options) (let* ((maindb (make-dbr:dbstruct path: toppath local: #t)) - (src-run-ids (db:get-all-run-ids (db:dbdat-get-db (db:get-db maindb area-dat 0)))) + (src-run-ids (db:get-all-run-ids (db:dbdat-get-db (db:get-db maindb area-dat 0)) area-dat)) (all-run-ids (sort (delete-duplicates (cons 0 src-run-ids)) <)) (count 1) (total (length all-run-ids)) (dead-runs '())) (for-each @@ -711,19 +711,19 @@ ;; (db:delay-if-busy mtdb) ;; (db:clean-up frundb) (if (eq? run-id 0) (begin (db:sync-tables area-dat (db:sync-main-list dbstruct area-dat) (db:get-db fromdb area-dat #f) mtdb) - (set! dead-runs (db:clean-up-maindb (db:get-db fromdb area-dat #f)))) + (set! dead-runs (db:clean-up-maindb (db:get-db fromdb area-dat #f) area-dat))) (begin ;; NB// must sync first to ensure deleted tests get marked as such in megatest.db (db:sync-tables area-dat db:sync-tests-only (db:get-db fromdb area-dat run-id) mtdb) - (db:clean-up-rundb (db:get-db fromdb area-dat run-id)) + (db:clean-up-rundb (db:get-db fromdb area-dat run-id) area-dat) )))) all-run-ids) ;; removed deleted runs - (let ((dbdir (tasks:get-task-db-path))) + (let ((dbdir (tasks:get-task-db-path area-dat))) (for-each (lambda (run-id) (let ((fullname (conc dbdir "/" run-id ".db"))) (if (file-exists? fullname) (begin (debug:print 0 "Removing database file for deleted run " fullname) @@ -1124,11 +1124,11 @@ ;;====================================================================== ;; M A I N T E N A N C E ;;====================================================================== -(define (db:have-incompletes? dbstruct area-dat run-id ovr-deadtime area-dat) +(define (db:have-incompletes? dbstruct area-dat run-id ovr-deadtime) (let* ((dbdat (db:get-db dbstruct area-dat run-id)) (db (db:dbdat-get-db dbdat)) (incompleted '()) (oldlaunched '()) (toplevels '()) @@ -1321,11 +1321,11 @@ ;; b. If test dir gone, delete the test record ;; 2. Look at run records ;; a. If have tests that are not deleted, set state='unknown' ;; b. .... ;; -(define (db:clean-up-rundb dbdat) +(define (db:clean-up-rundb dbdat area-dat) ;; (debug:print 0 "WARNING: db clean up not fully ported to v1.60, cleanup action will be on megatest.db") (let* ((db (db:dbdat-get-db dbdat)) (count-stmt (sqlite3:prepare db "SELECT (SELECT count(id) FROM tests);")) (statements (map (lambda (stmt) @@ -1362,11 +1362,11 @@ ;; b. If test dir gone, delete the test record ;; 2. Look at run records ;; a. If have tests that are not deleted, set state='unknown' ;; b. .... ;; -(define (db:clean-up-maindb dbdat) +(define (db:clean-up-maindb dbdat area-dat) ;; (debug:print 0 "WARNING: db clean up not fully ported to v1.60, cleanup action will be on megatest.db") (let* ((db (db:dbdat-get-db dbdat)) (count-stmt (sqlite3:prepare db "SELECT (SELECT count(id) FROM runs);")) (statements (map (lambda (stmt) @@ -2411,12 +2411,12 @@ testrecs))) ;; 1. move test ids into the 30k * run_id range ;; 2. move step ids into the 30k * run_id range ;; -(define (db:prep-megatest.db-for-migration mtdb) - (let* ((run-ids (db:get-all-run-ids mtdb))) +(define (db:prep-megatest.db-for-migration mtdb area-dat) + (let* ((run-ids (db:get-all-run-ids mtdb area-dat))) (for-each (lambda (run-id) (let ((testrecs (db:get-all-tests-info-by-run-id mtdb run-id))) (db:prep-megatest.db-adj-test-ids (db:dbdat-get-db mtdb) run-id testrecs))) run-ids))) @@ -2850,11 +2850,11 @@ (list #f "Login failed due to mismatch megatest version: " calling-version ", " megatest-version)) (else (hash-table-set! *logged-in-clients* client-signature (current-seconds)) '(#t "successful login")))) -(define (db:general-call dbdat stmtname params) +(define (db:general-call dbdat stmtname params area-dat) (let ((query (let ((q (alist-ref (if (string? stmtname) (string->symbol stmtname) stmtname) db:queries))) (if q (car q) #f)))) Index: http-transport.scm ================================================================== --- http-transport.scm +++ http-transport.scm @@ -581,13 +581,13 @@ (thread-start! th3) (set! *didsomething* #t) (thread-join! th2) (exit)))))) -(define (http:ping run-id host-port) +(define (http:ping run-id host-port area-dat) (let* ((server-dat (http-transport:client-connect (car host-port)(cadr host-port))) - (login-res (rmt:login-no-auto-client-setup server-dat run-id))) + (login-res (rmt:login-no-auto-client-setup server-dat run-id area-dat))) (if (and (list? login-res) (car login-res)) (begin (print "LOGIN_OK") (exit 0)) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -1448,11 +1448,11 @@ (begin (debug:print 0 "Failed to setup, exiting") (exit 1))) ;; now can find our db ;; keep this one local - (open-run-close runs:update-all-test_meta #f) + (open-run-close runs:update-all-test_meta #f *area-dat*) (set! *didsomething* #t))) ;;====================================================================== ;; Start a repl ;;====================================================================== Index: mt.scm ================================================================== --- mt.scm +++ mt.scm @@ -66,21 +66,21 @@ ;;====================================================================== ;; T E S T S ;;====================================================================== -(define (mt:get-tests-for-run run-id testpatt states status #!key (not-in #t) (sort-by 'event_time) (sort-order "ASC") (qryvals #f)) - (let loop ((testsdat (rmt:get-tests-for-run run-id testpatt states status 0 500 not-in sort-by sort-order qryvals)) +(define (mt:get-tests-for-run run-id testpatt states status area-dat #!key (not-in #t) (sort-by 'event_time) (sort-order "ASC") (qryvals #f)) + (let loop ((testsdat (rmt:get-tests-for-run run-id testpatt states status 0 500 not-in sort-by sort-order qryvals area-dat)) (res '()) (offset 0) (limit 500)) (let* ((full-list (append res testsdat)) (have-more (eq? (length testsdat) limit))) (if have-more (let ((new-offset (+ offset limit))) (debug:print-info 4 "More than " limit " tests, have " (length full-list) " tests so far.") - (loop (rmt:get-tests-for-run run-id testpatt states status new-offset limit not-in sort-by sort-order qryvals) + (loop (rmt:get-tests-for-run run-id testpatt states status new-offset limit not-in sort-by sort-order qryvals area-dat) full-list new-offset limit)) full-list)))) Index: rmt.scm ================================================================== --- rmt.scm +++ rmt.scm @@ -127,11 +127,11 @@ (res (if (vector? dat) (vector-ref dat 1) #f))) (if (vector? connection-info)(http-transport:server-dat-update-last-access connection-info)) (if success (begin ;; (mutex-unlock! *send-receive-mutex*) - (case + (case transport-type ((http) res) ;; (db:string->obj res)) ((nmsg) res))) ;; (vector-ref res 1))) (begin ;; let ((new-connection-info (client:setup run-id))) (debug:print 0 "WARNING: Communication failed, trying call to rmt:send-receive again.") ;; (case *transport-type* @@ -165,16 +165,16 @@ (tasks:start-and-wait-for-server (db:delay-if-busy (tasks:open-db area-dat)) run-id 10) (thread-sleep! (random 5)) ;; give some time to settle and minimize collison? (rmt:send-receive cmd rid params area-dat attemptnum: (+ attemptnum 1))) (begin (server:kind-run run-id area-dat) - (rmt:open-qry-close-locally cmd run-id area-dat params area-dat)))) + (rmt:open-qry-close-locally cmd run-id area-dat params)))) (begin ;; (debug:print 0 "ERROR: Communication failed!") ;; (mutex-unlock! *send-receive-mutex*) ;; (exit) - (rmt:open-qry-close-locally cmd run-id area-dat params area-dat) + (rmt:open-qry-close-locally cmd run-id area-dat params) ))))) (define (rmt:update-db-stats run-id rawcmd params duration) (mutex-lock! *db-stats-mutex*) (handle-exceptions @@ -305,11 +305,11 @@ ;;====================================================================== (define (rmt:kill-server run-id) (rmt:send-receive 'kill-server run-id (list run-id) area-dat)) -(define (rmt:start-server run-id) +(define (rmt:start-server run-id area-dat) (rmt:send-receive 'start-server 0 (list run-id) area-dat)) ;;====================================================================== ;; M I S C ;;====================================================================== Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -278,11 +278,11 @@ (for-each (lambda (state) (rmt:set-tests-state-status run-id test-names state #f "NOT_STARTED" state area-dat)) (string-split (or (configf:lookup configdat "setup" "allow-auto-rerun") ""))))) ;; Ensure all tests are registered in the test_meta table - (runs:update-all-test_meta #f) + (runs:update-all-test_meta #f area-dat) ;; now add non-directly referenced dependencies (i.e. waiton) ;;====================================================================== ;; refactoring this block into tests:get-full-data ;; @@ -292,11 +292,11 @@ (if (not (null? test-names)) (let loop ((hed (car test-names)) (tal (cdr test-names))) ;; 'return-procs tells the config reader to prep running system but return a proc (change-directory toppath) ;; PLEASE OPTIMIZE ME!!! I think this should be a no-op but there are several places where change-directories could be happening. (setenv "MT_TEST_NAME" hed) ;; - (let* ((config (tests:get-testconfig hed all-tests-registry 'return-procs)) + (let* ((config (tests:get-testconfig hed all-tests-registry 'return-procs area-dat)) (waitons (let ((instr (if config (config-lookup config "requirements" "waiton") (begin ;; No config means this is a non-existant test (debug:print 0 "ERROR: non-existent required test \"" hed "\"") (exit 1))))) @@ -461,13 +461,13 @@ '() reg))) (define runs:nothing-left-in-queue-count 0) -(define (runs:expand-items hed tal reg reruns regfull newtal jobgroup max-concurrent-jobs run-id waitons item-path testmode test-record can-run-more items runname tconfig reglen test-registry test-records itemmap) +(define (runs:expand-items hed tal reg reruns regfull newtal jobgroup max-concurrent-jobs run-id waitons item-path testmode test-record can-run-more items runname tconfig reglen test-registry test-records itemmap area-dat) (let* ((loop-list (list hed tal reg reruns)) - (prereqs-not-met (rmt:get-prereqs-not-met run-id waitons item-path testmode area-dat itemmap: itemmap)) + (prereqs-not-met (rmt:get-prereqs-not-met run-id waitons item-path area-dat itemmap: itemmap)) ;; (prereqs-not-met (mt:lazy-get-prereqs-not-met run-id waitons item-path mode: testmode itemmap: itemmap)) (fails (runs:calc-fails prereqs-not-met)) (prereq-fails (runs:calc-prereq-fail prereqs-not-met)) (non-completed (runs:calc-not-completed prereqs-not-met)) (runnables (runs:calc-runnable prereqs-not-met))) @@ -647,11 +647,11 @@ inlst))) (define (runs:process-expanded-tests hed tal reg reruns reglen regfull test-record runname test-name item-path jobgroup max-concurrent-jobs run-id waitons item-path testmode test-patts required-tests test-registry registry-mutex flags keyvals run-info newtal all-tests-registry itemmap area-dat) (let* ((configdat (megatest:area-configdat area-dat)) (toppath (megatest:area-path area-dat)) - (run-limits-info (runs:can-run-more-tests run-id jobgroup max-concurrent-jobs)) ;; look at the test jobgroup and tot jobs running + (run-limits-info (runs:can-run-more-tests run-id jobgroup max-concurrent-jobs area-dat)) ;; look at the test jobgroup and tot jobs running (have-resources (car run-limits-info)) (num-running (list-ref run-limits-info 1)) (num-running-in-jobgroup (list-ref run-limits-info 2)) (max-concurrent-jobs (list-ref run-limits-info 3)) (job-group-limit (list-ref run-limits-info 4)) @@ -903,28 +903,28 @@ ;; Do mark-and-find clean up of db before starting runing of quue ;; ;; (cdb:remote-run db:find-and-mark-incomplete #f) - (let ((configdat (megatest:area-configdat area-dat)) - (toppath (megatest:area-path area-dat)) - (run-info (rmt:get-run-info run-id area-dat)) - (tests-info (mt:get-tests-for-run run-id #f '() '())) ;; qryvals: "id,testname,item_path")) - (sorted-test-names (tests:sort-by-priority-and-waiton test-records)) - (test-registry (make-hash-table)) - (registry-mutex (make-mutex)) - (num-retries 0) - (max-retries (config-lookup configdat "setup" "maxretries")) - (max-concurrent-jobs (let ((mcj (config-lookup configdat "setup" "max_concurrent_jobs"))) - (if (and mcj (string->number mcj)) - (string->number mcj) - 1))) ;; length of the register queue ahead - (reglen (if (number? reglen-in) reglen-in 1)) - (last-time-incomplete (- (current-seconds) 900)) ;; force at least one clean up cycle - (last-time-some-running (current-seconds)) - (tdbdat (tasks:open-db area-dat))) - + (let* ((configdat (megatest:area-configdat area-dat)) + (toppath (megatest:area-path area-dat)) + (run-info (rmt:get-run-info run-id area-dat)) + (tests-info (mt:get-tests-for-run run-id #f '() '() area-dat)) ;; qryvals: "id,testname,item_path")) + (sorted-test-names (tests:sort-by-priority-and-waiton test-records)) + (test-registry (make-hash-table)) + (registry-mutex (make-mutex)) + (num-retries 0) + (max-retries (config-lookup configdat "setup" "maxretries")) + (max-concurrent-jobs (let ((mcj (config-lookup configdat "setup" "max_concurrent_jobs"))) + (if (and mcj (string->number mcj)) + (string->number mcj) + 1))) ;; length of the register queue ahead + (reglen (if (number? reglen-in) reglen-in 1)) + (last-time-incomplete (- (current-seconds) 900)) ;; force at least one clean up cycle + (last-time-some-running (current-seconds)) + (tdbdat (tasks:open-db area-dat))) + ;; Initialize the test-registery hash with tests that already have a record ;; convert state to symbol and use that as the hash value (for-each (lambda (trec) (let ((id (db:test-get-id trec)) (tn (db:test-get-testname trec)) @@ -1048,11 +1048,11 @@ ((not items) (debug:print-info 4 "OUTER COND: (not items)") (if (and (not (tests:match test-patts (tests:testqueue-get-testname test-record) item-path required: required-tests)) (not (null? tal))) (loop (car tal)(cdr tal) reg reruns)) - (let ((loop-list (runs:process-expanded-tests hed tal reg reruns reglen regfull test-record runname test-name item-path jobgroup max-concurrent-jobs run-id waitons item-path testmode test-patts required-tests test-registry registry-mutex flags keyvals run-info newtal all-tests-registry itemmap))) + (let ((loop-list (runs:process-expanded-tests hed tal reg reruns reglen regfull test-record runname test-name item-path jobgroup max-concurrent-jobs run-id waitons item-path testmode test-patts required-tests test-registry registry-mutex flags keyvals run-info newtal all-tests-registry itemmap area-dat))) (if loop-list (apply loop loop-list)))) ;; items processed into a list but not came in as a list been processed ;; ((and (list? items) ;; thus we know our items are already calculated @@ -1100,14 +1100,14 @@ ;; if items is a proc then need to run items:get-items-from-config, get the list and loop ;; - but only do that if resources exist to kick off the job ;; EXPAND ITEMS ((or (procedure? items)(eq? items 'have-procedure)) - (let ((can-run-more (runs:can-run-more-tests run-id jobgroup max-concurrent-jobs))) + (let ((can-run-more (runs:can-run-more-tests run-id jobgroup max-concurrent-jobs area-dat))) (if (and (list? can-run-more) (car can-run-more)) - (let ((loop-list (runs:expand-items hed tal reg reruns regfull newtal jobgroup max-concurrent-jobs run-id waitons item-path testmode test-record can-run-more items runname tconfig reglen test-registry test-records itemmap))) + (let ((loop-list (runs:expand-items hed tal reg reruns regfull newtal jobgroup max-concurrent-jobs run-id waitons item-path testmode test-record can-run-more items runname tconfig reglen test-registry test-records itemmap area-dat))) (if loop-list (apply loop loop-list))) ;; if can't run more just loop with next possible test (loop (car newtal)(cdr newtal) reg reruns)))) @@ -1246,11 +1246,11 @@ ;; v1.55 this code is being left in place for the time being. ;; (if (not (hash-table-ref/default *test-meta-updated* test-name #f)) (begin (hash-table-set! *test-meta-updated* test-name #t) - (runs:update-test_meta test-name test-conf))) + (runs:update-test_meta test-name test-conf area-dat))) ;; itemdat => ((ripeness "overripe") (temperature "cool") (season "summer")) (let* ((new-test-path (string-intersperse (cons test-path (map cadr itemdat)) "/")) (test-id (rmt:get-test-id run-id test-name item-path area-dat)) (testdat (if test-id (rmt:get-test-info-by-id run-id test-id area-dat) #f))) @@ -1448,11 +1448,11 @@ (let ((runkey (string-intersperse (map (lambda (k) (db:get-value-by-header run header k)) keys) "/")) (dirs-to-remove (make-hash-table)) (proc-get-tests (lambda (run-id) (mt:get-tests-for-run run-id - testpatt states statuses + testpatt states statuses area-dat not-in: #f sort-by: (case action ((remove-runs) 'rundir) (else 'event_time)))))) (let* ((run-id (db:get-value-by-header run header "id")) @@ -1591,11 +1591,11 @@ ))) ) (if worker-thread (thread-join! worker-thread)))))) ;; remove the run if zero tests remain (if (eq? action 'remove-runs) - (let ((remtests (mt:get-tests-for-run (db:get-value-by-header run header "id") #f '("DELETED") '("n/a") not-in: #t))) + (let ((remtests (mt:get-tests-for-run (db:get-value-by-header run header "id") #f '("DELETED") '("n/a") area-dat not-in: #t))) (if (null? remtests) ;; no more tests remaining (let* ((dparts (string-split lasttpath "/")) (runpath (conc "/" (string-intersperse (take dparts (- (length dparts) 1)) "/")))) @@ -1757,16 +1757,16 @@ (print "Updating " test-name " " fld " to " val) (rmt:testmeta-update-field test-name fld val area-dat))))) '(("author" 2)("owner" 3)("description" 4)("reviewed" 5)("tags" 9)("jobgroup" 10))))) ;; Update test_meta for all tests -(define (runs:update-all-test_meta db) +(define (runs:update-all-test_meta db area-dat) (let ((test-names (tests:get-all area-dat))) ;; (tests:get-valid-tests))) (for-each (lambda (test-name) - (let* ((test-conf (mt:lazy-read-test-config test-name))) - (if test-conf (runs:update-test_meta test-name test-conf)))) + (let* ((test-conf (mt:lazy-read-test-config test-name area-dat))) + (if test-conf (runs:update-test_meta test-name test-conf area-dat)))) (hash-table-keys test-names)))) ;; This could probably be refactored into one complex query ... ;; NOT PORTED - DO NOT USE YET ;; Index: server.scm ================================================================== --- server.scm +++ server.scm @@ -155,11 +155,11 @@ ;; The generic run a server command. Dispatches the call to server 0 if run-id != 0 ;; (define (server:try-running run-id area-dat) (if (eq? run-id 0) (server:run run-id area-dat) - (rmt:start-server run-id))) + (rmt:start-server run-id area-dat))) (define (server:check-if-running run-id area-dat) (let ((tdbdat (tasks:open-db area-dat))) (let loop ((server (tasks:get-server (db:delay-if-busy tdbdat area-dat) run-id)) (trycount 0)) @@ -207,11 +207,11 @@ (print "ERROR: bad host:port") (exit 1)) (let* ((iface (if host-port (car host-port) (tasks:hostinfo-get-interface server-db-dat))) (port (if host-port (cadr host-port)(tasks:hostinfo-get-port server-db-dat))) (server-dat (http-transport:client-connect iface port)) - (login-res (rmt:login-no-auto-client-setup server-dat run-id))) + (login-res (rmt:login-no-auto-client-setup server-dat run-id area-dat))) (if (and (list? login-res) (car login-res)) (begin (print "LOGIN_OK") (exit 0)) Index: tasks.scm ================================================================== --- tasks.scm +++ tasks.scm @@ -525,13 +525,13 @@ ;; that no task gets run in parallel. ;; register a task -(define (tasks:add dbstruct action owner target runname testpatt params) +(define (tasks:add dbstruct area-dat action owner target runname testpatt params) (db:with-db - dbstruct #f #t + dbstruct area-dat #f #t (lambda (db) (sqlite3:execute db "INSERT INTO tasks_queue (action,owner,state,target,name,testpatt,params,creation_time,execution_time) VALUES (?,?,'new',?,?,?,?,strftime('%s','now'),0);" action owner @@ -680,19 +680,19 @@ exn #f (sqlite3:first-result db "SELECT id FROM tasks_queue WHERE params LIKE ?;" task-params))))) -(define (tasks:set-state-given-param-key dbstruct param-key new-state) +(define (tasks:set-state-given-param-key dbstruct area-dat param-key new-state) (db:with-db - dbstruct #f #t + dbstruct area-dat #f #t (lambda (db) (sqlite3:execute db "UPDATE tasks_queue SET state=? WHERE params LIKE ?;" new-state param-key)))) -(define (tasks:get-records-given-param-key dbstruct param-key state-patt action-patt test-patt) +(define (tasks:get-records-given-param-key dbstruct area-dat param-key state-patt action-patt test-patt) (db:with-db - dbstruct #f #f + dbstruct area-dat #f #f (lambda (db) (handle-exceptions exn '() (sqlite3:first-row db "SELECT id,action,owner,state,target,name,testpatt,keylock,params WHERE Index: tests.scm ================================================================== --- tests.scm +++ tests.scm @@ -132,13 +132,13 @@ (loop (car tal)(cdr tal)(cons qry res))))))) #f)) ;; Check for waiver eligibility ;; -(define (tests:check-waiver-eligibility testdat prev-testdat) +(define (tests:check-waiver-eligibility testdat prev-testdat area-dat) (let* ((test-registry (make-hash-table)) - (testconfig (tests:get-testconfig (db:test-get-testname testdat) test-registry #f)) + (testconfig (tests:get-testconfig (db:test-get-testname testdat) test-registry #f area-dat)) (test-rundir ;; (sdb:qry 'passstr (db:test-get-rundir testdat)) ;; ) (prev-rundir ;; (sdb:qry 'passstr (db:test-get-rundir prev-testdat)) ;; ) (waivers (configf:section-vars testconfig "waivers")) @@ -230,11 +230,11 @@ prev-comment) ;; waived is either the comment or #f #f)) #f) #f))) (if (and waived - (tests:check-waiver-eligibility testdat prev-test)) + (tests:check-waiver-eligibility testdat prev-test area-dat)) (set! real-status "WAIVED")) (debug:print 4 "real-status " real-status ", waived " waived ", status " status) ;; update the primary record IF state AND status are defined