Overview
Comment: | wip |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.90-fix-modes |
Files: | files | file ages | folders |
SHA1: |
1d37efe6c5efff05af25061709a8aa6e |
User & Date: | matt on 2024-02-09 20:38:51 |
Other Links: | branch diff | manifest | tags |
Context
2024-02-11
| ||
16:41 | Moved remainder of configf into configfmod check-in: c2d750aad9 user: matt tags: v1.90-fix-modes | |
2024-02-09
| ||
20:38 | wip check-in: 1d37efe6c5 user: matt tags: v1.90-fix-modes | |
19:26 | get nfs, /tmp modes working check-in: ddfaeac922 user: matt tags: v1.90-fix-modes | |
Changes
Modified dashboard-transport-mode.scm from [770f5f2018] to [d999443292].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ;;====================================================================== ;; set up transport, db cache and sync methods ;; ;; sync-method: 'original, 'attach or 'none ;; cache-method: 'tmp or 'none ;; rmt:transport-mode: 'http, 'tcp, 'nfs ;; ;; NOTE: NOT ALL COMBINATIONS WORK ;; ;;====================================================================== ;; uncomment this block to test without tcp or cachedb (dbfile:sync-method 'none) (dbfile:cache-method 'none) | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ;;====================================================================== ;; set up transport, db cache and sync methods ;; ;; sync-method: 'original, 'attach or 'none ;; cache-method: 'tmp or 'none ;; rmt:transport-mode: 'http, 'tcp, 'nfs ;; ;; 'auto ;; read-only query and no servers started - mrah/ ;; ;; NOTE: NOT ALL COMBINATIONS WORK ;; ;;====================================================================== ;; uncomment this block to test without tcp or cachedb (dbfile:sync-method 'none) (dbfile:cache-method 'none) |
︙ | ︙ |
Modified megatest.scm from [e49309db33] to [878b994649].
︙ | ︙ | |||
1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 | (api:queue-processor) (thread-start! (make-thread api:print-db-stats "print-db-stats")) (if dbfname (tt:start-server tl #f dbfname api:tcp-dispatch-request-make-handler keys) (begin (debug:print 0 *default-log-port* "ERROR: transport mode is tcp - -db is required.") (exit 1))))) (else (debug:print 0 *default-log-port* "ERROR: rmt:transport-mode value not recognised "(rmt:transport-mode)))) (set! *didsomething* #t))) ;; The adjutant is a bit different, it does NOT run (launch:setup) as it is not necessarily tied to ;; a specific Megatest area. Detail are being hashed out and this may change. ;; (if (args:get-arg "-adjutant") | > | 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | (api:queue-processor) (thread-start! (make-thread api:print-db-stats "print-db-stats")) (if dbfname (tt:start-server tl #f dbfname api:tcp-dispatch-request-make-handler keys) (begin (debug:print 0 *default-log-port* "ERROR: transport mode is tcp - -db is required.") (exit 1))))) ((nfs)(debug:print 0 *default-log-port* "WARNING: server start called in nfs mode '"(rmt:transport-mode))) (else (debug:print 0 *default-log-port* "ERROR: rmt:transport-mode value not recognised "(rmt:transport-mode)))) (set! *didsomething* #t))) ;; The adjutant is a bit different, it does NOT run (launch:setup) as it is not necessarily tied to ;; a specific Megatest area. Detail are being hashed out and this may change. ;; (if (args:get-arg "-adjutant") |
︙ | ︙ |
Modified rmtmod.scm from [08616bdb4f] to [f16c2416fe].
︙ | ︙ | |||
948 949 950 951 952 953 954 | (begin (debug:print-info 0 *default-log-port* "hh-dat="hh-dat) #f))) #f))) ;; not true strickly speaking, might be runremote was not yet initialized. (define (make-and-init-remote areapath) (case (rmt:transport-mode) | < | 948 949 950 951 952 953 954 955 956 957 958 959 960 961 | (begin (debug:print-info 0 *default-log-port* "hh-dat="hh-dat) #f))) #f))) ;; not true strickly speaking, might be runremote was not yet initialized. (define (make-and-init-remote areapath) (case (rmt:transport-mode) ((tcp) (tt:make-remote areapath)) (else #f))) ;; how to make area-dat (define (rmt:set-ttdat areapath ttdat) (if ttdat ttdat |
︙ | ︙ |
Modified runsmod.scm from [98c156694e] to [251bedfaeb].
︙ | ︙ | |||
1186 1187 1188 1189 1190 1191 1192 | (lambda () ;; jobtools maxload is useful for where the full Megatest run is done on one machine (if (and (not (rmt:on-homehost?)) maxload) ;; only gate if maxload is specified, NOTE: maxload is normalized, i.e. load=1 means all cpus fully utilized (common:wait-for-normalized-load maxload "Waiting for load to drop before starting more tests" #f)) ;; jobtools maxhomehostload is intended to prevent overloading on the homehost which can cause database corruption issues | | | > | > | 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 | (lambda () ;; jobtools maxload is useful for where the full Megatest run is done on one machine (if (and (not (rmt:on-homehost?)) maxload) ;; only gate if maxload is specified, NOTE: maxload is normalized, i.e. load=1 means all cpus fully utilized (common:wait-for-normalized-load maxload "Waiting for load to drop before starting more tests" #f)) ;; jobtools maxhomehostload is intended to prevent overloading on the homehost which can cause database corruption issues ;; (if maxhomehostload ;; (common:wait-for-homehost-load ;; maxhomehostload ;; (conc "Waiting for homehost load to drop below normalized value of " maxhomehostload))) ))) (if (and (not (null? prereqs-not-met)) (runs:lownoise (conc "waiting on tests " prereqs-not-met hed) 60)) (debug:print-info 2 *default-log-port* "waiting on tests; " (string-intersperse (runs:mixed-list-testname-and-testrec->list-of-strings prereqs-not-met) ", "))) |
︙ | ︙ |
Modified servermod.scm from [cbd4da6b54] to [5384b281b4].
︙ | ︙ | |||
270 271 272 273 274 275 276 | ;; check the .servinfo directory, are there other servers running on this ;; or another host? ;; ;; returns #t => ok to start another server ;; #f => not ok to start another server ;; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < > | < < > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 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 | ;; check the .servinfo directory, are there other servers running on this ;; or another host? ;; ;; returns #t => ok to start another server ;; #f => not ok to start another server ;; ;; (define (server:minimal-check areapath) ;; (server:clean-up-old areapath) ;; (let* ((srvdir (server:get-servinfo-dir areapath)) ;; (conc areapath"/.servinfo")) ;; (servrs (glob (conc srvdir"/*"))) ;; (thishostip (server:get-best-guess-address (get-host-name))) ;; (thisservrs (glob (conc srvdir"/"thishostip":*"))) ;; (homehostinf (server:choose-server areapath 'homehost)) ;; (havehome (car homehostinf)) ;; (wearehome (cdr homehostinf))) ;; (debug:print-info 0 *default-log-port* thishostip", have homehost: "havehome", we are homehost: "wearehome ;; ", numservers: "(length thisservrs)) ;; (cond ;; ((not havehome) #t) ;; no homehost yet, go for it ;; ((and havehome wearehome (< (length thisservrs) 20)) #t) ;; we are home and less than 20 servers, ok to start another ;; ((and havehome (not wearehome)) #f) ;; we are not the home host ;; ((and havehome wearehome (>= (length thisservrs) 20)) #f) ;; have enough running ;; (else ;; (debug:print 0 *default-log-port* "WARNING: Unrecognised scenario, servrs="servrs", thishostip="thishostip", thisservrs="thisservrs) ;; #t)))) (define server-last-start 0) ;; oldest server alive determines host then choose random of youngest ;; five servers on that host ;; ;; mode: ;; best - get best server (random of newest five) ;; home - get home host based on oldest server ;; info - print info ;; (define (server:choose-server areapath #!optional (mode 'best)) ;; ;; age is current-starttime ;; ;; find oldest alive ;; ;; 1. sort by age ascending and ping until good ;; ;; find alive rand from youngest ;; ;; 1. sort by age descending ;; ;; 2. take five ;; ;; 3. check alive, discard if not and repeat ;; ;; first we clean up old server files ;; (assert (eq? (rmt:transport-mode) 'http) "FATAL: server:run called with rmt:transport-mode="(rmt:transport-mode)) ;; (server:clean-up-old areapath) ;; (let* ((since-last (- (current-seconds) server-last-start)) ;; (server-start-delay 10)) ;; (if ( < (- (current-seconds) server-last-start) 10 ) ;; (begin ;; (debug:print 2 *default-log-port* "server:choose-server: seconds since last server start: " (- (current-seconds) server-last-start)) ;; (debug:print 2 *default-log-port* "server:choose-server: last server start less than " server-start-delay " seconds ago. Sleeping " server-start-delay " seconds") ;; (thread-sleep! server-start-delay) ;; ) ;; (debug:print 2 *default-log-port* "server:choose-server: seconds since last server start: " (- (current-seconds) server-last-start)) ;; ) ;; ) ;; (let* ((serversdat (server:get-servers-info areapath)) ;; (servkeys (hash-table-keys serversdat)) ;; (by-time-asc (if (not (null? servkeys)) ;; NOTE: Oldest is last ;; (sort servkeys ;; list of "host:port" ;; (lambda (a b) ;; (>= (list-ref (hash-table-ref serversdat a) 2) ;; (list-ref (hash-table-ref serversdat b) 2)))) ;; '()))) ;; (debug:print 2 *default-log-port* "server:choose-server: serversdat: " serversdat) ;; (debug:print 2 *default-log-port* "server:choose-server: servkeys: " servkeys) ;; (if (not (null? by-time-asc)) ;; (let* ((oldest (last by-time-asc)) ;; (oldest-dat (hash-table-ref serversdat oldest)) ;; (host (list-ref oldest-dat 0)) ;; (all-valid (filter (lambda (x) ;; (equal? host (list-ref (hash-table-ref serversdat x) 0))) ;; by-time-asc)) ;; (best-ten (lambda () ;; (if (> (length all-valid) 11) ;; (take (drop-right all-valid 1) 10) ;; remove the oldest from consideration so it can age out ;; (if (> (length all-valid) 8) ;; (drop-right all-valid 1) ;; all-valid)))) ;; (names->dats (lambda (names) ;; (map (lambda (x) ;; (hash-table-ref serversdat x)) ;; names))) ;; (am-home? (lambda () ;; (let* ((currhost (get-host-name)) ;; (bestadrs (server:get-best-guess-address currhost))) ;; (or (equal? host currhost) ;; (equal? host bestadrs)))))) ;; (case mode ;; ((info) ;; (debug:print 0 *default-log-port* "oldest: "oldest-dat", selected host: "host", all-valid: "all-valid) ;; (debug:print 0 *default-log-port* "youngest: "(hash-table-ref serversdat (car all-valid)))) ;; ((home) host) ;; ((homehost) (cons host (am-home?))) ;; shut up old code ;; ((home?) (am-home?)) ;; ((best-ten)(names->dats (best-ten))) ;; ((all-valid)(names->dats all-valid)) ;; ((best) (let* ((best-ten (best-ten)) ;; (len (length best-ten))) ;; (hash-table-ref serversdat (list-ref best-ten (random len))))) ;; ((count)(length all-valid)) ;; (else ;; (debug:print 0 *default-log-port* "ERROR: invalid command "mode) ;; #f))) ;; (begin ;; (server:run areapath) ;; (set! server-last-start (current-seconds)) ;; ;; (thread-sleep! 3) ;; (case mode ;; ((homehost) (cons #f #f)) ;; (else #f)))))) (define (server:get-servinfo-dir areapath) (let* ((spath (conc areapath"/.servinfo"))) (if (not (file-exists? spath)) (create-directory spath #t)) spath)) |
︙ | ︙ | |||
449 450 451 452 453 454 455 | ;; (defstruct remote ;; transport to be used ;; http - use http-transport ;; http-read-cached - use http-transport for writes but in-mem cached for reads (rmode 'http) | | | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | ;; (defstruct remote ;; transport to be used ;; http - use http-transport ;; http-read-cached - use http-transport for writes but in-mem cached for reads (rmode 'http) (hh-dat (let ((res (or ;; (server:choose-server *toppath* 'homehost) (cons #f #f)))) (assert (pair? res)(conc "FATAL: hh-dat should be a pair, got "res)) res)) (server-url #f) ;; (server:check-if-running *toppath*) #f)) (server-id #f) (server-info #f) ;; (if *toppath* (server:check-if-running *toppath*) #f)) (last-server-check 0) ;; last time we checked to see if the server was alive |
︙ | ︙ |
Modified tasksmod.scm from [11086d3914] to [381a26e6c2].
︙ | ︙ | |||
1218 1219 1220 1221 1222 1223 1224 | (debug:print 0 *default-log-port* " to switch versions you can run: \"megatest -cleanup-db\"") (exit 1))))))) ;;====================================================================== ;; (begin ;; (debug:print 0 *default-log-port* "ERROR: cannot migrate version unless on homehost. Exiting.") ;; (exit 1)))) | | | | | | | | | | | | | | | | | | | 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 | (debug:print 0 *default-log-port* " to switch versions you can run: \"megatest -cleanup-db\"") (exit 1))))))) ;;====================================================================== ;; (begin ;; (debug:print 0 *default-log-port* "ERROR: cannot migrate version unless on homehost. Exiting.") ;; (exit 1)))) ;; (define (common:wait-for-homehost-load maxnormload msg) ;; (let loop ((start-time (current-seconds))) ;; we saw some instances of this being called before *toppath* was set. This might be an early setup race. This delay should help but it is impossible to test... ;; (if (not *toppath*) ;; (begin ;; (debug:print 0 *default-log-port* "ERROR: common:wait-for-homehost-load called before *toppath* set.") ;; (thread-sleep! 30) ;; (if (< (- (current-seconds) start-time) 300) ;; (loop start-time))))) ;; (case (rmt:transport-mode) ;; ((http) ;; (let* ((hh-dat (if (rmt:on-homehost?) ;; if we are on the homehost then pass in #f so the calls are local. ;; #f ;; (server:choose-server *toppath* 'homehost))) ;; (hh (if hh-dat (car hh-dat) #f))) ;; (common:wait-for-normalized-load maxnormload msg hh))) ;; (else ;; (common:wait-for-normalized-load maxnormload msg (get-host-name))))) (define (configf:write-alist cdat fname) (if (not (common:faux-lock fname)) (debug:print 0 *default-log-port* "INFO: Could not get lock on " fname)) (let* ((dat (configf:config->alist cdat)) (res |
︙ | ︙ |