Megatest

Check-in [738e6abeed]
Login
Overview
Comment:Fixed area-script trigger in mtutil to apply contour options to script
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65 | v1.6518
Files: files | file ages | folders
SHA1: 738e6abeed9a984f31700812d084cd6ec40fe47d
User & Date: jmoon18 on 2018-12-19 15:48:35
Other Links: branch diff | manifest | tags
Context
2018-12-19
15:50
Updated version file check-in: c066b79771 user: jmoon18 tags: v1.65, v1.6518
15:48
Fixed area-script trigger in mtutil to apply contour options to script check-in: 738e6abeed user: jmoon18 tags: v1.65, v1.6518
2018-12-06
16:56
fixed bug introduced in last commit where run-a-command was not backgrounding check-in: 59a626c53f user: bjbarcla tags: v1.65, v1.6517
Changes

Modified mtut.scm from [a094a5c2f1] to [51190d4e0c].

1011
1012
1013
1014
1015
1016
1017
1018








1019
1020
1021
1022
1023
1024
1025
			     (let* ((script (car cmd))
				(params (cdr cmd))
				(cmd    (conc script " " contour " " area " " runkey " " std-runname " " action " " params))
				(res    (handle-exceptions
					    exn
					    #f
					  (print "Running " cmd)
					  (with-input-from-pipe cmd read-lines))))








			     (if (and res (not (null? res)))
			       (let* ((parts       (string-split (car res))) ;;
				      (rem-lines   (cdr res))
				      (num-parts   (length parts))
				      (last-change (string->number (if (> num-parts 0)(car parts) "abc")))  ;; force no run if not a number returned
				      (new-target  (if (> num-parts 1)
						       (cadr parts)







|
>
>
>
>
>
>
>
>







1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
			     (let* ((script (car cmd))
				(params (cdr cmd))
				(cmd    (conc script " " contour " " area " " runkey " " std-runname " " action " " params))
				(res    (handle-exceptions
					    exn
					    #f
					  (print "Running " cmd)
					  (with-input-from-pipe cmd read-lines)))
                                (cval       (or (configf:lookup mtconf "contours" contour) ""))
                                (cval-alist (common:val->alist cval))                     ;; BEWARE ... NOT the same val-alist as above!
                                ;;(areas      (val-alist->areas cval-alist))
                                (selector   (alist-ref 'selector cval-alist))
                                (mode-tag   (and selector (string-split-fields "/" selector #:infix)))
                                (mode-patt  (and mode-tag (if (eq? (length mode-tag) 2)(cadr mode-tag) #f)))
                                (tag-expr   (and mode-tag (if (null? mode-tag) #f (car mode-tag))))
                              )
			     (if (and res (not (null? res)))
			       (let* ((parts       (string-split (car res))) ;;
				      (rem-lines   (cdr res))
				      (num-parts   (length parts))
				      (last-change (string->number (if (> num-parts 0)(car parts) "abc")))  ;; force no run if not a number returned
				      (new-target  (if (> num-parts 1)
						       (cadr parts)
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
                        	      (starttimes (common:get-pkt-times rspkts)) ;; sort by age (youngest first) and delete duplicates by target
                        	      (last-run   (if (null? starttimes) ;; if '() then it has never been run, else get the max
                                          0
                                        (apply max (map cdr starttimes))))

                                     ;; (last-run  9) ;; I think we can do a more valid calculation for this based on the run started packets for this particular area and target
                                      (reason "Area-script-triggered")
                                      (mode-patt #f)
                                      (tag-expr #f)
				      (sched #f)
				      (message     (if (null? rem-lines)
						       cmd
						       (string-intersperse rem-lines "-")))
				      (need-run    (> last-change last-run)))
				 (print "last-change: " last-change " last-run: " last-run " need-run: " need-run)
				 (if need-run







|
|







1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
                        	      (starttimes (common:get-pkt-times rspkts)) ;; sort by age (youngest first) and delete duplicates by target
                        	      (last-run   (if (null? starttimes) ;; if '() then it has never been run, else get the max
                                          0
                                        (apply max (map cdr starttimes))))

                                     ;; (last-run  9) ;; I think we can do a more valid calculation for this based on the run started packets for this particular area and target
                                      (reason "Area-script-triggered")
                                      ;;(mode-patt #f)
                                      ;;(tag-expr #f)
				      (sched #f)
				      (message     (if (null? rem-lines)
						       cmd
						       (string-intersperse rem-lines "-")))
				      (need-run    (> last-change last-run)))
				 (print "last-change: " last-change " last-run: " last-run " need-run: " need-run)
				 (if need-run