Overview
Comment: | Partially complete, just taking a snapshot |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | interleaved-queries |
Files: | files | file ages | folders |
SHA1: |
81e546a9941b46d488261a20f51601a9 |
User & Date: | matt on 2012-11-15 23:42:43 |
Other Links: | branch diff | manifest | tags |
Context
2012-11-16
| ||
01:19 | (no comment) check-in: d1245270ea user: matt tags: interleaved-queries | |
2012-11-15
| ||
23:42 | Partially complete, just taking a snapshot check-in: 81e546a994 user: matt tags: interleaved-queries | |
01:44 | Bit's 'n pieces check-in: d0462389b2 user: matt tags: interleaved-queries | |
Changes
Modified db.scm from [b0135e31f1] to [c6e157479f].
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - - + + - + | ;; PURPOSE. ;;====================================================================== ;;====================================================================== ;; Database access ;;====================================================================== |
︙ | |||
1188 1189 1190 1191 1192 1193 1194 | 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 | - - - + + + | (let* ((push-socket (vector-ref zmq-sockets 0)) (sub-socket (vector-ref zmq-sockets 1)) (query-id (conc (server:get-client-signature) "-" (message-digest-string (md5-primitive) (conc params)))) (zdat (db:obj->string (vector query-id params))) ;; (with-output-to-string (lambda ()(serialize params)))) (res #f) (get-res (lambda () (db:string->obj (if *client-non-blocking-mode* |
︙ |
Modified server.scm from [129e174847] to [01f2819585].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - - + + | ;; Copyright 2006-2012, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. |
︙ | |||
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 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 | + - - + + + + + + - - + + - - + + - - + + - - + + | ;; [ ] [ ] 5. Add processing of subscription hits ;; [ ] [ ] - done when get key ;; [ ] [ ] - return results ;; [ ] [ ] 6. Add timeout processing ;; [ ] [ ] - after 60 seconds ;; [ ] [ ] i. check server alive, connect to new if necessary ;; [ ] [ ] ii. resend request ;; [ ] [ ] 7. Turn self ping back on (define (server:make-server-url hostport) (if (not hostport) #f (conc "tcp://" (car hostport) ":" (cadr hostport)))) (define *server-loop-heart-beat* (current-seconds)) (define *heartbeat-mutex* (make-mutex)) |
︙ | |||
130 131 132 133 134 135 136 | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | - + + + + | (begin (debug:print-info 0 "Queue not flushed, waiting ...") (loop)))))))) ;; The heavy lifting ;; (let loop () |
︙ | |||
175 176 177 178 179 180 181 | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | - + | (mutex-unlock! *heartbeat-mutex*) ;; The logic here is that if the server loop gets stuck blocked in working ;; we don't want to update our heartbeat (set! pulse (- (current-seconds) server-loop-heartbeat)) (debug:print-info 2 "Heartbeat period is " pulse " seconds on " (cadr server-info) ":" (caddr server-info) ", last db access is " (- (current-seconds) *last-db-access*) " seconds ago") (if (> pulse 15) ;; must stay less than 10 seconds (begin |
︙ | |||
221 222 223 224 225 226 227 | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 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 | - - + + - + - + - + - + + + + + - + + + + + + + + + + + + + + + + + + | " but all were in use. Please try a different port range by starting the server with parameter \" -port N\" where N is the starting port number to use")) (exit)) ;; To exit or not? That is the question. (let ((zmq-url (conc "tcp://" iface ":" p))) (debug:print 0 "Trying to start server on " zmq-url) (bind-socket s zmq-url) (list iface s port))))) |
︙ | |||
292 293 294 295 296 297 298 | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | - + - + - - - - - - - - - - - - - - - - - | exn (begin ;; something went wrong in connecting to the server. In this scenario it is ok ;; to try again (debug:print 0 "ERROR: Failed to open a connection to the server at: " hostinfo) (debug:print 0 " EXCEPTION: " ((condition-property-accessor 'exn 'message) exn)) (debug:print 0 " perhaps jobs killed with -9? Removing server records") |
︙ | |||
346 347 348 349 350 351 352 | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | - + + | (debug:print-info 1 "Waiting for the server to come online before starting heartbeat") (thread-sleep! 2) (mutex-lock! *heartbeat-mutex*) (set! server-info *server-info* ) (mutex-unlock! *heartbeat-mutex*) (if (not server-info)(loop))) (debug:print 1 "Server alive, starting self-ping") |
︙ | |||
369 370 371 372 373 374 375 | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | - + | exn (debug:print " ... exiting ...") (let ((th1 (make-thread (lambda () (if (not *received-response*) (receive-message* *runremote*))) ;; flush out last call if applicable "eat response")) (th2 (make-thread (lambda () |
︙ |
Modified tasks.scm from [90e00b3daa] to [3c212dbf03].
︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | + + - - + + + + | ;;====================================================================== (define (tasks:open-db) (let* ((dbpath (conc *toppath* "/monitor.db")) (exists (if (file-exists? dbpath) ;; BUGGISHNESS: Remove this code in six months. Today is 11/13/2012 (if (< (file-change-time dbpath) 1352851396.0) (begin (debug:print 0 "NOTE: removing old db file " dbpath) |
︙ | |||
61 62 63 64 65 66 67 | 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 | - + - + - - + + + - + + - + - - + + - + - + - + - - + + - + - + | pullport INTEGER, pubport INTEGER, start_time TIMESTAMP, priority INTEGER, state TEXT, mt_version TEXT, heartbeat TIMESTAMP, |
︙ | |||
161 162 163 164 165 166 167 | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | - - - + + + | ;; ping each server in the db and return first found that responds. ;; remove any others. will not necessarily remove all! (define (tasks:get-best-server mdb) (let ((res '()) (best #f)) (sqlite3:for-each-row |
︙ | |||
229 230 231 232 233 234 235 | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | - - + + - + | (thread-sleep! 5) ;; give it five seconds to die peacefully then do a brutal kill (process-signal pid signal/kill)) (debug:print 0 "WARNING: Can't kill frozen server on remote host " hostname)))))) (define (tasks:get-all-servers mdb) (let ((res '())) (sqlite3:for-each-row |
︙ |