documentcloud-cloud-crowd 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/EPIGRAPHS +17 -0
- data/LICENSE +22 -0
- data/README +75 -0
- data/actions/graphics_magick.rb +1 -3
- data/actions/process_pdfs.rb +92 -0
- data/cloud-crowd.gemspec +24 -4
- data/config/config.example.yml +5 -0
- data/examples/graphics_magick_example.rb +48 -0
- data/examples/process_pdfs_example.rb +30 -0
- data/lib/cloud-crowd.rb +25 -20
- data/lib/cloud_crowd/action.rb +29 -24
- data/lib/cloud_crowd/app.rb +40 -13
- data/lib/cloud_crowd/asset_store.rb +13 -6
- data/lib/cloud_crowd/command_line.rb +11 -5
- data/lib/cloud_crowd/daemon.rb +7 -2
- data/lib/cloud_crowd/exceptions.rb +17 -0
- data/lib/cloud_crowd/helpers.rb +1 -1
- data/lib/cloud_crowd/helpers/authorization.rb +7 -3
- data/lib/cloud_crowd/helpers/resources.rb +12 -3
- data/lib/cloud_crowd/inflector.rb +1 -1
- data/lib/cloud_crowd/models/job.rb +75 -38
- data/lib/cloud_crowd/models/work_unit.rb +14 -8
- data/lib/cloud_crowd/schema.rb +3 -1
- data/lib/cloud_crowd/worker.rb +32 -15
- data/public/css/admin_console.css +51 -0
- data/public/css/reset.css +52 -0
- data/public/images/queue_fill.png +0 -0
- data/public/js/admin_console.js +51 -0
- data/public/js/jquery-1.3.2.js +4376 -0
- data/test/acceptance/test_failing_work_units.rb +2 -2
- data/test/blueprints.rb +1 -0
- data/test/config/config.ru +17 -0
- data/test/unit/test_job.rb +5 -5
- data/test/unit/test_work_unit.rb +1 -1
- data/views/index.erb +22 -0
- metadata +27 -8
@@ -6,7 +6,7 @@ class FailingWorkUnitsTest < Test::Unit::TestCase
|
|
6
6
|
should "retry work units when they fail" do
|
7
7
|
browser = Rack::Test::Session.new(Rack::MockSession.new(CloudCrowd::App))
|
8
8
|
|
9
|
-
browser.post '/jobs', :
|
9
|
+
browser.post '/jobs', :job => {
|
10
10
|
'action' => 'failure_testing',
|
11
11
|
'inputs' => ['one', 'two', 'three'],
|
12
12
|
'options' => {}
|
@@ -21,7 +21,7 @@ class FailingWorkUnitsTest < Test::Unit::TestCase
|
|
21
21
|
job.work_units.reload.each_with_index do |unit, i|
|
22
22
|
assert unit.processing?
|
23
23
|
assert unit.attempts == CloudCrowd.config[:work_unit_retries] - 1
|
24
|
-
unit.fail('failed', 10)
|
24
|
+
unit.fail('{"output":"failed"}', 10)
|
25
25
|
assert unit.job.any_work_units_failed? if i == 0
|
26
26
|
end
|
27
27
|
assert job.reload.failed?
|
data/test/blueprints.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# This rackup script can be used to start the central CloudCrowd server
|
4
|
+
# using any Rack-compliant server handler. For example, start up three servers
|
5
|
+
# with a specified port number, using Thin:
|
6
|
+
#
|
7
|
+
# thin start -R config.ru -p 9173 --servers 3
|
8
|
+
|
9
|
+
require 'rubygems'
|
10
|
+
require 'cloud-crowd'
|
11
|
+
|
12
|
+
CloudCrowd.configure(File.dirname(__FILE__) + '/config.yml')
|
13
|
+
CloudCrowd.configure_database(File.dirname(__FILE__) + '/database.yml')
|
14
|
+
|
15
|
+
map '/' do
|
16
|
+
run CloudCrowd::App
|
17
|
+
end
|
data/test/unit/test_job.rb
CHANGED
@@ -25,7 +25,7 @@ class JobTest < Test::Unit::TestCase
|
|
25
25
|
|
26
26
|
should "know its completion status" do
|
27
27
|
assert !@job.all_work_units_complete?
|
28
|
-
@unit.update_attributes(:status => CloudCrowd::SUCCEEDED, :output => 'hello')
|
28
|
+
@unit.update_attributes(:status => CloudCrowd::SUCCEEDED, :output => '{"output":"hello"}')
|
29
29
|
assert @job.reload.all_work_units_complete?
|
30
30
|
assert @job.percent_complete == 100
|
31
31
|
assert @job.outputs == "[\"hello\"]"
|
@@ -46,14 +46,14 @@ class JobTest < Test::Unit::TestCase
|
|
46
46
|
end
|
47
47
|
|
48
48
|
should "create jobs with a SPLITTING status for actions that have a split method defined" do
|
49
|
-
job = CloudCrowd::Job.create_from_request({'inputs' => ['1'], 'action' => 'pdf_to_images'})
|
50
|
-
assert job.splittable?
|
51
|
-
assert job.splitting?
|
49
|
+
# job = CloudCrowd::Job.create_from_request({'inputs' => ['1'], 'action' => 'pdf_to_images'})
|
50
|
+
# assert job.splittable?
|
51
|
+
# assert job.splitting?
|
52
52
|
end
|
53
53
|
|
54
54
|
should "fire a callback when a job has finished, successfully or not" do
|
55
55
|
CloudCrowd::Job.any_instance.expects(:fire_callback)
|
56
|
-
@job.work_units.first.finish('output', 10)
|
56
|
+
@job.work_units.first.finish('{"output":"output"}', 10)
|
57
57
|
assert @job.all_work_units_complete?
|
58
58
|
end
|
59
59
|
|
data/test/unit/test_work_unit.rb
CHANGED
data/views/index.erb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
5
|
+
<title>Operations Center | CloudCrowd</title>
|
6
|
+
<link href="/css/reset.css" media="screen" rel="stylesheet" type="text/css" />
|
7
|
+
<link href="/css/admin_console.css" media="screen" rel="stylesheet" type="text/css" />
|
8
|
+
<script src="/js/jquery-1.3.2.js" type="text/javascript"></script>
|
9
|
+
<script src="/js/admin_console.js" type="text/javascript"></script>
|
10
|
+
</head>
|
11
|
+
|
12
|
+
<body>
|
13
|
+
<div id="container">
|
14
|
+
<div id="queue">
|
15
|
+
<div id="jobs">
|
16
|
+
<%# Render target for jobs. %>
|
17
|
+
</div>
|
18
|
+
<div id="queue_fill"></div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</body>
|
22
|
+
</html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: documentcloud-cloud-crowd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Ashkenas
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-01 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -128,20 +128,25 @@ executables:
|
|
128
128
|
- crowd
|
129
129
|
extensions: []
|
130
130
|
|
131
|
-
extra_rdoc_files:
|
132
|
-
|
131
|
+
extra_rdoc_files:
|
132
|
+
- README
|
133
133
|
files:
|
134
134
|
- actions/graphics_magick.rb
|
135
|
+
- actions/process_pdfs.rb
|
135
136
|
- cloud-crowd.gemspec
|
136
137
|
- config/config.example.ru
|
137
138
|
- config/config.example.yml
|
138
139
|
- config/database.example.yml
|
140
|
+
- EPIGRAPHS
|
141
|
+
- examples/graphics_magick_example.rb
|
142
|
+
- examples/process_pdfs_example.rb
|
139
143
|
- lib/cloud-crowd.rb
|
140
144
|
- lib/cloud_crowd/action.rb
|
141
145
|
- lib/cloud_crowd/app.rb
|
142
146
|
- lib/cloud_crowd/asset_store.rb
|
143
147
|
- lib/cloud_crowd/command_line.rb
|
144
148
|
- lib/cloud_crowd/daemon.rb
|
149
|
+
- lib/cloud_crowd/exceptions.rb
|
145
150
|
- lib/cloud_crowd/helpers/authorization.rb
|
146
151
|
- lib/cloud_crowd/helpers/resources.rb
|
147
152
|
- lib/cloud_crowd/helpers.rb
|
@@ -152,20 +157,34 @@ files:
|
|
152
157
|
- lib/cloud_crowd/runner.rb
|
153
158
|
- lib/cloud_crowd/schema.rb
|
154
159
|
- lib/cloud_crowd/worker.rb
|
160
|
+
- LICENSE
|
161
|
+
- public/css/admin_console.css
|
162
|
+
- public/css/reset.css
|
163
|
+
- public/images/queue_fill.png
|
164
|
+
- public/js/admin_console.js
|
165
|
+
- public/js/jquery-1.3.2.js
|
166
|
+
- README
|
155
167
|
- test/acceptance/test_failing_work_units.rb
|
156
168
|
- test/blueprints.rb
|
169
|
+
- test/config/config.ru
|
157
170
|
- test/config/config.yml
|
158
171
|
- test/config/database.yml
|
159
172
|
- test/config/actions/failure_testing.rb
|
160
173
|
- test/test_helper.rb
|
161
174
|
- test/unit/test_job.rb
|
162
175
|
- test/unit/test_work_unit.rb
|
176
|
+
- views/index.erb
|
163
177
|
has_rdoc: true
|
164
178
|
homepage: http://documentcloud.org
|
165
|
-
licenses:
|
166
179
|
post_install_message:
|
167
|
-
rdoc_options:
|
168
|
-
|
180
|
+
rdoc_options:
|
181
|
+
- --title
|
182
|
+
- CloudCrowd | Better Living through Map --> Ruby --> Reduce
|
183
|
+
- --exclude
|
184
|
+
- test
|
185
|
+
- --main
|
186
|
+
- README
|
187
|
+
- --all
|
169
188
|
require_paths:
|
170
189
|
- lib
|
171
190
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -183,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
202
|
requirements: []
|
184
203
|
|
185
204
|
rubyforge_project: cloud-crowd
|
186
|
-
rubygems_version: 1.
|
205
|
+
rubygems_version: 1.2.0
|
187
206
|
signing_key:
|
188
207
|
specification_version: 2
|
189
208
|
summary: Better living through Map --> Ruby --> Reduce
|