Megatest

Check-in [bb3016d5f9]
Login
Overview
Comment:Sketched out possible speed up with short-circuit rollup of items From: 9809735c40b8d68c42ff4c5d47c83de09183cd80 User: matt
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65-diet2-cm1
Files: files | file ages | folders
SHA1: bb3016d5f91b4d07bad608c10520fd52952bd075
User & Date: matt on 2021-02-26 07:47:35
Other Links: branch diff | manifest | tags
Context
2021-02-26
07:47
use old rollup technique From: 195f4a1733d50ea9e6e755336c8d51dd761e478d User: matt check-in: 5cd6156bc0 user: matt tags: v1.65-diet2-cm1 (unpublished)
07:47
Sketched out possible speed up with short-circuit rollup of items From: 9809735c40b8d68c42ff4c5d47c83de09183cd80 User: matt check-in: bb3016d5f9 user: matt tags: v1.65-diet2-cm1 (unpublished)
07:46
Repaired some rmt:get-preq calls. ==1.08/0.44/1205/PASS/mars== From: f5ecefc5796637cef94ff09c33f32295b7df3c34 User: matt check-in: 19f0575d0b user: matt tags: v1.65-diet2-cm1 (unpublished)
Changes

Modified db.scm from [ed256dd44f] to [d0425c238a].

3955
3956
3957
3958
3959
3960
3961




































































