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
|
;; 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))
(define (client:connect iface port)
(case (server:get-transport)
((rpc) (rpc:client-connect iface port))
((http) (http:client-connect iface port))
((zmq) (zmq:client-connect iface port))
(else (rpc:client-connect iface port))))
(define (client:setup run-id #!key (remaining-tries 10))
(debug:print-info 2 *default-log-port* "client:setup remaining-tries=" remaining-tries)
(let* ((server-dat (tasks:bb-get-server-info run-id))
(transport (if server-dat (tasks:hostinfo-get-transport server-dat) 'noserver)))
(case transport
((noserver) ;; no server registered
(if (<= remaining-tries 0)
(begin
(debug:print-error 0 *default-log-port* "failed to start or connect to server for run-id " run-id)
(exit 1))
(begin
(let ((num-available (tasks:bb-num-in-available-state run-id)))
(debug:print-info 0 *default-log-port* "client:setup, no server registered, remaining-tries=" remaining-tries " num-available=" num-available)
(if (< num-available 2)
(server:try-running run-id))
(thread-sleep! (+ 5 (random (- 20 remaining-tries)))) ;; give server a little time to start up, randomize a little to avoid start storms.
(client:setup run-id remaining-tries: (- remaining-tries 1))))))
((http)(client:setup-http server-dat run-id remaining-tries))
((rpc) (rpc-transport:client-setup run-id)) ;;(client:setup-rpc run-id))
(else
(debug:print-error 0 *default-log-port* "Unknown transport ["
transport "] specified used by server for run-id " run-id)
(exit 1)))))
(define (client:setup-http run-id server-dat remaining-tries)
|
>
>
|
|
|
|
|
|
|
|
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
|
;; 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
;;;;;
;; (define (client:connect iface port)
;; (case (server:get-transport)
;; ((rpc) (rpc:client-connect iface port))
;; ((http) (http:client-connect iface port))
;; ((zmq) (zmq:client-connect iface port))
;; (else (rpc:client-connect iface port))))
(define (client:setup run-id #!key (remaining-tries 10))
(debug:print-info 2 *default-log-port* "client:setup remaining-tries=" remaining-tries)
(let* ((server-dat (tasks:bb-get-server-info run-id))
(transport (if server-dat (tasks:hostinfo-get-transport server-dat) 'noserver)))
(case transport
((noserver) ;; no server registered
(if (<= remaining-tries 0)
(begin
(debug:print-error 0 *default-log-port* "failed to start or connect to server for run-id " run-id)
(exit 1))
(begin
(let ((num-available (tasks:bb-num-in-available-state run-id)))
(debug:print-info 0 *default-log-port* "client:setup, no server registered, remaining-tries=" remaining-tries " num-available=" num-available)
(if (< num-available 2)
(server:try-running run-id))
(thread-sleep! (+ 5 (random (- 20 remaining-tries)))) ;; give server a little time to start up, randomize a little to avoid start storms.
(client:setup run-id remaining-tries: (- remaining-tries 1))))))
((http)(client:setup-http server-dat run-id remaining-tries))
;; ((rpc) (rpc-transport:client-setup run-id)) ;;(client:setup-rpc run-id)) rpc not implemented; want to see a failure here for now.
(else
(debug:print-error 0 *default-log-port* "Unknown transport ["
transport "] specified used by server for run-id " run-id)
(exit 1)))))
(define (client:setup-http run-id server-dat remaining-tries)
|
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
;; *transport-type* and *runremote* from the monitor.db
;;
;; client:setup
;;
;; lookup_server, need to remove *runremote* stuff
;;
;; keep this as a function to ease future
(define (client:start run-id server-info)
(http-transport:client-connect (tasks:hostinfo-get-interface server-info)
(tasks:hostinfo-get-port server-info)))
;; ;; client:signal-handler
;; (define (client:signal-handler signum)
;; (signal-mask! signum)
;; (set! *time-to-exit* #t)
;; (handle-exceptions
;; exn
|
|
>
|
|
|
|
|
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
;; *transport-type* and *runremote* from the monitor.db
;;
;; client:setup
;;
;; lookup_server, need to remove *runremote* stuff
;;
;; BB: commenting out orphan code.
;;
;; ;; keep this as a function to ease future
;; (define (client:start run-id server-info)
;; (http-transport:client-connect (tasks:hostinfo-get-interface server-info)
;; (tasks:hostinfo-get-port server-info)))
;; ;; client:signal-handler
;; (define (client:signal-handler signum)
;; (signal-mask! signum)
;; (set! *time-to-exit* #t)
;; (handle-exceptions
;; exn
|