Random Bits of Open Code

Check-in [663fdaecef]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:set area's last updated to curr time - 1
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:663fdaecefc02bc68b69f76fdd8bdd9b0bd2734b
User & Date: pjhatwal 2018-08-06 18:23:22
Context
2018-08-07
05:42
Lots of cleanup in multiapp check-in: d2888a0bef user: matt tags: trunk
2018-08-06
18:23
set area's last updated to curr time - 1 check-in: 663fdaecef user: pjhatwal tags: trunk
06:32
Added mostly working del of users subjects check-in: 1247f0c47a user: matt tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

a3d/testbox/a3d.scm became a regular file.

megatest_cgisetup/cgi-bin/models became a regular file.

megatest_cgisetup/cgi-bin/pages became a regular file.

Changes to mtutils/mtdb/mtdb.scm.

1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
....
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
....
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
		 (run-ids        (or (alist-ref 'runs       changed) '()))
		 (test-ids       (or (alist-ref 'tests      changed) '()))
		 (test-step-ids  (or (alist-ref 'test_steps changed) '()))
		 (test-data-ids  (or (alist-ref 'test_data  changed) '()))
		 (run-stat-ids   (or (alist-ref 'run_stats  changed) '()))
		 (area-id        (vector-ref area-info 0)))
	    (if (not (adat-id adat2))(adat-id-set! adat2 area-id))
	    (print "num run-ids: " (length run-ids) " num test-ids: " (length test-ids))
	    ;; sync run records
	    (for-each
	     (lambda (mt-run-id)
	       (run-id->mtpg-run-id adat1 adat2 cached-info mt-run-id area-info))
	     run-ids)
	    ;; record the tag info
	    (if (and (equal? area-tag "")
................................................................................
		  ;;Assumption here is that if test-step or test data is changed then the test last update time is changed 
		  ;; not syncing run stats at this time as they can be derived from tests table.
		  (sync-tests-data adat1 adat2 cached-info test-ids area-info)
					;(exit)   
		  ;; (sync-test-steps adat1 adat2 cached-info test-step-ids)
		  ;; (sync-test-gen-data adat1 adat2 cached-info test-data-ids))
		  ))
	    (write-sync-time common-dbh area-info start)
	    (adat-last-refresh-set! adat2 start)
	    (close-all-dbs adat1)
	    (close-all-dbs adat2)
	    ))) ;; NOTE: Need to extract the max time from the source db and use that
	(if (set-area adat2 aname: area-name) ;; we force to use *our* area-name and not that set by the area owner
	    (mt1-sync-to-mt2 adat1 adat2)
	    (begin
	      (print-error "ERROR: unable to create an area record")
................................................................................
;;
;;======================================================================

;; get an alist of record ids changed since time since-time
;;   '((runs . (1 2 3 ...))(steps . (5 6 7 ...) ...))
;;
(define (get-changed-record-ids adat since-time)
  (print "INFO: getting id's for records changed since time " since-time)
  (with-megatest-db
   adat
   (lambda (db)
     (let ((backcons (lambda (lst item)(cons item lst)))
	   (conscar  (lambda (row lst)(cons (car row) lst)))) ;; conscar should be cheaper than append
       `((runs       . ,(dbi:fold-row conscar '() db "SELECT id FROM runs  WHERE last_update>?;" since-time))
	 (tests      . ,(dbi:fold-row conscar '() db "SELECT id FROM tests WHERE last_update>?;" since-time))







|







 







|
|







 







|







1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
....
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
....
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
		 (run-ids        (or (alist-ref 'runs       changed) '()))
		 (test-ids       (or (alist-ref 'tests      changed) '()))
		 (test-step-ids  (or (alist-ref 'test_steps changed) '()))
		 (test-data-ids  (or (alist-ref 'test_data  changed) '()))
		 (run-stat-ids   (or (alist-ref 'run_stats  changed) '()))
		 (area-id        (vector-ref area-info 0)))
	    (if (not (adat-id adat2))(adat-id-set! adat2 area-id))
	    (print "num run-ids: " (length run-ids) " num test-ids: " (length test-ids) " " test-ids " start " start)
	    ;; sync run records
	    (for-each
	     (lambda (mt-run-id)
	       (run-id->mtpg-run-id adat1 adat2 cached-info mt-run-id area-info))
	     run-ids)
	    ;; record the tag info
	    (if (and (equal? area-tag "")
................................................................................
		  ;;Assumption here is that if test-step or test data is changed then the test last update time is changed 
		  ;; not syncing run stats at this time as they can be derived from tests table.
		  (sync-tests-data adat1 adat2 cached-info test-ids area-info)
					;(exit)   
		  ;; (sync-test-steps adat1 adat2 cached-info test-step-ids)
		  ;; (sync-test-gen-data adat1 adat2 cached-info test-data-ids))
		  ))
	    (write-sync-time common-dbh area-info (- start 1))
	    (adat-last-refresh-set! adat2 (- start 1))
	    (close-all-dbs adat1)
	    (close-all-dbs adat2)
	    ))) ;; NOTE: Need to extract the max time from the source db and use that
	(if (set-area adat2 aname: area-name) ;; we force to use *our* area-name and not that set by the area owner
	    (mt1-sync-to-mt2 adat1 adat2)
	    (begin
	      (print-error "ERROR: unable to create an area record")
................................................................................
;;
;;======================================================================

;; get an alist of record ids changed since time since-time
;;   '((runs . (1 2 3 ...))(steps . (5 6 7 ...) ...))
;;
(define (get-changed-record-ids adat since-time)
  (print "INFO: getting id's for records changed since time " since-time )
  (with-megatest-db
   adat
   (lambda (db)
     (let ((backcons (lambda (lst item)(cons item lst)))
	   (conscar  (lambda (row lst)(cons (car row) lst)))) ;; conscar should be cheaper than append
       `((runs       . ,(dbi:fold-row conscar '() db "SELECT id FROM runs  WHERE last_update>?;" since-time))
	 (tests      . ,(dbi:fold-row conscar '() db "SELECT id FROM tests WHERE last_update>?;" since-time))