3962
3963
3964
3965
3966
3967
3968
;;    ;; 	(db:general-call dbdat 'state-status-msg (list state status msg test-id))
;;    ;; 	(db:general-call dbdat 'state-status     (list state status test-id)))
;;    (db:set-state-status-and-roll-up-items dbstruct run-id test-id #f state status msg)
;;    ;; process the test_data table
;;    (if (and test-id state status (equal? status "AUTO")) 
;; 	(db:test-data-rollup dbstruct run-id test-id status))
;;    (mt:process-triggers dbstruct run-id test-id state status)))





































































;; state is the priority rollup of all states
;; status is the priority rollup of all completed statesfu
;;
;; if test-name is an integer work off that instead of test-name test-path
;;
(define (db:set-state-status-and-roll-up-items dbstruct run-id test-name item-path state status comment)







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
;;    ;; 	(db:general-call dbdat 'state-status-msg (list state status msg test-id))
;;    ;; 	(db:general-call dbdat 'state-status     (list state status test-id)))
;;    (db:set-state-status-and-roll-up-items dbstruct run-id test-id #f state status msg)
;;    ;; process the test_data table
;;    (if (and test-id state status (equal? status "AUTO")) 
;; 	(db:test-data-rollup dbstruct run-id test-id status))
;;    (mt:process-triggers dbstruct run-id test-id state status)))

;; NOT FINISHED 
(define (db:calc-state-status-toplevel state status tl-state tl-status)
  `(,state ,status))

;;   (match state
;;     (("COMPLETED")
;;      (match `(,tl-state ,tl-status)
;;        (("COMPLETED" "PASS") `(,state ,status))
;;        (("COMPLETED" thestatus)
;; 	(case (string->symbol thestatus)
;; 	  ((ABORT CHECK DEAD)
;; 	   (if `("COMPLETED" ,thestatus))
;; 	(match `(,thestatus ,status)
;; 	  (("FAIL" "ABORT") '("COMPLETED" "ABORT"))
;; 	  (("FAIL" "CHECK") '("COMPLETED" "CHECK"))
;; 	  (("FAIL" "DEAD")  '("COMPLETED" "DEAD"))
;; 	  (("WARN" "FAIL")  '("COMPLETED" "FAIL"))
;; 	  (("WARN" "CHECK") '("COMPLETED" "CHECK"))
;; 	  (("WARN" "DEAD")
       

(define (db:set-state-status-and-roll-up-items-fast dbstruct run-id test-name item-path state status comment)
  ;; establish info on incoming test followed by info on top level test
  ;; BBnote - for mode itemwait, linkage between upstream test & matching item status is propagated to run queue in db:prereqs-not-met
  (mutex-lock! *db-transaction-mutex*)
  (db:with-db
   dbstruct #f #f
   (lambda (db)
     (let ((tr-res
	    (sqlite3:with-transaction
	     db
	     (lambda ()
	       (let* ((testdat      (if (number? test-name)
					(db:get-test-info-by-id dbstruct run-id test-name) ;; test-name is actually a test-id
					(db:get-test-info       dbstruct run-id test-name item-path)))
		      (test-id      (db:test-get-id testdat))
		      (test-name    (if (number? test-name)
					(db:test-get-testname testdat)
					test-name))
		      (item-path    (db:test-get-item-path testdat))
		      (tl-testdat   (db:get-test-info dbstruct run-id test-name ""))
		      (tl-test-id   (if tl-testdat
					(db:test-get-id tl-testdat)
					#f)))
		 (if (member state '("LAUNCHED" "REMOTEHOSTSTART"))
		     (db:general-call dbstruct 'set-test-start-time (list test-id)))
		 (if (member state '("LAUNCHED" "REMOTEHOSTSTART" "RUNNING"))
		     (begin ;; set test to launched and top level to RUNNING and we are done
		       (if tl-test-id
			   (db:test-set-state-status db run-id tl-test-id "RUNNING" #f #f)) ;; we are still in the transaction - must access the db and not the dbstruct
		       (db:test-set-state-status db run-id test-id state status #f))
		     (begin ;; 
		       (db:test-set-state-status db run-id test-id state status comment) ;; this call sets the item state/status
		       (if (not (equal? item-path "")) ;; only roll up IF incoming test is an item
			   (let* ((tl-state  (db:test-get-state tl-testdat))
				  (tl-status (db:test-get-status tl-testdat))
				  (newss     (db:calc-state-status-toplevel state status tl-state tl-status)))
			     (match newss
			       ((new-tl-state new-tl-status)
				(db:test-set-state-status db run-id tl-test-id new-tl-state new-tl-status))
			       (else
				#f)))))))))))
       (mutex-unlock! *db-transaction-mutex*)
       (if (and test-id state status (equal? status "AUTO")) 
	   (db:test-data-rollup dbstruct run-id test-id status))
       tr-res))))


;; state is the priority rollup of all states
;; status is the priority rollup of all completed statesfu
;;
;; if test-name is an integer work off that instead of test-name test-path
;;
(define (db:set-state-status-and-roll-up-items dbstruct run-id test-name item-path state status comment)
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
              (sqlite3:with-transaction
               db
               (lambda ()
                 ;; NB// Pass the db so it is part fo the transaction
                 (db:test-set-state-status db run-id test-id state status comment) ;; this call sets the item state/status
                 (if (not (equal? item-path "")) ;; only roll up IF incoming test is an item
                     (let* ((state-status-counts  (db:get-all-state-status-counts-for-test dbstruct run-id test-name item-path state status)) ;; item-path is used to exclude current state/status of THIS test
			      						  (state-stauses (db:roll-up-rules state-status-counts state status))
                          (newstate (car state-stauses))
                          (newstatus (cadr state-stauses)))
                       (debug:print 4 *default-log-port* "BB> tl-test-id="tl-test-id" ; "test-name":"item-path" newstate="newstate" newstatus="newstatus" len(sscs)="(length state-status-counts)  " state-status-counts: "
							(apply conc
                  (map (lambda (x)
                     (conc
                     		(with-output-to-string (lambda () (pp (dbr:counts->alist x)))) " | "))







|







4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
              (sqlite3:with-transaction
               db
               (lambda ()
                 ;; NB// Pass the db so it is part fo the transaction
                 (db:test-set-state-status db run-id test-id state status comment) ;; this call sets the item state/status
                 (if (not (equal? item-path "")) ;; only roll up IF incoming test is an item
                     (let* ((state-status-counts  (db:get-all-state-status-counts-for-test dbstruct run-id test-name item-path state status)) ;; item-path is used to exclude current state/status of THIS test
			    (state-stauses        (db:roll-up-rules state-status-counts state status))
                          (newstate (car state-stauses))
                          (newstatus (cadr state-stauses)))
                       (debug:print 4 *default-log-port* "BB> tl-test-id="tl-test-id" ; "test-name":"item-path" newstate="newstate" newstatus="newstatus" len(sscs)="(length state-status-counts)  " state-status-counts: "
							(apply conc
                  (map (lambda (x)
                     (conc
                     		(with-output-to-string (lambda () (pp (dbr:counts->alist x)))) " | "))