Overview
Comment: | Dispatching works. All pieces in place to implement change checks |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | run-mgr |
Files: | files | file ages | folders |
SHA1: |
da6405a8768a992a8a4231f39ccce8de |
User & Date: | matt on 2017-02-12 22:50:39 |
Other Links: | branch diff | manifest | tags |
Context
2017-02-13
| ||
22:04 | File sensing now working check-in: a83fac111f user: matt tags: run-mgr | |
2017-02-12
| ||
22:50 | Dispatching works. All pieces in place to implement change checks check-in: da6405a876 user: matt tags: run-mgr | |
20:33 | Parts of command line coming together check-in: f8ecc58db2 user: matt tags: run-mgr | |
Changes
Modified megatest.config from [ac7e13f561] to [7728a386c3].
1 2 3 4 | [setup] pktsdirs /tmp/pkts /some/other/source [areas] | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | [setup] pktsdirs /tmp/pkts /some/other/source [areas] # path-to-area map-target-script(future, optional) fullrun tests/fullrun ext-tests ext-tests [contours] # mode-patt/tag-expr quick QUICKPATT/quick # full MAXPATT/long QUICKPATT/quick |
Modified mtut.scm from [a77373f87f] to [f71da7508c].
︙ | ︙ | |||
121 122 123 124 125 126 127 | ("-status" . s) ("-contour" . c) ("-test-patt" . p) ;; idea, enhance margs ("-test-patt" "-testpatt") => yields one value in "-test-patt" ("-mode-patt" . o) ("-tag-expr" . x) ("-item-patt" . i) ;; misc | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | ("-status" . s) ("-contour" . c) ("-test-patt" . p) ;; idea, enhance margs ("-test-patt" "-testpatt") => yields one value in "-test-patt" ("-mode-patt" . o) ("-tag-expr" . x) ("-item-patt" . i) ;; misc ("-start-dir" . S) ("-set-vars" . v) ("-debug" . #f) ;; for *verbosity* > 2 ("-load" . #f) ;; load and exectute a scheme file ("-log" . #f) )) (define *switch-keys* '(("-h" . #f) |
︙ | ︙ | |||
145 146 147 148 149 150 151 152 153 154 155 156 157 158 | (define (lookup-param-by-key key #!key (inlst #f)) (fold (lambda (a res) (if (eq? (cdr a) key) (car a) res)) #f (or inlst *arg-keys*))) ;; Card types: ;; ;; a action ;; u username (Unix) ;; D timestamp ;; T card type | > > > > > > > > > > | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | (define (lookup-param-by-key key #!key (inlst #f)) (fold (lambda (a res) (if (eq? (cdr a) key) (car a) res)) #f (or inlst *arg-keys*))) ;; given a mtutil param, return the old megatest equivalent ;; (define (param-translate param) (or (alist-ref (string->symbol param) '((-tag-expr . "-tagexpr") (-mode-patt . "--modepatt") (-run-name . "-runname") (-test-patt . "-testpatt"))) param)) ;; Card types: ;; ;; a action ;; u username (Unix) ;; D timestamp ;; T card type |
︙ | ︙ | |||
289 290 291 292 293 294 295 | ;; (define (generate-run-pkts mtconf toppath) (with-queue-db mtconf (lambda (pktsdirs pktsdir pdb) (let* ((rgconfdat (find-and-read-config (conc toppath "/rungen.config"))) (rgconf (car rgconfdat)) | | < > > > > > > > > > > > > > > > > > > | | | > | | | | | | | | | | | | | | | | | | | | | | < < | | | > > > > > > > > | > > | > > > > > > > > | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 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 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | ;; (define (generate-run-pkts mtconf toppath) (with-queue-db mtconf (lambda (pktsdirs pktsdir pdb) (let* ((rgconfdat (find-and-read-config (conc toppath "/rungen.config"))) (rgconf (car rgconfdat)) (areas (map car (configf:get-section mtconf "areas"))) (contours (configf:get-section mtconf "contours")) (torun (make-hash-table)) ;; target => ( ... info ... ) (rgentargs (hash-table-keys rgconf))) ;; these are the targets registered for automatically triggering (for-each (lambda (runkey) (let* ((keydats (configf:get-section rgconf runkey))) (for-each (lambda (sense) ;; these are the sense rules (let* ((key (car sense)) (val (cadr sense)) (keyparts (string-split key ":")) (contour (car keyparts)) (ruletype (let ((res (cdr keyparts))) (if (null? res) #f (cadr keyparts)))) (valparts (string-split val)) ;; runname-rule params (runname (make-runname #f)) (mode-tag (string-split (or (configf:lookup mtconf "contours" contour) "") "/")) (mode-patt (if (eq? (length mode-tag) 2)(cadr mode-tag) #f)) (tag-expr (if (null? mode-tag) #f (car mode-tag))) (runstarts (find-pkts pdb '(runstart) `((o . ,contour) (t . ,runkey)))) (rspkts (map (lambda (x) (alist-ref 'pkta x)) runstarts)) (starttimes (map string->number (map (lambda (x) (alist-ref 'D x)) rspkts))) ) ;; (print "rspkts: " rspkts " starttimes: " starttimes) ;; 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 ;; run the ruletype here ;; if already marked to run (#t) don't unmark it. (if (not (configf:lookup torun runkey contour)) (configf:section-var-set! torun runkey contour (list valparts))) (print "key: " key " val: " val) ;; now create a run request packet (if (null? starttimes) ;; primitive, have a previous run? skip for now! (for-each (lambda (area) (let ((area-path (configf:lookup mtconf "areas" area))) (print "area: " area " path: " area-path) (let-values (((uuid pkt) (command-line->pkt "run" (append `(("-target" . ,runkey) ("-run-name" . ,runname) ("-start-dir" . ,area-path)) (if mode-patt `(("-mode-patt" . ,mode-patt)) '()) (if tag-expr `(("-tag-expr" . ,tag-expr)) '()) (if (not (or mode-patt tag-expr)) `(("-item-patt" . "%")) '()))))) (with-output-to-file (conc pktsdir "/" uuid ".pkt") (lambda () (print pkt)))))) areas)))) ;; for each area keydats))) (hash-table-keys rgconf)))))) ;; for each runkey (define (pkt->cmdline pkta) (fold (lambda (a res) (let* ((key (car a)) ;; get the key name (val (cdr a)) (par (lookup-param-by-key key))) ;; (print "key: " key " val: " val " par: " par) (if par (conc res " " (param-translate par) " " val) res))) "megatest -run" pkta)) (define (write-pkt pktsdir uuid pkt) (if pktsdir (with-output-to-file (conc pktsdir "/" uuid ".pkt") (lambda () (print pkt))) (print "ERROR: cannot process commands without a pkts directory"))) ;; collect all needed data and create run pkts for contours with changed inputs ;; (define (dispatch-commands mtconf toppath) (with-queue-db mtconf (lambda (pktsdirs pktsdir pdb) (let* ((rgconfdat (find-and-read-config (conc toppath "/rungen.config"))) (rgconf (car rgconfdat)) (areas (configf:get-section mtconf "areas")) (contours (configf:get-section mtconf "contours")) (pkts (find-pkts pdb '(cmd) '())) (torun (make-hash-table)) ;; target => ( ... info ... ) (rgentargs (hash-table-keys rgconf))) ;; these are the targets registered for automatically triggering (for-each (lambda (pktdat) (let* ((pkta (alist-ref 'pkta pktdat)) (cmdline (pkt->cmdline pkta)) (uuid (alist-ref 'Z pkta)) (logf (conc "logs/" uuid "-run.log"))) (system (conc "NBFAKE_LOG=" logf " nbfake " cmdline)) (mark-processed pdb (list (alist-ref 'id pktdat))) (let-values (((ack-uuid ack-pkt) (add-z-card (construct-sdat 'P uuid 'T "runstart" 'c (alist-ref 'o pkta) ;; THIS IS WRONG! SHOULD BE 'c 't (alist-ref 't pkta))))) (write-pkt pktsdir ack-uuid ack-pkt)))) pkts))))) (define (get-pkts-dir mtconf) (let ((pktsdirs (configf:lookup mtconf "setup" "pktsdirs")) (pktsdir (if pktsdirs (car (string-split pktsdirs " ")) #f))) pktsdir)) |
︙ | ︙ | |||
399 400 401 402 403 404 405 | ;; (for-each ;; (lambda (key) ;; (if (not (member key *legal-params*)) ;; (hash-table-delete! adjargs key))) ;; we need to delete any params intended for mtutil ;; (hash-table-keys adjargs)) (let-values (((uuid pkt) (command-line->pkt *action* adjargs))) | | < < < < < | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | ;; (for-each ;; (lambda (key) ;; (if (not (member key *legal-params*)) ;; (hash-table-delete! adjargs key))) ;; we need to delete any params intended for mtutil ;; (hash-table-keys adjargs)) (let-values (((uuid pkt) (command-line->pkt *action* adjargs))) (write-pkt pktsdir uuid pkt)))) ((dispatch import rungen) (let* ((mtconfdat (simple-setup (args:get-arg "-start-dir"))) (mtconf (car mtconfdat)) (toppath (configf:lookup mtconf "dyndat" "toppath"))) (case (string->symbol *action*) ((import) (load-pkts-to-db mtconf)) ;; import pkts ((rungen) (generate-run-pkts mtconf toppath)) |
︙ | ︙ |