50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
-
-
+
+
|
;; start_server
;;
(define (server:launch run-id)
(case *transport-type*
((http)(http-transport:launch run-id))
((nmsg)(nmsg-transport:launch run-id))
((rpc) (rpc-transport:launch run-id))
(else (debug:print 0 *default-log-port* "ERROR: unknown server type " *transport-type*))))
;; (else (debug:print 0 *default-log-port* "ERROR: No known transport set, transport=" transport ", using rpc")
(else (debug:print-error 0 *default-log-port* "unknown server type " *transport-type*))))
;; (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
;;======================================================================
;; Get the transport
|
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
-
+
|
((http) (db:obj->string (vector success/fail query-sig result)))
((zmq)
(let ((pub-socket (vector-ref *runremote* 1)))
(send-message pub-socket return-addr send-more: #t)
(send-message pub-socket (db:obj->string (vector success/fail query-sig result)))))
((fs) result)
(else
(debug:print 0 *default-log-port* "ERROR: unrecognised transport type: " *transport-type*)
(debug:print-error 0 *default-log-port* "unrecognised transport type: " *transport-type*)
result)))
;; Given a run id start a server process ### NOTE ### > file 2>&1
;; if the run-id is zero and the target-host is set
;; try running on that host
;;
(define (server:run run-id)
|
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
-
+
|
(if (eq? (length slst) 2)
(list (car slst)(string->number (cadr slst)))
#f)))
(toppath (launch:setup))
(server-db-dat (if (not host-port)(tasks:get-server (db:delay-if-busy tdbdat) run-id) #f)))
(if (not run-id)
(begin
(debug:print 0 *default-log-port* "ERROR: must specify run-id when doing ping, -run-id n")
(debug:print-error 0 *default-log-port* "must specify run-id when doing ping, -run-id n")
(print "ERROR: No run-id")
(exit 1))
(if (and (not host-port)
(not server-db-dat))
(begin
(print "ERROR: bad host:port")
(exit 1))
|