Megatest

Check-in [ce0b996d14]
Login
Overview
Comment:Merged in changes made by Ritika for a right mouse menu for buttons. Not complete but xterm launching works
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.61
Files: files | file ages | folders
SHA1: ce0b996d14374f9a328418d9820cb3945ded9c2e
User & Date: mrwellan on 2016-06-28 16:46:43
Other Links: branch diff | manifest | tags
Context
2016-06-29
18:10
Refactored dashboard code to make plugging in a new vector graphics view easier check-in: 4809ab9726 user: mrwellan tags: v1.61
2016-06-28
16:46
Merged in changes made by Ritika for a right mouse menu for buttons. Not complete but xterm launching works check-in: ce0b996d14 user: mrwellan tags: v1.61
01:06
Added example of query for finding run effiency check-in: 3ceaf15802 user: matt tags: v1.61
Changes

Modified dashboard.scm from [00e45e59ce] to [f1d9d3d3f8].

47
48
49
50
51
52
53

54
55
56
57
58
59
60
61
62
63
64
65

66
67
68
69
70
71
72
  version " megatest-version "
  license GPL, Copyright (C) Matt Welland 2012-2016

Usage: dashboard [options]
  -h                   : this help
  -server host:port    : connect to host:port instead of db access
  -test run-id,test-id : control test identified by testid

  -guimonitor          : control panel for runs

Misc
  -rows N         : set number of rows
"))

