Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -2015,10 +2015,15 @@ (db:multi-db-sync (db:setup) 'new2old ) (set! *didsomething* #t))) + +(if (args:get-arg "-sync-to-pg") + (let ((toppath (launch:setup))) + (tasks:sync-to-postgres *configdat*) + (set! *didsomething* #t))) (if (args:get-arg "-generate-html") (let* ((toppath (launch:setup))) (if (tests:create-html-tree #f) (debug:print-info 0 *default-log-port* "HTML output created in " toppath "/lt/page#.html") @@ -2028,11 +2033,13 @@ ;;====================================================================== ;; Exit and clean up ;;====================================================================== (if (not *didsomething*) - (debug:print 0 *default-log-port* help)) + (debug:print 0 *default-log-port* help) + (set! *time-to-exit* #t) + ) ;;(debug:print-info 13 *default-log-port* "thread-join! watchdog") ;; join the watchdog thread if it has been thread-start!ed (it may not have been started in the case of a server that never enters running state) ;; (symbols returned by thread-state: created ready running blocked suspended sleeping terminated dead) ;; TODO: for multiple areas, we will have multiple watchdogs; and multiple threads to manage Index: tasks.scm ================================================================== --- tasks.scm +++ tasks.scm @@ -677,11 +677,12 @@ ;; "host" "cpuload" "diskfree" "uname" "rundir" "item_path" ;; "run_duration" "final_logf" "comment" "shortdir" "attemptnum" "archived" (if pgdb-test-id ;; have a record (begin ;; let ((key-name (conc run-id "/" test-name "/" item-path))) (hash-table-set! test-ht test-id pgdb-test-id) - (pgdb:update-test dbh test-id pgdb-run-id test-name item-path state status host cpuload diskfree uname run-dir log-file run-duration comment event-time archived)) + (print "Updating existing test with run-id: " run-id " and test-id: " test-id) + (pgdb:update-test dbh pgdb-test-id pgdb-run-id test-name item-path state status host cpuload diskfree uname run-dir log-file run-duration comment event-time archived)) (pgdb:insert-test dbh pgdb-run-id test-name item-path state status host cpuload diskfree uname run-dir log-file run-duration comment event-time archived)) )) test-ids))) ;; get runs changed since last sync @@ -705,13 +706,15 @@ (test-step-ids (alist-ref 'test_steps changed)) (test-data-ids (alist-ref 'test_data changed)) (run-stat-ids (alist-ref 'run_stats changed))) (print "area-info: " area-info) (if (not (null? test-ids)) - (tasks:sync-tests-data dbh cached-info test-ids)) - ) + (begin + (print "Syncing " (length test-ids) " changed tests") + (tasks:sync-tests-data dbh cached-info test-ids))) + (pgdb:write-sync-time dbh area-info start)) (if (tasks:set-area dbh configdat) (tasks:sync-to-postgres configdat) (begin (debug:print 0 *default-log-port* "ERROR: unable to create an area record") #f)))))