starfish 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/NUL +0 -0
- data/doc/classes/Starfish/RingFinger.src/M000035.html +1 -1
- data/doc/classes/Starfish.html +6 -1
- data/doc/classes/Starfish.src/M000023.html +1 -1
- data/doc/classes/Starfish.src/M000024.html +1 -1
- data/doc/classes/Starfish.src/M000025.html +2 -2
- data/doc/classes/Starfish.src/M000026.html +1 -1
- data/doc/classes/Starfish.src/M000027.html +1 -1
- data/doc/classes/Starfish.src/M000028.html +2 -2
- data/doc/classes/Starfish.src/M000029.html +1 -1
- data/doc/classes/Starfish.src/M000030.html +2 -2
- data/doc/classes/Starfish.src/M000031.html +2 -2
- data/doc/classes/Starfish.src/M000032.html +1 -1
- data/doc/classes/Starfish.src/M000033.html +1 -1
- data/doc/classes/Starfish.src/M000034.html +1 -1
- data/doc/created.rid +1 -1
- data/doc/files/lib/map_reduce_rb.html +1 -1
- data/doc/files/lib/starfish_rb.html +21 -1
- data/lib/starfish.rb +19 -6
- metadata +2 -1
data/NUL
ADDED
File without changes
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 179</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">RingFinger</span>.<span class="ruby-identifier">finger</span>
|
15
15
|
<span class="ruby-ivar">@@finger</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>
|
16
16
|
<span class="ruby-ivar">@@finger</span>.<span class="ruby-identifier">lookup_ring_any</span>
|
data/doc/classes/Starfish.html
CHANGED
@@ -130,7 +130,12 @@
|
|
130
130
|
<tr class="top-aligned-row context-row">
|
131
131
|
<td class="context-item-name">VERSION</td>
|
132
132
|
<td>=</td>
|
133
|
-
<td class="context-item-value">"1.1.
|
133
|
+
<td class="context-item-value">"1.1.2"</td>
|
134
|
+
</tr>
|
135
|
+
<tr class="top-aligned-row context-row">
|
136
|
+
<td class="context-item-name">NULL</td>
|
137
|
+
<td>=</td>
|
138
|
+
<td class="context-item-value">RUBY_PLATFORM =~ /mswin/ ? 'NUL' : '/dev/null'</td>
|
134
139
|
</tr>
|
135
140
|
</table>
|
136
141
|
</div>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 39</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">uniq</span>=<span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">first</span>)
|
15
15
|
<span class="ruby-ivar">@retry_count</span> = <span class="ruby-value">0</span>
|
16
16
|
<span class="ruby-ivar">@uniq</span> = <span class="ruby-identifier">uniq</span>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 44</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uniq</span>
|
15
15
|
<span class="ruby-constant">MD5</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@uniq</span>).<span class="ruby-identifier">to_s</span>
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 48</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server</span>
|
15
15
|
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@server</span>
|
16
16
|
<span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"You must specify a server"</span>
|
@@ -35,7 +35,7 @@
|
|
35
35
|
<span class="ruby-identifier">ts</span>.<span class="ruby-identifier">write</span>([<span class="ruby-identifier">:name</span>, <span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">intern</span>, <span class="ruby-identifier">object</span>, <span class="ruby-ivar">@uniq</span>])
|
36
36
|
<span class="ruby-keyword kw">end</span>
|
37
37
|
|
38
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-ivar">@@options</span>[<span class="ruby-identifier">:pid</span>] <span class="ruby-operator">||</span> <span class="ruby-node">"
|
38
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-ivar">@@options</span>[<span class="ruby-identifier">:pid</span>] <span class="ruby-operator">||</span> <span class="ruby-node">"#{Dir.tmpdir}/starfish-#{uniq}.pid"</span>,<span class="ruby-value str">"w"</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator"><<</span><span class="ruby-constant">Process</span>.<span class="ruby-identifier">pid</span>}
|
39
39
|
|
40
40
|
<span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"server started for #{object.inspect}"</span>
|
41
41
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 79</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">client</span>
|
15
15
|
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@client</span>
|
16
16
|
<span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"You must specify a client"</span>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 143</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stats</span>
|
15
15
|
<span class="ruby-identifier">negotiate</span>
|
16
16
|
<span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-identifier">timeout</span>(<span class="ruby-value">5</span>) { <span class="ruby-ivar">@server_object</span> = <span class="ruby-ivar">@ring_server</span>.<span class="ruby-identifier">read</span>([<span class="ruby-identifier">:name</span>, <span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">intern</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>])[<span class="ruby-value">2</span>] }
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 152</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sanitize</span>(<span class="ruby-identifier">object</span>)
|
15
15
|
<span class="ruby-identifier">object</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">DRbUndumped</span>
|
16
16
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
<span class="ruby-keyword kw">when</span> <span class="ruby-constant">Class</span>
|
21
21
|
<span class="ruby-ivar">@@options</span>[<span class="ruby-identifier">:log</span>].<span class="ruby-identifier">new</span>
|
22
22
|
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">false</span>
|
23
|
-
<span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-
|
23
|
+
<span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">NULL</span>)
|
24
24
|
<span class="ruby-keyword kw">else</span>
|
25
25
|
<span class="ruby-ivar">@@options</span>[<span class="ruby-identifier">:log</span>]
|
26
26
|
<span class="ruby-keyword kw">end</span>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 174</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">negotiate</span><span class="ruby-identifier">negotiate</span><span class="ruby-identifier">negotiate</span>
|
15
15
|
<span class="ruby-keyword kw">begin</span>
|
16
16
|
<span class="ruby-ivar">@ring_server</span> = <span class="ruby-constant">RingFinger</span>.<span class="ruby-identifier">primary</span>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 195</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">spawn</span>
|
15
|
-
<span class="ruby-ivar">@started</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">
|
15
|
+
<span class="ruby-ivar">@started</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">STARFISH_FORK</span>.<span class="ruby-identifier">call</span> { <span class="ruby-identifier">system</span>(<span class="ruby-node">"ruby #{File.dirname(__FILE__)}/../bin/starfish #{@uniq} server > #{NULL}"</span>) }
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -10,10 +10,10 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 199</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stop</span>
|
15
15
|
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"stopping the server"</span>
|
16
|
-
<span class="ruby-constant">Process</span>.<span class="ruby-identifier">kill</span>(<span class="ruby-value str">"SIGHUP"</span>, <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>(<span class="ruby-ivar">@@options</span>[<span class="ruby-identifier">:pid</span>] <span class="ruby-operator">||</span> <span class="ruby-node">"
|
16
|
+
<span class="ruby-constant">Process</span>.<span class="ruby-identifier">kill</span>(<span class="ruby-value str">"SIGHUP"</span>, <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>(<span class="ruby-ivar">@@options</span>[<span class="ruby-identifier">:pid</span>] <span class="ruby-operator">||</span> <span class="ruby-node">"#{Dir.tmpdir}/starfish-#{uniq}.pid"</span>).<span class="ruby-identifier">to_i</span>)
|
17
17
|
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>
|
18
18
|
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Fatal error, please kill all starfish processes manually and try again"</span>
|
19
19
|
<span class="ruby-identifier">system</span>(<span class="ruby-value str">"ps auxww|grep starfish"</span>)
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 208</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server=</span>(<span class="ruby-identifier">server</span>)
|
15
15
|
<span class="ruby-ivar">@@server</span> = <span class="ruby-identifier">server</span>
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 212</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">client=</span>(<span class="ruby-identifier">client</span>)
|
15
15
|
<span class="ruby-ivar">@@client</span> = <span class="ruby-identifier">client</span>
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/starfish.rb, line 216</span>
|
14
14
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">options=</span>(<span class="ruby-identifier">options</span>={})
|
15
15
|
<span class="ruby-ivar">@@options</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">options</span>)
|
16
16
|
<span class="ruby-keyword kw">end</span></pre>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Tue Aug 22
|
1
|
+
Tue Aug 22 16:45:30 PDT 2006
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Tue Aug 22
|
59
|
+
<td>Tue Aug 22 16:45:25 PDT 2006</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -79,7 +79,9 @@
|
|
79
79
|
logger
|
80
80
|
md5
|
81
81
|
yaml
|
82
|
+
tmpdir
|
82
83
|
map_reduce
|
84
|
+
win32-process
|
83
85
|
</div>
|
84
86
|
</div>
|
85
87
|
|
@@ -94,6 +96,24 @@
|
|
94
96
|
<div id="section">
|
95
97
|
|
96
98
|
|
99
|
+
<div id="constants-list">
|
100
|
+
<h3 class="section-bar">Constants</h3>
|
101
|
+
|
102
|
+
<div class="name-list">
|
103
|
+
<table summary="Constants">
|
104
|
+
<tr class="top-aligned-row context-row">
|
105
|
+
<td class="context-item-name">STARFISH_FORK</td>
|
106
|
+
<td>=</td>
|
107
|
+
<td class="context-item-value">Win32::Process.method(:fork)</td>
|
108
|
+
</tr>
|
109
|
+
<tr class="top-aligned-row context-row">
|
110
|
+
<td class="context-item-name">STARFISH_FORK</td>
|
111
|
+
<td>=</td>
|
112
|
+
<td class="context-item-value">method(:fork)</td>
|
113
|
+
</tr>
|
114
|
+
</table>
|
115
|
+
</div>
|
116
|
+
</div>
|
97
117
|
|
98
118
|
|
99
119
|
|
data/lib/starfish.rb
CHANGED
@@ -4,19 +4,32 @@ require 'timeout'
|
|
4
4
|
require 'logger'
|
5
5
|
require 'md5'
|
6
6
|
require 'yaml'
|
7
|
+
require 'tmpdir'
|
7
8
|
|
8
9
|
require 'map_reduce'
|
9
10
|
|
10
11
|
DRb.start_service
|
11
12
|
|
13
|
+
if RUBY_PLATFORM =~ /mswin/
|
14
|
+
begin
|
15
|
+
require "win32-process"
|
16
|
+
STARFISH_FORK = Win32::Process.method(:fork)
|
17
|
+
rescue
|
18
|
+
$stderr.puts "Your Windows system does not support forking, please install http://raa.ruby-lang.org/project/win32-process/"
|
19
|
+
end
|
20
|
+
else
|
21
|
+
STARFISH_FORK = method(:fork)
|
22
|
+
end
|
23
|
+
|
12
24
|
class StarfishError < StandardError; end
|
13
25
|
class Starfish
|
14
|
-
VERSION = "1.1.
|
26
|
+
VERSION = "1.1.2"
|
27
|
+
NULL = RUBY_PLATFORM =~ /mswin/ ? 'NUL' : '/dev/null'
|
15
28
|
|
16
29
|
@@server = false
|
17
30
|
@@client = false
|
18
31
|
@@options = {
|
19
|
-
:log => "
|
32
|
+
:log => "#{Dir.tmpdir}/#{File.basename(ARGV.first)}.log"
|
20
33
|
}
|
21
34
|
|
22
35
|
include Rinda
|
@@ -56,7 +69,7 @@ class Starfish
|
|
56
69
|
ts.write([:name, uniq.intern, object, @uniq])
|
57
70
|
end
|
58
71
|
|
59
|
-
File.open(@@options[:pid] || "/
|
72
|
+
File.open(@@options[:pid] || "#{Dir.tmpdir}/starfish-#{uniq}.pid","w"){|f|f<<Process.pid}
|
60
73
|
|
61
74
|
$stderr.puts "server started for #{object.inspect}"
|
62
75
|
|
@@ -145,7 +158,7 @@ class Starfish
|
|
145
158
|
when Class
|
146
159
|
@@options[:log].new
|
147
160
|
when nil, false
|
148
|
-
Logger.new(
|
161
|
+
Logger.new(NULL)
|
149
162
|
else
|
150
163
|
@@options[:log]
|
151
164
|
end
|
@@ -180,12 +193,12 @@ class Starfish
|
|
180
193
|
end
|
181
194
|
|
182
195
|
def spawn
|
183
|
-
@started ||=
|
196
|
+
@started ||= STARFISH_FORK.call { system("ruby #{File.dirname(__FILE__)}/../bin/starfish #{@uniq} server > #{NULL}") }
|
184
197
|
end
|
185
198
|
|
186
199
|
def stop
|
187
200
|
puts "stopping the server"
|
188
|
-
Process.kill("SIGHUP", IO.read(@@options[:pid] || "/
|
201
|
+
Process.kill("SIGHUP", IO.read(@@options[:pid] || "#{Dir.tmpdir}/starfish-#{uniq}.pid").to_i)
|
189
202
|
rescue Errno::ENOENT
|
190
203
|
puts "Fatal error, please kill all starfish processes manually and try again"
|
191
204
|
system("ps auxww|grep starfish")
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: starfish
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.1.
|
6
|
+
version: 1.1.2
|
7
7
|
date: 2006-08-22 00:00:00 -07:00
|
8
8
|
summary: Starfish is a utility to make distributed programming ridiculously easy.
|
9
9
|
require_paths:
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- lib/map_reduce/file.rb
|
37
37
|
- bin/starfish
|
38
38
|
- LICENSE
|
39
|
+
- NUL
|
39
40
|
- Rakefile
|
40
41
|
- README
|
41
42
|
- doc/classes
|