;; process args
(define remargs (args:get-args 
		 (argv)
		 (list  "-rows"
			"-run"
			"-test"

			"-debug"
			"-host" 
			"-transport"
			) 
		 (list  "-h"
			"-use-server"
			"-guimonitor"







>












>







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  version " megatest-version "
  license GPL, Copyright (C) Matt Welland 2012-2016

Usage: dashboard [options]
  -h                   : this help
  -server host:port    : connect to host:port instead of db access
  -test run-id,test-id : control test identified by testid
  -xterm run-id,test-id : Start a new xterm with specified run-id and test-id
  -guimonitor          : control panel for runs

Misc
  -rows N         : set number of rows
"))

;; process args
(define remargs (args:get-args 
		 (argv)
		 (list  "-rows"
			"-run"
			"-test"
                        "-xterm"
			"-debug"
			"-host" 
			"-transport"
			) 
		 (list  "-h"
			"-use-server"
			"-guimonitor"
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763


























1764



























1765
1766
1767
1768
1769
1770
1771
1772
	(set! bdylst (cons (apply iup:vbox (reverse res)) bdylst))
	(loop (+ runnum 1) 0 (make-vector ntests) '()))
       (else
	(let* ((button-key (mkstr runnum testnum))
	       (butn       (iup:button "" ;; button-key 
				       #:size "60x15" 
				       #:expand "HORIZONTAL"
				       #:fontsize "10" 
				       #:action (lambda (x)
						  (let* ((toolpath (car (argv)))
							 (buttndat (hash-table-ref (d:alldat-buttondat *alldat*) button-key))
							 (test-id  (db:test-get-id (vector-ref buttndat 3)))
							 (run-id   (db:test-get-run_id (vector-ref buttndat 3)))
							 (cmd  (conc toolpath " -test " run-id "," test-id "&")))
					;(print "Launching " cmd)


























						    (system cmd))))))



























	  (hash-table-set! (d:alldat-buttondat *alldat*) button-key (vector 0 "100 100 100" button-key #f #f)) 
	  (vector-set! testvec testnum butn)
	  (loop runnum (+ testnum 1) testvec (cons butn res))))))
    ;; now assemble the hdrlst and bdylst and kick off the dialog
    (iup:show
     (iup:dialog 
      #:title (conc "Megatest dashboard " (current-user-name) ":" *toppath*)
      #:menu (dcommon:main-menu)







|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
	(set! bdylst (cons (apply iup:vbox (reverse res)) bdylst))
	(loop (+ runnum 1) 0 (make-vector ntests) '()))
       (else
	(let* ((button-key (mkstr runnum testnum))
	       (butn       (iup:button "" ;; button-key 
				       #:size "60x15" 
				       #:expand "HORIZONTAL"
				       #:fontsize "10"
				       ;; :action (lambda (x)
				       ;; 	  (let* ((toolpath (car (argv)))
				       ;; 		 (buttndat (hash-table-ref (d:alldat-buttondat *alldat*) button-key))
				       ;; 		 (test-id  (db:test-get-id (vector-ref buttndat 3)))
				       ;; 		 (run-id   (db:test-get-run_id (vector-ref buttndat 3)))
				       ;; 		 (cmd  (conc toolpath " -test " run-id "," test-id "&")))
				       ;; ;(print "Launching " cmd)
				       ;; 	    (system cmd)))
                                       #:button-cb (lambda (obj a pressed x y btn . rem)
                                                     (print "pressed= " pressed " x= " x " y= " y " rem=" rem " btn=" btn " string? " (string? btn))
                                                     (if  (substring-index "3" btn)
                                                          (if (eq? pressed 1)
                                                              (let* ((toolpath (car (argv)))
                                                                     (buttndat (hash-table-ref (d:alldat-buttondat *alldat*) button-key))
                                                                     (test-id  (db:test-get-id (vector-ref buttndat 3)))
                                                                     (run-id   (db:test-get-run_id (vector-ref buttndat 3)))
                                                                     (test-name (db:test-get-testname (rmt:get-test-info-by-id run-id test-id)))
                                                                     (popup-menu (iup:menu 
                                                                                  (iup:menu-item
                                                                                   "Run"
                                                                                   (iup:menu              
                                                                                    (iup:menu-item
                                                                                     "Rerun"
                                                                                     #:action
                                                                                     (lambda (obj)(print "Rerun")))))
                                                                                  (iup:menu-item
                                                                                   "Test"
                                                                                   (iup:menu 
                                                                                    (iup:menu-item
                                                                                     "Start xterm"
                                                                                     #:action
                                                                                     (lambda (obj)
                                                                                       (let* ((cmd (conc toolpath " -xterm " run-id "," test-id "&")))
                                                                                         (system cmd))))
                                                                                    (iup:menu-item
                                                                                     "Edit testconfig"
                                                                                     #:action
                                                                                     (lambda (obj)
                                                                                       (let* ((all-tests (tests:get-all))
                                                                                              (editor (or (get-environment-variable "VISUAL")
                                                                                                          (get-environment-variable "EDITOR") "gvim"))
                                                                                              (tconfig (conc (hash-table-ref all-tests test-name) "/testconfig"))
                                                                                              (cmd (conc (if (string-search "\\b(vim?|nano|pico)\\b")
                                                                                                             (conc "xterm -e " editor)
                                                                                                             editor)
                                                                                                         " " tconfig)))
                                                                                         (system cmd))))
                                                                                    )))))
                                                                (iup:show popup-menu
                                                                          #:x 'mouse
                                                                          #:y 'mouse
                                                                          #:modal? "NO")
                                                                (print "got here")))
                                                         (if (eq? pressed 0)
                                                             (let* ((toolpath (car (argv)))
                                                                    (buttndat (hash-table-ref (d:alldat-buttondat *alldat*) button-key))
                                                                    (test-id  (db:test-get-id (vector-ref buttndat 3)))
                                                                    (run-id   (db:test-get-run_id (vector-ref buttndat 3)))
                                                                    (cmd  (conc toolpath " -test " run-id "," test-id "&")))
                                                               (system cmd)))
                                                         )))))
          (hash-table-set! (d:alldat-buttondat *alldat*) button-key (vector 0 "100 100 100" button-key #f #f)) 
	  (vector-set! testvec testnum butn)
	  (loop runnum (+ testnum 1) testvec (cons butn res))))))
    ;; now assemble the hdrlst and bdylst and kick off the dialog
    (iup:show
     (iup:dialog 
      #:title (conc "Megatest dashboard " (current-user-name) ":" *toppath*)
      #:menu (dcommon:main-menu)
1929
1930
1931
1932
1933
1934
1935














1936
1937
1938
1939
1940
1941
1942
	(if (and (number? run-id)
		 (number? test-id)
		 (>= test-id 0))
	    (examine-test run-id test-id)
	    (begin
	      (debug:print 3 *default-log-port* "INFO: tried to open test with invalid run-id,test-id. " (args:get-arg "-test"))
	      (exit 1)))))














     ((args:get-arg "-guimonitor")
      (gui-monitor (d:alldat-dblocal data)))
     (else
      (set! uidat (make-dashboard-buttons data ;; (d:alldat-dblocal data)
					  (d:alldat-numruns data)
					  (d:alldat-num-tests data)
					  (d:alldat-dbkeys data)







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







1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
	(if (and (number? run-id)
		 (number? test-id)
		 (>= test-id 0))
	    (examine-test run-id test-id)
	    (begin
	      (debug:print 3 *default-log-port* "INFO: tried to open test with invalid run-id,test-id. " (args:get-arg "-test"))
	      (exit 1)))))
     ((args:get-arg "-xterm") ;; run-id,test-id
      (let* ((dat     (let ((d (map string->number (string-split (args:get-arg "-xterm") ","))))
			(if (> (length d) 1)
			    d
			    (list #f #f))))
	     (run-id  (car dat))
	     (test-id (cadr dat)))
	(if (and (number? run-id)
		 (number? test-id)
		 (>= test-id 0))
	    (dcommon:examine-xterm run-id test-id)
	    (begin
	      (debug:print 3 "INFO: tried to open xterm with invalid run-id,test-id. " (args:get-arg "-xterm"))
	      (exit 1)))))
     ((args:get-arg "-guimonitor")
      (gui-monitor (d:alldat-dblocal data)))
     (else
      (set! uidat (make-dashboard-buttons data ;; (d:alldat-dblocal data)
					  (d:alldat-numruns data)
					  (d:alldat-num-tests data)
					  (d:alldat-dbkeys data)

Modified dcommon.scm from [02601e6d3a] to [ba01e4089c].

316
317
318
319
320
321
322
323


























324
325
326
327
328
329
330
	       (item-path  (vector-ref hed 2))
	       (state      (vector-ref hed 3))
	       (status     (vector-ref hed 4))
	       (newitem    (list test-name item-path (list test-id state status))))
	  (if (null? tal)
	      (reverse (cons newitem res))
	      (loop (car tal)(cdr tal)(cons newitem res)))))))
	  



























;;======================================================================
;; D A T A   T A B L E S
;;======================================================================

;; Table of keys
(define (dcommon:keys-matrix rawconfig)







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
	       (item-path  (vector-ref hed 2))
	       (state      (vector-ref hed 3))
	       (status     (vector-ref hed 4))
	       (newitem    (list test-name item-path (list test-id state status))))
	  (if (null? tal)
	      (reverse (cons newitem res))
	      (loop (car tal)(cdr tal)(cons newitem res)))))))

(define (dcommon:examine-xterm run-id test-id)
  (let*
      ((testdat (rmt:get-test-info-by-id run-id test-id)))
       (if (not testdat)
	(begin
	  (debug:print 2 "ERROR: No test data found for test " test-id ", exiting")
	  (exit 1))
        (let*
            ((rundir        (if testdat 
				  (db:test-get-rundir testdat)
				  logfile))
             (testfullname  (if testdat (db:test-get-fullname testdat) "Gathering data ..."))
             (xterm      (lambda ()
                           (if (directory-exists? rundir)
                               (let* ((shell (if (get-environment-variable "SHELL") 
                                                (conc "-e " (get-environment-variable "SHELL"))
                                                ""))
                                      (command (conc "cd " rundir 
                                                     ";mt_xterm -T \"" (string-translate testfullname "()" "  ") "\" " shell "&")))
                                 (print "Command =" command)
                                 (common:without-vars
                                  command
                                  "MT_.*"))
                               (message-window  (conc "Directory " rundir " not found"))))))
          (xterm)
          (print "Adding xterm code")))))

;;======================================================================
;; D A T A   T A B L E S
;;======================================================================

;; Table of keys
(define (dcommon:keys-matrix rawconfig)

Modified megatest.scm from [3054ee349a] to [46dfab0f2e].

34
35
36
37
38
39
40

41
42
43
44
45
46
47
(declare (uses launch))
(declare (uses server))
(declare (uses client))
(declare (uses tests))
(declare (uses genexample))
(declare (uses daemon))
(declare (uses db))


(declare (uses tdb))
(declare (uses mt))
(declare (uses api))
(declare (uses tasks)) ;; only used for debugging.
(declare (uses env))








>







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
(declare (uses launch))
(declare (uses server))
(declare (uses client))
(declare (uses tests))
(declare (uses genexample))
(declare (uses daemon))
(declare (uses db))
(declare (uses dcommon))

(declare (uses tdb))
(declare (uses mt))
(declare (uses api))
(declare (uses tasks)) ;; only used for debugging.
(declare (uses env))

Modified run-eff.sql from [61ec46f56a] to [601963fd42].






1













select run_id,time(max(event_time+run_duration)-min(event_time),'unixepoch') AS wall_runtime,time(max(run_duration),'unixepoch') AS max_duration,testname from tests where item_path != '' group by run_id;








>
>
>
>
>
|
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
.mode col
.head on
select runs.runname,num_items,printf("%.2f",wall_runtime) AS runtime,printf("%.2f",max_duration) AS duration,ratio,testname from
   (select run_id,
          count(id) AS num_items,
          (max(event_time+run_duration)-min(event_time))/3600.0 AS wall_runtime,
          max(run_duration)/3600.0 AS max_duration,
          (max(event_time+run_duration)-min(event_time))/max(run_duration) AS ratio,
          testname from tests where item_path != '' AND state != 'DELETED'
          group by run_id
          order by ratio DESC) AS dat
    join runs on dat.run_id=runs.id
WHERE ratio > 1
AND runs.state != 'deleted';