Attached is a distributed places program that will do what you want.
It requires the latest checkout from git head.
You must have ssh public-key authentication setup on all the nodes.
For easy use, it also requires that racket and remote-eval.rkt be
installed in the same place on all three machines.
It communicates with plain sockets, so it assumes a secure environment.
Let me know what problems you have or if it works for you.
I would start by testing it out using just localhost.
Kevin Tew
On 05/13/2012 01:53 PM, HP Wei wrote:
Would you please suggest to me some links so that I can
get some info or even better some sample racket codes for below task ?
-------------------------------------------------------
Suppose I am on a master machine A
and there are two other machines B and C.
On A, in racket, I would like to programatically initiate
one server on B and another on C.
The 'server' is presumably a 'repl' that can execute a block
of code, sent from A.
[ Let's say security is not an issue here. ]
i.e. this is the intention:
invoke-server-on B and C (via rsh or ssh)
send-code B (asynchronously)
send-code C (asynchronously)
wait-for-result-from B and C
...
kill-server-on B and C
thanks
HP
____________________
Racket Users list:
http://lists.racket-lang.org/users
#lang racket/base
(require racket/place/distributed
racket/class
racket/place
racket/match
racket/date
racket/place/define-remote-server)
(define-namespace-anchor a)
(define ns (namespace-anchor->namespace a))
(define-named-remote-server
echo-server
(define-rpc (evalit x) (eval x ns)))
(module+ main
(define node-addresses (list (list "localhost" 6341)
(list "localhost" 6342)))
(define nodes
(spawn-nodes/join/local node-addresses))
(for ([n nodes])
(supervise-named-dynamic-place-at n 'echo (quote-module-path "..")
'make-echo-server))
(define-values (mrth mrch)
(start-message-router/thread
#:nodes nodes))
(define thread-channels
(for/list ([na node-addresses])
(define remote-place-ch (mr-connect-to mrch na 'echo))
(define thread-ch (make-channel))
(thread
(lambda ()
(channel-put thread-ch
(echo-server-evalit remote-place-ch
`(format "Hello from ~a ~a"
(quote ,na)
(date->string
(current-date)))))))
thread-ch))
(for ([ch thread-channels])
(printf "~v\n" (channel-get ch))))
____________________
Racket Users list:
http://lists.racket-lang.org/users