Changes In Branch rpc-transport Through [febd54396c] Excluding Merge-Ins
This is equivalent to a diff from cfb9ac119d to febd54396c
2016-11-01
| ||
02:45 | tested; found bugs; fixed bugs check-in: 1387b44afb user: bjbarcla tags: rpc-transport | |
00:56 | did a little tidying up check-in: febd54396c user: bjbarcla tags: rpc-transport | |
00:32 | make client:setup honor transport specified in server table; not global version; incidentally may have found/corrected an endless loop where client:setup-http retries would be infinite, not decrementing from 20 (client:setup did not pass remaining-tries to client:setup-http); also client:setup-http, making killing off a running server that doesnt respond more aggressive (now a kill-9). ; these last two may want to go in mainline. check-in: e851c26e61 user: bjbarcla tags: rpc-transport | |
2016-10-27
| ||
15:21 | Run tab resize fixed check-in: 5ff16368ff user: ritikaag tags: v1.62 | |
2016-10-26
| ||
14:48 | branch for rpc support check-in: d306d8dea0 user: bjbarcla tags: rpc-transport | |
14:21 | added support for -kill-servers and -transport switches on megatest check-in: cfb9ac119d user: bjbarcla tags: v1.62 | |
2016-10-25
| ||
21:02 | fixed -list-servers and -stop-server switches on megatest check-in: 73502a1626 user: bjbarcla tags: v1.62 | |
Modified client.scm from [c5821d20e2] to [2c1ce58891].
︙ | |||
39 40 41 42 43 44 45 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | + + - - - - - - + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | ;; Not currently used! But, I think it *should* be used!!! (define (client:logout serverdat) (let ((ok (and (socket? serverdat) (cdb:logout serverdat *toppath* (client:get-signature))))) ok)) ;; BB: commenting out orphan code ;;;;; |
︙ | |||
93 94 95 96 97 98 99 | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | - + | ;; (thread-sleep! 5) ;; (client:setup run-id remaining-tries: 10)) ;; (- remaining-tries 1))) ;; (begin ;; (debug:print 25 *default-log-port* "INFO: client:setup failed to connect, start-res=" start-res ", run-id=" run-id ", host-info=" host-info) ;; (thread-sleep! 5) ;; (client:setup run-id remaining-tries: (- remaining-tries 1)))))) ;; ;; YUK: rename server-dat here |
︙ | |||
150 151 152 153 154 155 156 | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + | ;; 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, need to remove *runremote* stuff ;; |
︙ |
Modified http-transport.scm from [13883e3b0d] to [36a3ef7f7d].
︙ | |||
533 534 535 536 537 538 539 | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | - + - + | (begin (current-error-port *alt-log-file*) (current-output-port *alt-log-file*))))) (if (server:check-if-running run-id) (begin (debug:print 0 *default-log-port* "INFO: Server for run-id " run-id " already running") (exit 0))) |
︙ |
Modified launch.scm from [a58a11e1e1] to [af266dccde].
︙ | |||
698 699 700 701 702 703 704 | 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | - + | ;; megatest.config (cache if all vars avail) ;; returns: ;; *toppath* ;; side effects: ;; sets; *configdat* (megatest.config info) ;; *runconfigdat* (runconfigs.config info) ;; *configstatus* (status of the read data) |
︙ | |||
825 826 827 828 829 830 831 832 833 834 835 836 837 838 | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | + + | (debug:print-error 0 *default-log-port* "linktree not defined in [setup] section of megatest.config") ))) (if (and *toppath* (directory-exists? *toppath*)) (setenv "MT_RUN_AREA_HOME" *toppath*) (begin (debug:print-error 0 *default-log-port* "failed to find the top path to your Megatest area."))) (server:set-transport) ;;(BB> "Transport is >"*transport-type*"<") *toppath*)) (define (get-best-disk confdat testconfig) (let* ((disks (or (and testconfig (hash-table-ref/default testconfig "disks" #f)) (hash-table-ref/default confdat "disks" #f))) (minspace (let ((m (configf:lookup confdat "setup" "minspace"))) (string->number (or m "10000"))))) |
︙ |
Modified rmt.scm from [bb562bf1d7] to [ef5e4d35bf].
︙ | |||
79 80 81 82 83 84 85 | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | - + | ;; clean out old connections ;; (mutex-lock! *db-multi-sync-mutex*) (let ((expire-time (- (current-seconds) (server:get-timeout) 10))) ;; don't forget the 10 second margin (for-each (lambda (run-id) (let ((connection (hash-table-ref/default *runremote* run-id #f))) (if (and (vector? connection) |
︙ | |||
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | + - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - + | ((http)(condition-case (http-transport:client-api-send-receive run-id connection-info cmd params) ((commfail)(vector #f "communications fail")) ((exn)(vector #f "other fail")))) ;; ((nmsg)(condition-case ;; (nmsg-transport:client-api-send-receive run-id connection-info cmd params) ;; ((timeout)(vector #f "timeout talking to server")))) ((rpc) (rpc-transport:client-api-send-receive run-id connection-info cmd params)) (else (exit)))) (success (if (vector? dat) (vector-ref dat 0) #f)) (res (if (vector? dat) (vector-ref dat 1) #f))) (if (vector? connection-info)(http-transport:server-dat-update-last-access connection-info)) (if success (begin ;; (mutex-unlock! *send-receive-mutex*) (case *transport-type* |
︙ |
Modified rpc-transport.scm from [62a65daa58] to [702db23fbc].
︙ | |||
45 46 47 48 49 50 51 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | - + - + + + + + + - + + - - + + - - - + + + + + - + - + + + - - - - + + + + - + - + - + - + + + + - + | (set! *run-id* run-id) (if (args:get-arg "-daemonize") (daemon:ize)) (if (server:check-if-running run-id) (begin (debug:print 0 *default-log-port* "INFO: Server for run-id " run-id " already running") (exit 0))) |
︙ | |||
177 178 179 180 181 182 183 | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | - + | (let ((server-dat (list iface port #f #f #f))) (hash-table-set! *runremote* run-id server-dat) server-dat) (begin (server:try-running run-id) (thread-sleep! 2) (rpc-transport:client-setup run-id (- remtries 1))))) |
︙ |
Modified server.scm from [19061b35b0] to [c9c38a4420].
︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | + - - + + - - - - - - - - - + + + + + + + + + + + + + + | ;; (else (debug:print-error 0 *default-log-port* "No known transport set, transport=" transport ", using rpc") ;; (rpc-transport:launch run-id))))) ;;====================================================================== ;; S E R V E R U T I L I T I E S ;;====================================================================== ;; set global *transport-type* based on -transport switch and serer/transport configuration. default http otherwise. |
︙ | |||
178 179 180 181 182 183 184 | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | - + | (define (server:try-running run-id) (if (eq? run-id 0) (server:run run-id) (rmt:start-server run-id))) (define (server:check-if-running run-id) (let ((tdbdat (tasks:open-db))) |
︙ | |||
213 214 215 216 217 218 219 | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | - + | (define (server:ping run-id host:port) (let ((tdbdat (tasks:open-db))) (let* ((host-port (let ((slst (string-split host:port ":"))) (if (eq? (length slst) 2) (list (car slst)(string->number (cadr slst))) #f))) (toppath (launch:setup)) |
︙ |
Modified tasks.scm from [a06114a2ac] to [b6453842af].
︙ | |||
168 169 170 171 172 173 174 | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | - + - + - + - + | (define (tasks:hostinfo-get-interface vec) (vector-ref vec 1)) (define (tasks:hostinfo-get-port vec) (vector-ref vec 2)) (define (tasks:hostinfo-get-pubport vec) (vector-ref vec 3)) (define (tasks:hostinfo-get-transport vec) (vector-ref vec 4)) (define (tasks:hostinfo-get-pid vec) (vector-ref vec 5)) (define (tasks:hostinfo-get-hostname vec) (vector-ref vec 6)) |
︙ | |||
325 326 327 328 329 330 331 | 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 | + + + + + + + + + + + + + + + - + - + - + - - + + | (lambda (a . b) (set! res (cons (apply vector a b) res))) mdb (conc "SELECT " selstr " FROM servers WHERE run_id=? AND state in ('available','running','dbprep') ORDER BY start_time DESC;") run-id) (vector header res))) ;; BB> bb opinion - want to push responsibility into api (encapsulation), like waiting if db is busy and finding the db handle in the first place. why should the caller need to be concerned?? If my opinion carries, we'll remove the bb- and make other needful adjustments. (define (bb-mdb-inserter mdb-expecting-proc mdbless-args) (let ((mdb (db:delay-if-busy (tasks:open-db)))) (apply mdb-expecting-proc (cons mdb args)))) (define (tasks:bb-get-server-info . args) (bb-mdb-inserter tasks:get-server-info args)) (define (tasks:bb-num-in-available-state . args) (bb-mdb-inserter tasks:num-in-available-state args)) ;; BB: renaming tasks:get-server to get-server-info to make clear we aren't creating servers here |
︙ | |||
392 393 394 395 396 397 398 | 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 | - + - + | ;; (else ;; #f)))) ;; try to start a server and wait for it to be available ;; (define (tasks:start-and-wait-for-server tdbdat run-id delay-max-tries) ;; ensure a server is running for this run |
︙ | |||
441 442 443 444 445 446 447 | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | - + - + | (unsetenv "TARGETHOST_LOGF") (unsetenv "TARGETHOST")) ;; look up a server by run-id and send it a kill, also delete the record for that server ;; (define (tasks:kill-server-run-id run-id #!key (tag "default")) (let* ((tdbdat (tasks:open-db)) |
︙ |