607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
|
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
|
-
+
-
+
-
+
+
-
+
-
+
|
area-name) 'areasig))
(else #f)))))) ;; give up
;; gets mtpg-run-id and syncs the record if different
;;
(define (tasks:run-id->mtpg-run-id dbh cached-info run-id)
(let* ((runs-ht (hash-table-ref cached-info 'runs))
(runinf (hash-table-ref runs-ht run-id)))
(runinf (hash-table-ref/default runs-ht run-id #f)))
(if runinf
runinf ;; already cached
(let* ((keytarg (string-intersperse (rmt:get-keys) "/")) ;; e.g. version/iteration/platform
(spec-id (pgdb:get-ttype dbh keytarg))
(target (rmt:get-target run-id)) ;; e.g. v1.63/a3e1/ubuntu
(run-dat (rmt:get-run-info run-id)) ;; NOTE: get-run-info returns a vector < row header >
(run-name (rmt:get-run-name-from-id run-id))
(new-run-id (pgdb:get-run-id dbh spec-id target run-name))
(row (db:get-rows run-dat)) ;; yes, this returns a single row
(header (db:get-header run-dat))
(state (db:get-value-by-header rows header "state "))
(state (db:get-value-by-header row header "state "))
(status (db:get-value-by-header row header "status"))
(owner (db:get-value-by-header row header "owner"))
(event-time (db:get-value-by-header row header "event_time"))
(comment (db:get-value-by-header row header "comment"))
(fail-count (db:get-value-by-header row header "fail_count"))
(pass-count (db:get-value-by-header row header "pass_count"))
(area-id (db:get-value-by-header row header "area_id)")))
;; (area-id (db:get-value-by-header row header "area_id)"))
)
(if new-run-id
(begin ;; let ((run-record (pgdb:get-run-info dbh new-run-id))
(hash-table-set! runs-ht run-id new-run-id)
;; ensure key fields are up to date
(pgdb:refresh-run-info
dbh
new-run-id
state status owner event-time comment fail-count pass-count area-id))
state status owner event-time comment fail-count pass-count)) ;; area-id))
(if (handle-exceptions
exn
(begin (print-call-chain) #f)
(pgdb:insert-run
dbh
spec-id target state status owner event-time comment fail-count pass-count area-id))
spec-id target run-name state status owner event-time comment fail-count pass-count)) ;; area-id))
(tasks:run-id->mtpg-run-id dbh cached-info run-id)
#f))))))
;;(define (tasks:sync-test-data dbh cached-info area-info)
;; (let* ((
|