Changes In Branch re-re-factor-server Through [91a6aa298f] Excluding Merge-Ins
This is equivalent to a diff from 559228be40 to 91a6aa298f
2014-02-13
| ||
16:51 | Added pdf and regenerated Closed-Leaf check-in: 6d98d0aa7d user: mrwellan tags: inmem-per-run-db-per-run-server | |
2014-02-10
| ||
23:53 | It works - making dot files of .scm files check-in: 3061292702 user: matt tags: re-re-factor-server | |
22:39 | Added code analysis tool check-in: 91a6aa298f user: matt tags: re-re-factor-server | |
19:56 | Re-re-factor server handling check-in: f68ed29f16 user: matt tags: re-re-factor-server | |
2014-02-09
| ||
23:54 | Added more detail to server/client flow check-in: 559228be40 user: matt tags: inmem-per-run-db-per-run-server | |
22:55 | Updated docs with proposed server spec check-in: 180fe4e32d user: matt tags: inmem-per-run-db-per-run-server | |
Modified client.scm from [d859fde28d] to [7ef7342bb9].
︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | + + + | ;; ;; There are two scenarios. ;; 1. We are a test manager and we received *transport-type* and *runremote* via cmdline ;; 2. We are a run tests, list runs or other interactive process and we must figure out ;; *transport-type* and *runremote* from the monitor.db ;; ;; client:setup ;; ;; lookup_server, ;; (define (client:setup run-id #!key (remaining-tries 3)) (if (not *toppath*) (if (not (setup-for-run)) (begin (debug:print 0 "ERROR: failed to find megatest.config, exiting") (exit)))) ;; (push-directory *toppath*) ;; This is probably NOT needed |
︙ |
Modified docs/manual/server.dot from [4efd80e71a] to [2cf0263449].
︙ | |||
44 45 46 47 48 49 50 | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - - + + + + + | ping_server -> exit [label=alive]; ping_server -> remove_server_record [label=dead]; remove_server_record -> set_available; set_available -> avail_delay [label="delay 3s"]; avail_delay -> "first_in_queue?"; "first_in_queue?" -> set_running [label=yes]; |
︙ |
Modified http-transport.scm from [cb9f17b39f] to [3967dad5c1].
︙ | |||
152 153 154 155 156 157 158 159 160 161 162 163 164 165 | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | + + + | exn (begin (print-error-message exn) (if (< portnum 9000) (begin (debug:print 0 "WARNING: failed to start on portnum: " portnum ", trying next port") (thread-sleep! 0.1) ;; get_next_port goes here (http-transport:try-start-server ipaddrstr (+ portnum 1) server-id)) (print "ERROR: Tried and tried but could not start the server"))) ;; any error in following steps will result in a retry (set! *server-info* (list ipaddrstr portnum)) (open-run-close tasks:server-set-interface-port tasks:open-db server-id |
︙ | |||
369 370 371 372 373 374 375 376 377 378 379 380 381 382 | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | + + + | (thread-start! th1) (thread-start! th2) (thread-join! th1) (thread-terminate! th2) (debug:print-info 11 "got res=" res) res))))) ;; ;; connect ;; (define (http-transport:client-connect run-id iface port) (let* ((login-res #f) (uri-dat (make-request method: 'POST uri: (uri-reference (conc "http://" iface ":" port "/ctrl")))) (uri-api-dat (make-request method: 'POST uri: (uri-reference (conc "http://" iface ":" port "/api")))) (serverdat (list iface port uri-dat uri-api-dat))) (hash-table-set! *runremote* run-id serverdat) ;; may or may not be good ... (set! login-res (rmt:login run-id)) |
︙ | |||
419 420 421 422 423 424 425 426 427 428 429 430 431 432 | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | + + + | (tdb (tasks:open-db)) (server-timeout (let ((tmo (config-lookup *configdat* "server" "timeout"))) (if (and (string? tmo) (string->number tmo)) (* 60 60 (string->number tmo)) ;; default to three days (* 3 24 60 60))))) ;; ;; set_running ;; (tasks:server-set-state! tdb server-id "running") (let loop ((count 0)) ;; Use this opportunity to sync the inmemdb to db (let ((start-time (current-milliseconds)) (sync-time #f) (rem-time #f)) (if *inmemdb* (db:sync-touched *inmemdb* force-sync: #t)) |
︙ | |||
453 454 455 456 457 458 459 | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | + + + + - + + + + + + + | (begin (debug:print-info 0 "interface changed, refreshing iface and port info") (set! iface (car sdat)) (set! port (cadr sdat)))) ;; NOTE: Get rid of this mechanism! It really is not needed... ;; (open-run-close tasks:server-update-heartbeat tasks:open-db spid) ;; ;; NOT USED ANY MORE ;; |
︙ | |||
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | + + + + + + + + + | *number-non-write-queries*)) " ms") (debug:print-info 0 "Server shutdown complete. Exiting") (tasks:server-delete-record! tdb server-id) (exit)))))) ;; all routes though here end in exit ... ;; ;; start_server? ;; (define (http-transport:launch run-id) (set! *run-id* run-id) (if (not *toppath*) (if (not (setup-for-run)) (begin (debug:print 0 "ERROR: cannot find megatest.config, exiting") (exit)))) (debug:print-info 2 "Starting the standalone server") (if (args:get-arg "-daemonize") (daemon:ize)) ;; ;; set_available ;; (let ((server-id (open-run-close tasks:server-lock-slot tasks:open-db run-id))) (if (not server-id) ;; ;; remove_dead_entry? ;; (begin (debug:print-info 2 "INFO: server pid=" (current-process-id) ", hostname=" (get-host-name) " not starting due to other candidates ahead in start queue") (open-run-close tasks:server-delete-records-for-this-pid tasks:open-db)) (if *toppath* (let* ((th2 (make-thread (lambda () (http-transport:run (if (args:get-arg "-server") |
︙ |
Modified server.scm from [29b0c253ff] to [a385b14a3e].
︙ | |||
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | + + + | ;; S E R V E R ;;====================================================================== ;; Call this to start the actual server ;; ;; all routes though here end in exit ... ;; ;; start_server ;; (define (server:launch transport run-id) (if (not *toppath*) (if (not (setup-for-run)) (begin (debug:print 0 "ERROR: cannot find megatest.config, exiting") (exit)))) (debug:print-info 2 "Starting server using " transport " transport") |
︙ |
Modified tasks.scm from [db6ec670d8] to [620093d5f8].
︙ | |||
101 102 103 104 105 106 107 | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | - + | (tasks:server-am-i-the-server? mdb run-id))) ;; register that this server may come online (first to register goes though with the process) (define (tasks:server-set-available mdb run-id) (sqlite3:execute mdb "INSERT INTO servers (pid,hostname,port,pubport,start_time, priority,state,mt_version,heartbeat, interface,transport,run_id) |
︙ |
Added utils/plot-code.scm version [060b469cc0].