URIS
http://codeforpeople.com/lib/ruby/slave/
http://rubyforge.org/frs/?group_id=1024&release_id=5631
SYNOPSIS
the Slave class forks a process and starts a drb server in the child
using
any object as the server. the process is detached so it is not
required
(nor possible) to wait on the child pid. a Heartbeat is set up
between the
parent and child processes so that the child will exit of the parent
exits
for any reason - preventing orphaned slaves from running
indefinitely. the
purpose of Slaves is to be able to easily set up a collection of
objects
communicating via drb protocols instead of having to use IPC.
typical usage:
obj = AnyClass::new
#
slave = Slave::new obj # object becomes drb server in
another
# process
p slave.object # handle on drb object
p slave.uri # uri of the drb object
p slave.socket # unix domain socket path for drb
object
p slave.psname # title shown in ps/top
obj = slave.object
#
p obj.method # call a method on drb server in
another
# process
other usage:
set the pulse_rate used for the Heartbeat
slave = Slave::new MyClass::new, 'pulse_rate' => 10
same
Slave::pulse_rate = 10
slave = Slave::new MyClass::new
same
ENV['SLAVE_PULSE_RATE'] = 10
slave = Slave::new MyClass::new
slaves may be configured via the environment, the Slave class, or via
the ctor
for object itself. attributes which may be configured include
- socket_creation_attempts
- pulse_rate
- psname
- debug
INSTALL
gem install slave
enjoy.
-a
Ara,
I am trying to use your package on Windows. I’m running into an issue at
line 341 of slave.rb:
@pipe.fcntl Fcntl::F_SETFD, Fcntl::FD_CLOEXEC
I’m curious what these flags mean and what their equivalent on Windows
might
be (if any).
I already solved a couple of issues (well, hacked around them):
- No fork() on windows. Solved by installing Daniel B.'s
win32-process
gem
- “drbunix” URI fails on non-unix. Solved by passing nil to
Drb.start_service (ugly hack, hoping to make it cleaner later)
Thanks for any help!
Justin
On Fri, 9 Jun 2006, Justin B. wrote:
hi justin-
I am trying to use your package on Windows. I’m running into an issue at
line 341 of slave.rb:
@pipe.fcntl Fcntl::F_SETFD, Fcntl::FD_CLOEXEC
I’m curious what these flags mean and what their equivalent on Windows might
be (if any).
it means that, should the parent do something like
exec ‘another_program.exe’
the pipe will be closed. it’s important since pids are recycled and
pipes
transfered the slave would live on for while - perhaps indefinitely.
of course it’s possible that behaviour is desireable, but then a zombie
would
also be created… anyhow, for hacking it’s safe to comment that out.
I already solved a couple of issues (well, hacked around them):
- No fork() on windows. Solved by installing Daniel B.'s win32-process
gem
- “drbunix” URI fails on non-unix. Solved by passing nil to
Drb.start_service (ugly hack, hoping to make it cleaner later)
this could easily be configured - check out how the other stuff is
configured
and do something like allow the ENV var ‘SLAVE_DRB_PROTOCOL’ to override
this… perhaps a better option might be
Drb.start_server ‘drb://localhost.localdomain:0’
note that ‘nil’ here doesn’t work on macs for some reason…
i’m running out the door now, but i’d love to make this work on windows
- just
for the challenge. maybe dan can lend a hand?
maybe we can work together and make another release that’s portable.
ping me
offline if your’re interested.
cheers.
-a
Ara.T.Howard wrote:
http://codeforpeople.com/lib/ruby/slave/
…
the Slave class forks a process and starts a drb server in the child
…
slave = Slave::new MyClass::new, ‘pulse_rate’ => 10
‘Master’ and ‘Slave’ labels unacceptable.
“Based on the cultural diversity and sensitivity of Los A. County,
this is not an acceptable identification label.”
http://www.cnn.com/2003/TECH/ptech/11/26/master.term.reut/
Enjoy,
Dave
Cloexec doesn’t exist on Windows. It would be meaningless anyway,
because
there’s no notion of a fork. In effect, everything is cloexec.
On Fri, 9 Jun 2006, Francis C. wrote:
Cloexec doesn’t exist on Windows. It would be meaningless anyway, because
there’s no notion of a fork. In effect, everything is cloexec.
everything on windows is meaningless to me care to review the code
and
suggest a way to make it portable?
cheers.
-a
On Jun 8, 2006, at 5:58 PM, [email protected] wrote:
note that ‘nil’ here doesn’t work on macs for some reason…
IPv6?
–
Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant
http://trackmap.robotcoop.com