834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
|
(last-sync (if (null? synctimes) ;; if '() then it has never been run, else get the max
0
(apply max (map cdr synctimes))))
)
(let ((delta (lambda (x)
(round (/ (- (current-seconds) x) 60)))))
(print "runkey: " runkey ", ruletype: " ruletype ", action: " action ", last-run: " last-run " time since; last-run: " (delta last-run) ", last-sync: " (delta last-sync)))
(print "val-alist=" val-alist " runtrans=" runtrans)
;; look in runstarts for matching runs by target and contour
;; get the timestamp for when that run started and pass it
;; to the rule logic here where "ruletype" will be applied
;; if it comes back "changed" then proceed to register the runs
(case (string->symbol (or ruletype "no-such-rule"))
|
>
>
|
|
>
>
|
>
>
|
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
|
(last-sync (if (null? synctimes) ;; if '() then it has never been run, else get the max
0
(apply max (map cdr synctimes))))
)
(let ((delta (lambda (x)
(round (/ (- (current-seconds) x) 60)))))
(if (args:get-arg "-target")
(if (string= (args:get-arg "-target") runkey)
(begin (print "runkey: " runkey ", ruletype: " ruletype ", action: " action ", last-run: " last-run " time since; last-run: " (delta last-run) ", last-sync: " (delta last-sync))
(print "val-alist=" val-alist " runtrans=" runtrans))
(if #f (print "skipping: " runkey)))
(begin (print "runkey: " runkey ", ruletype: " ruletype ", action: " action ", last-run: " last-run " time since; last-run: " (delta last-run) ", last-sync: " (delta last-sync))
(print "val-alist=" val-alist " runtrans=" runtrans))
))
;; look in runstarts for matching runs by target and contour
;; get the timestamp for when that run started and pass it
;; to the rule logic here where "ruletype" will be applied
;; if it comes back "changed" then proceed to register the runs
(case (string->symbol (or ruletype "no-such-rule"))
|
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
|
;; the script is called like this: scriptname contour runkey std-runname action extra_param1 extra_param2 ...
(for-each
(lambda (cmd)
;;(print "cmd: " cmd)
;;(print "Areas: " all-areas)
(for-each
(lambda (area)
(if (area-allowed? area "area-needs-to-be-run" runkey contour #f) ;; is this area to be handled (from areas=a,b,c OR using areafn=abcfn and *area-checks* ...)
(let* ((script (car cmd))
(params (cdr cmd))
(cmd (conc script " " contour " " area " " runkey " " std-runname " " action " " params))
(res (handle-exceptions
exn
#f
|
>
>
>
>
|
|
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
|
;; the script is called like this: scriptname contour runkey std-runname action extra_param1 extra_param2 ...
(for-each
(lambda (cmd)
;;(print "cmd: " cmd)
;;(print "Areas: " all-areas)
(for-each
(lambda (area)
;Add code to check whether area is valid
(if
(if (args:get-arg "-target")
(if (string= (args:get-arg "-target") runkey) (area-allowed? area "area-needs-to-be-run" runkey contour #f) #f)
(area-allowed? area "area-needs-to-be-run" runkey contour #f))
(let* ((script (car cmd))
(params (cdr cmd))
(cmd (conc script " " contour " " area " " runkey " " std-runname " " action " " params))
(res (handle-exceptions
exn
#f
|
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
|
(aval-alist (common:val->alist aval))
(targets (map-targets mtconf aval-alist runkey area contour)))
(pp targets)
(for-each (lambda (target) (create-run-pkt mtconf action area runkey target new-runname mode-patt
tag-expr pktsdir reason contour sched dbdest append
runtrans)) targets)
;;(create-run-pkt mtconf action area runkey target runname
;; pktsdir reason contour dbdest append
;; runtrans)
(print "key-msg: " key-msg)
;;(push-run-spec torun contour
;; (if optional ;; we need to be able to differentiate same contour, different behavior.
;; (conc runkey ":" optional) ;; NOTE: NOT COMPLETELY IMPLEMENTED. DO NOT USE
;; runkey)
;; key-msg)
))))))) all-areas)
) val-alist)) ;; iterate over the param split by ;\s*
;; fossil scm based triggers
;;
((fossil)
(for-each
(lambda (fspec)
|
>
|
|
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
|
(aval-alist (common:val->alist aval))
(targets (map-targets mtconf aval-alist runkey area contour)))
(pp targets)
(for-each (lambda (target) (create-run-pkt mtconf action area runkey target new-runname mode-patt
tag-expr pktsdir reason contour sched dbdest append
runtrans)) targets)
;; Add filter for targets
;;(create-run-pkt mtconf action area runkey target runname
;; pktsdir reason contour dbdest append
;; runtrans)
(print "key-msg: " key-msg)
;;(push-run-spec torun contour
;; (if optional ;; we need to be able to differentiate same contour, different behavior.
;; (conc runkey ":" optional) ;; NOTE: NOT COMPLETELY IMPLEMENTED. DO NOT USE
;; runkey)
;; key-msg)
))))))) (filter (lambda (x) (if (not (args:get-arg "-area")) #t (if (string= x (args:get-arg "-area")) #t #f))) all-areas))
) val-alist)) ;; iterate over the param split by ;\s*
;; fossil scm based triggers
;;
((fossil)
(for-each
(lambda (fspec)
|