Megatest

Check-in [46f8753ee7]
Login
Overview
Comment:tidied up schema/db
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: 46f8753ee7f8be86d220525a0ced779d491256ac
User & Date: matt on 2015-06-22 23:12:08
Other Links: branch diff | manifest | tags
Context
2015-06-23
00:24
Gathered runs data check-in: 02c50a4566 user: matt tags: v1.60
2015-06-22
23:12
tidied up schema/db check-in: 46f8753ee7 user: matt tags: v1.60
21:42
more done check-in: 9d422f5846 user: matt tags: v1.60
Changes

Modified multi-dboard.scm from [3e59d034b9] to [889dfc68fc].

264
265
266
267
268
269
270
271
272
273
274
275
276

277
278
279
280
281
282
283
284
285
286
287
288
289
290
291

292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
    (set-busy-handler! db (busy-timeout 10000))
    (for-each
     (lambda (qry)
       (exec (sql db qry)))
     (list 
      "CREATE TABLE IF NOT EXISTS vars       (id INTEGER PRIMARY KEY,key TEXT, val TEXT, CONSTRAINT varsconstraint UNIQUE (key));"
      "CREATE TABLE IF NOT EXISTS dashboards (
          id   INTEGER PRIMARY KEY,
          pid  INTEGER,
          user TEXT,
          host TEXT,
          port INTEGER,
          start_time TIMESTAMP DEFAULT (strftime('%s','now'))

        );"
      ))
    db))

   
;; register a dashboard 
;;
(define (mddb:register-dashboard port)
  (let* ((pid      (current-process-id))
	 (hostname (get-host-name))
	 (username (current-user-name)) ;; (car userinfo)))
	 (db      (mddb:open-db)))
    (print "Register monitor, pid: " pid ", hostname: " hostname ", port: " port ", username: " username)
    (exec (sql db "INSERT OR REPLACE INTO dashboards (pid,user,host,port) VALUES (?,?,?,?);")
	   pid hostname port username)))


;; unregister a monitor
;;
(define (mddb:unregister-dashboard areadat host port)
  (let* ((db      (mddb:open-db)))
    (print "Register unregister monitor, host:port=" host ":" port)
    (exec (sql db "DELETE FROM monitors WHERE host=? AND port=?;")
	   host port)))

;;======================================================================
;; T R E E 
;;======================================================================

;; <area> - <target - ... > - <runname> - <test> - <itempath - ...>








|
|
|
|
|
|
>













|
|
>



|


|
|







264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
    (set-busy-handler! db (busy-timeout 10000))
    (for-each
     (lambda (qry)
       (exec (sql db qry)))
     (list 
      "CREATE TABLE IF NOT EXISTS vars       (id INTEGER PRIMARY KEY,key TEXT, val TEXT, CONSTRAINT varsconstraint UNIQUE (key));"
      "CREATE TABLE IF NOT EXISTS dashboards (
          id         INTEGER PRIMARY KEY,
          pid        INTEGER,
          username   TEXT,
          hostname   TEXT,
          portnum    INTEGER,
          start_time TIMESTAMP DEFAULT (strftime('%s','now')),
             CONSTRAINT hostport UNIQUE (hostname,portnum)
        );"
      ))
    db))

   
;; register a dashboard 
;;
(define (mddb:register-dashboard port)
  (let* ((pid      (current-process-id))
	 (hostname (get-host-name))
	 (username (current-user-name)) ;; (car userinfo)))
	 (db      (mddb:open-db)))
    (print "Register monitor, pid: " pid ", hostname: " hostname ", port: " port ", username: " username)
    (exec (sql db "INSERT OR REPLACE INTO dashboards (pid,username,hostname,portnum) VALUES (?,?,?,?);")
	   pid username hostname port)
    (close-database db)))

;; unregister a monitor
;;
(define (mddb:unregister-dashboard host port)
  (let* ((db      (mddb:open-db)))
    (print "Register unregister monitor, host:port=" host ":" port)
    (exec (sql db "DELETE FROM dashboards WHERE hostname=? AND portnum=?;") host port)
    (close-database db)))

;;======================================================================
;; T R E E 
;;======================================================================

;; <area> - <target - ... > - <runname> - <test> - <itempath - ...>

616
617
618
619
620
621
622

623
624
625
626
627
628
629
;; ease debugging by loading ~/.dashboardrc
(let ((debugcontrolf (conc (get-environment-variable "HOME") "/.dashboardrc")))
  (if (file-exists? debugcontrolf)
      (load debugcontrolf)))

(let-values 
 (((con port)(dboard:server-start #f)))

 ;; got here, monitor/dashboard was started
 (mddb:register-dashboard port)
 (thread-start! (make-thread (lambda ()(dboard:server-service con port)) "server service"))
 (dboard:make-window 0)
 (mddb:unregister-dashboard (get-host-name) port)
 (dboard:server-close con port))








>
|
|
|
|
|
|

618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
;; ease debugging by loading ~/.dashboardrc
(let ((debugcontrolf (conc (get-environment-variable "HOME") "/.dashboardrc")))
  (if (file-exists? debugcontrolf)
      (load debugcontrolf)))

(let-values 
 (((con port)(dboard:server-start #f)))
 (let ((portnum   (if (string? port)(string->number port) port)))
   ;; got here, monitor/dashboard was started
   (mddb:register-dashboard portnum)
   (thread-start! (make-thread (lambda ()(dboard:server-service con portnum)) "server service"))
   (dboard:make-window 0)
   (mddb:unregister-dashboard (get-host-name) portnum)
   (dboard:server-close con port)))