cloudfactory 0.2.5 → 0.2.6
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/CHANGELOG.md +7 -0
- data/lib/cf/cli.rb +41 -41
- data/lib/cf/cli/line.rb +24 -4
- data/lib/cf/cli/line_yaml_validator.rb +3 -1
- data/lib/cf/cli/templates/sample-line/sample-line.csv +2 -2
- data/lib/cf/line.rb +20 -7
- data/lib/cf/station.rb +35 -12
- data/lib/cf/version.rb +1 -1
- data/spec/badge_spec.rb +6 -6
- data/spec/concept_tagging_robot_spec.rb +2 -0
- data/spec/content_scraping_robot_spec.rb +6 -4
- data/spec/custom_task_form_spec.rb +11 -11
- data/spec/entity_extraction_robot_spec.rb +12 -10
- data/spec/form_field_spec.rb +6 -6
- data/spec/google_translate_robot_spec.rb +4 -3
- data/spec/human_worker_spec.rb +8 -8
- data/spec/image_processing_robot_spec.rb +2 -0
- data/spec/input_format_spec.rb +2 -3
- data/spec/keyword_matching_and_text_extraction_robot_spec.rb +2 -0
- data/spec/line_spec.rb +21 -21
- data/spec/mailer_robot_spec.rb +8 -6
- data/spec/media_converter_robot_spec.rb +8 -7
- data/spec/media_splitting_robot_spec.rb +2 -0
- data/spec/robot_worker_spec.rb +1 -1
- data/spec/run_spec.rb +31 -20
- data/spec/sentiment_robot_spec.rb +2 -0
- data/spec/station_spec.rb +11 -14
- data/spec/task_form_spec.rb +9 -9
- data/spec/term_extraction_robot_spec.rb +6 -4
- data/spec/text_appending_robot_spec.rb +2 -2
- metadata +48 -48
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 0.2.6 (2011-09-09)
|
2
|
+
|
3
|
+
* cf line inspect cmd changed to cf line details because the inspect method is the Ruby's declared method
|
4
|
+
* acceptance_ratio parameter added in gem for tournament station
|
5
|
+
* while creating a line which has production runs was giving inappropriate messages. its fixed.
|
6
|
+
* sample line input file now has our own hosted files
|
7
|
+
|
1
8
|
## 0.2.5 (2011-09-01)
|
2
9
|
|
3
10
|
* Broken url after doing production run on date 01 - 09 day. Fixed
|
data/lib/cf/cli.rb
CHANGED
@@ -33,18 +33,18 @@ module Cf # :nodoc: all
|
|
33
33
|
class CLI < Thor # :nodoc: all
|
34
34
|
include Thor::Actions
|
35
35
|
include Cf::Config
|
36
|
-
|
36
|
+
|
37
37
|
map "-v" => :version
|
38
|
-
|
38
|
+
|
39
39
|
desc "login", "Setup the cloudfactory credentials"
|
40
40
|
|
41
41
|
def login
|
42
42
|
email = ask("Enter your email:")
|
43
43
|
passwd = ask_password("Enter the password: ")
|
44
|
-
|
44
|
+
|
45
45
|
set_target_uri(false)
|
46
46
|
resp = CF::Account.login(email, passwd)
|
47
|
-
|
47
|
+
|
48
48
|
if resp.error.blank? and resp.api_key.present?
|
49
49
|
File.open(config_file, 'w') {|f| f.write("#Don't change this file unless you know what you're doing\n" + { :target_url => CF.api_url, :api_version => CF.api_version, :api_key => resp.api_key, :account_name => resp.account_name, :email => email.strip }.to_yaml) }
|
50
50
|
say("\nNow you're logged in.\nTo get started, run cf help\n", :green)
|
@@ -52,7 +52,7 @@ module Cf # :nodoc: all
|
|
52
52
|
say("\n#{resp.error.message}\nTry again with valid one.\n", :red)
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
no_tasks do
|
57
57
|
def ask_password(message)
|
58
58
|
::HighLine.new.ask(message) do |q|
|
@@ -60,18 +60,18 @@ module Cf # :nodoc: all
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
desc "whoami", "to know what credential you are using"
|
65
65
|
def whoami
|
66
66
|
if File.exists?(config_file)
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
yp = YAML::load(File.open(config_file,'r'))
|
68
|
+
say("\nAccount => #{yp[:account_name]}", :green)
|
69
|
+
say("Email => #{yp[:email]}\n", :green)
|
70
70
|
else
|
71
|
-
|
71
|
+
say("\nPlease login with cf login\n")
|
72
72
|
end
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
# desc "target", "Setup the cloudfactory credentials. e.g. cf target staging #=> http://sandbox.staging.cloudfactory.com (options: staging/development/production)"
|
76
76
|
# def target(target_url=nil)
|
77
77
|
# if target_url.present?
|
@@ -93,62 +93,62 @@ module Cf # :nodoc: all
|
|
93
93
|
|
94
94
|
desc "form", "Commands to generate custom task forms. For more info, cf form help"
|
95
95
|
subcommand "form", Cf::Form
|
96
|
-
|
96
|
+
|
97
97
|
desc "production", "Commands to create production runs. For more info, cf production help"
|
98
98
|
# cannot use Run for the class name coz its a reserved word for Thor
|
99
99
|
# later it can be replaced with hacked millisami-thor version of the thor library with run-time dependency via Bundler
|
100
100
|
subcommand "production", Cf::Production
|
101
101
|
|
102
102
|
desc "output <run-title>", "Get the output of run. For more info, cf output help"
|
103
|
+
method_option :run_title, :type => :string, :required => true, :aliases => "-t", :desc => "the index of the station"
|
103
104
|
method_option :station_index, :type => :numeric, :aliases => "-s", :desc => "the index of the station"
|
104
|
-
def output
|
105
|
+
def output
|
106
|
+
run_title = options['run_title']
|
105
107
|
if run_title.present?
|
106
108
|
run_title = run_title.parameterize
|
107
109
|
line_source = Dir.pwd
|
108
110
|
yaml_source = "#{line_source}/line.yml"
|
109
111
|
|
110
|
-
unless File.exist?(yaml_source)
|
111
|
-
say "The line.yml file does not exist in this directory", :red
|
112
|
-
return
|
113
|
-
end
|
114
|
-
|
115
112
|
set_target_uri(false)
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
113
|
+
set_api_key(yaml_source)
|
114
|
+
CF.account_name = CF::Account.info.name
|
115
|
+
run = CF::Run.find(run_title)
|
116
|
+
if run.errors.blank?
|
117
|
+
say("Fetching output for run: #{run_title}", :green)
|
118
|
+
|
119
|
+
if options[:station_index].present?
|
120
|
+
# Output for specific station
|
121
|
+
output = CF::Run.output(:title => run_title, :station => options[:station_index])
|
122
|
+
else
|
123
|
+
# Ouput for the whole production run
|
124
|
+
output = CF::Run.final_output(run_title)
|
125
|
+
end
|
126
|
+
res_array = []
|
127
|
+
output.each do |o|
|
128
|
+
res_array << o.to_hash
|
129
|
+
end
|
130
|
+
if !res_array.empty?
|
131
|
+
res_array.each
|
133
132
|
csv_str = CSVHash(res_array,res_array.first.keys)
|
134
|
-
|
135
|
-
FileUtils.mkdir("#{line_source}/output") unless Dir.exist?("#{line_source}/output")
|
133
|
+
csv_str = csv_str.gsub("\"\"", '"')
|
134
|
+
FileUtils.mkdir("#{line_source}/output") unless Dir.exist?("#{line_source}/output") if RUBY_VERSION > "1.9"
|
135
|
+
FileUtils.mkdir("#{line_source}/output") unless File.directory?("#{line_source}/output") if RUBY_VERSION < "1.9"
|
136
136
|
csv_file_name = "#{line_source}/output/#{run_title}-#{Time.now.strftime("%e %b %Y %H:%m-%S%p").parameterize}.csv"
|
137
137
|
File.open(csv_file_name, 'w') {|f| f.write(csv_str) }
|
138
138
|
say("Output saved at #{csv_file_name}\n", :yellow)
|
139
139
|
else
|
140
|
-
say("
|
140
|
+
say("Run not completed yet", :red)
|
141
141
|
end
|
142
|
-
|
143
142
|
else
|
144
|
-
say("
|
143
|
+
say("Error: #{run.errors.inspect}", :red)
|
145
144
|
end
|
145
|
+
|
146
146
|
else
|
147
147
|
say("\nThe run title must be provided to get the output.", :red)
|
148
148
|
say("\te.g. cf output my-run-title\n", :yellow)
|
149
149
|
end
|
150
150
|
end
|
151
|
-
|
151
|
+
|
152
152
|
desc "version", "Shows the current version of cloudfactory gem"
|
153
153
|
def version
|
154
154
|
say("Version: #{CF::VERSION}")
|
data/lib/cf/cli/line.rb
CHANGED
@@ -113,7 +113,26 @@ module Cf # :nodoc: all
|
|
113
113
|
no_tasks {
|
114
114
|
# method to call with line title to delete the line if validation fails during the creation of line
|
115
115
|
def rollback(line_title)
|
116
|
-
CF::Line.destroy(line_title)
|
116
|
+
deleted_resp = CF::Line.destroy(line_title)
|
117
|
+
if !deleted_resp.error.nil?
|
118
|
+
if deleted_resp.error.message == "Cannot delete line. You have production runs using this line. Pass force option to enforce deletion."
|
119
|
+
say("!!! Warning !!!\nThe following are the existing production runs based on this line.", :yellow)
|
120
|
+
existing_runs = Cf::Production.new([],{'line' => line_title, 'all' => true})
|
121
|
+
existing_runs.list
|
122
|
+
|
123
|
+
say("\n!!! Warning !!!\nDeleting this line will also delete all the existing production runs based on this line.\n", :yellow)
|
124
|
+
delete_forcefully = agree("Do you still want to delete this line? [y/n] ")
|
125
|
+
say("\n")
|
126
|
+
if delete_forcefully
|
127
|
+
resp = CF::Line.destroy(line_title, :forced => true)
|
128
|
+
if resp.code != 200
|
129
|
+
say("Error: #{resp.error.message}\n", :red)
|
130
|
+
end
|
131
|
+
else
|
132
|
+
say("Line deletion aborted!\n", :cyan)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
117
136
|
end
|
118
137
|
|
119
138
|
def display_error(line_title, error_message)
|
@@ -203,7 +222,8 @@ module Cf # :nodoc: all
|
|
203
222
|
if type == "tournament"
|
204
223
|
jury_worker = station_file['station']['jury_worker']
|
205
224
|
auto_judge = station_file['station']['auto_judge']
|
206
|
-
|
225
|
+
acceptance_ratio = station_file['station']['acceptance_ratio']
|
226
|
+
station_params = {:line => line, :type => type, :jury_worker => jury_worker, :auto_judge => auto_judge, :input_formats => input_formats_for_station, :batch_size => batch_size, :acceptance_ratio => acceptance_ratio}
|
207
227
|
else
|
208
228
|
station_params = {:line => line, :type => type, :input_formats => input_formats_for_station, :batch_size => batch_size}
|
209
229
|
end
|
@@ -345,10 +365,10 @@ module Cf # :nodoc: all
|
|
345
365
|
end
|
346
366
|
}
|
347
367
|
|
348
|
-
desc "line
|
368
|
+
desc "line details", "list the details of the line"
|
349
369
|
method_option :line, :type => :string, :aliases => "-l", :desc => "specify the line-title to inspect"
|
350
370
|
# method_option :verbose, :type => :boolean, :aliases => "-v", :desc => "gives the detailed structure of the line"
|
351
|
-
def
|
371
|
+
def details
|
352
372
|
if options['line'].blank?
|
353
373
|
line_source = Dir.pwd
|
354
374
|
yaml_source = "#{line_source}/line.yml"
|
@@ -51,6 +51,8 @@ module Cf
|
|
51
51
|
errors << "Reward for Jury worker is missing in block of Tournament Station #{i+1}!" if reward.nil?
|
52
52
|
errors << "Reward Must be greater than 0 in Block station #{i+1}!" if !reward.nil? && reward < 1
|
53
53
|
end
|
54
|
+
acceptance_ratio = station['station']['acceptance_ratio']
|
55
|
+
errors << "Acceptance ratio must lie between 0 and 1 in Block station #{i+1}!" if !acceptance_ratio.nil? && acceptance_ratio > 1 or acceptance_ratio < 0
|
54
56
|
end
|
55
57
|
# Checking Worker
|
56
58
|
worker = station['station']['worker']
|
@@ -160,7 +162,7 @@ module Cf
|
|
160
162
|
required = form_field['required']
|
161
163
|
field_type = form_field['field_type']
|
162
164
|
if !field_type.nil?
|
163
|
-
unless %w(short_answer long_answer radio_button check_box select_box
|
165
|
+
unless %w(short_answer long_answer radio_button check_box select_box).include?(field_type)
|
164
166
|
errors << "Field Type of Form Field is invalid in Block #{index+1} of station Block #{i+1}!"
|
165
167
|
end
|
166
168
|
if field_type == "radio_button" || field_type == "select_box"
|
@@ -1,3 +1,3 @@
|
|
1
1
|
email,location,photo
|
2
|
-
|
3
|
-
|
2
|
+
julia@doe.com,Jacksonville, http://media-robot.s3.amazonaws.com/BionicWoman.gif
|
3
|
+
chuck@noris.com,San Diego, http://media-robot.s3.amazonaws.com/man.jpg
|
data/lib/cf/line.rb
CHANGED
@@ -67,6 +67,7 @@ module CF
|
|
67
67
|
if type == "Tournament"
|
68
68
|
@jury_worker = stations.jury_worker
|
69
69
|
@auto_judge = stations.auto_judge
|
70
|
+
@acceptance_ratio = stations.acceptance_ratio
|
70
71
|
if @batch_size.nil?
|
71
72
|
request_tournament =
|
72
73
|
{
|
@@ -77,14 +78,25 @@ module CF
|
|
77
78
|
}
|
78
79
|
}
|
79
80
|
else
|
80
|
-
|
81
|
-
|
82
|
-
:body =>
|
81
|
+
if @acceptance_ratio.nil?
|
82
|
+
request_tournament =
|
83
83
|
{
|
84
|
-
:
|
85
|
-
|
84
|
+
:body =>
|
85
|
+
{
|
86
|
+
:api_key => CF.api_key,
|
87
|
+
:station => {:type => type, :jury_worker => @jury_worker, :auto_judge => @auto_judge, :input_formats => @station_input_formats, :batch_size => @batch_size}
|
88
|
+
}
|
86
89
|
}
|
87
|
-
|
90
|
+
else
|
91
|
+
request_tournament =
|
92
|
+
{
|
93
|
+
:body =>
|
94
|
+
{
|
95
|
+
:api_key => CF.api_key,
|
96
|
+
:station => {:type => type, :jury_worker => @jury_worker, :auto_judge => @auto_judge, :input_formats => @station_input_formats, :batch_size => @batch_size, :acceptance_ratio => @acceptance_ratio}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
end
|
88
100
|
end
|
89
101
|
resp = HTTParty.post("#{CF.api_url}#{CF.api_version}/lines/#{CF.account_name}/#{self.title.downcase}/stations.json",request_tournament)
|
90
102
|
else
|
@@ -290,7 +302,8 @@ module CF
|
|
290
302
|
# ===Usage Example:
|
291
303
|
# CF::Line.public_lines
|
292
304
|
def self.public_lines
|
293
|
-
get("/public_lines.json")
|
305
|
+
resp = get("/public_lines.json")
|
306
|
+
resp.lines
|
294
307
|
end
|
295
308
|
|
296
309
|
# ==Updates a line
|
data/lib/cf/station.rb
CHANGED
@@ -44,6 +44,7 @@ module CF
|
|
44
44
|
@station_input_formats = options[:input_formats]
|
45
45
|
@line_instance = options[:line]
|
46
46
|
@batch_size = options[:batch_size]
|
47
|
+
@acceptance_ratio = options[:acceptance_ratio]
|
47
48
|
if @batch_size.nil?
|
48
49
|
request_general =
|
49
50
|
{
|
@@ -53,14 +54,25 @@ module CF
|
|
53
54
|
:station => {:type => @type, :input_formats => @station_input_formats}
|
54
55
|
}
|
55
56
|
}
|
56
|
-
|
57
|
-
|
58
|
-
:body =>
|
57
|
+
if @acceptance_ratio.nil?
|
58
|
+
request_tournament =
|
59
59
|
{
|
60
|
-
:
|
61
|
-
|
60
|
+
:body =>
|
61
|
+
{
|
62
|
+
:api_key => CF.api_key,
|
63
|
+
:station => {:type => @type, :jury_worker => @jury_worker, :auto_judge => @auto_judge, :input_formats => @station_input_formats}
|
64
|
+
}
|
62
65
|
}
|
63
|
-
|
66
|
+
else
|
67
|
+
request_tournament =
|
68
|
+
{
|
69
|
+
:body =>
|
70
|
+
{
|
71
|
+
:api_key => CF.api_key,
|
72
|
+
:station => {:type => @type, :jury_worker => @jury_worker, :auto_judge => @auto_judge, :input_formats => @station_input_formats, :acceptance_ratio => @acceptance_ratio}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
end
|
64
76
|
else
|
65
77
|
request_general =
|
66
78
|
{
|
@@ -70,14 +82,25 @@ module CF
|
|
70
82
|
:station => {:type => @type, :input_formats => @station_input_formats, :batch_size => @batch_size}
|
71
83
|
}
|
72
84
|
}
|
73
|
-
|
74
|
-
|
75
|
-
:body =>
|
85
|
+
if @acceptance_ratio.nil?
|
86
|
+
request_tournament =
|
76
87
|
{
|
77
|
-
:
|
78
|
-
|
88
|
+
:body =>
|
89
|
+
{
|
90
|
+
:api_key => CF.api_key,
|
91
|
+
:station => {:type => @type, :jury_worker => @jury_worker, :auto_judge => @auto_judge, :input_formats => @station_input_formats, :batch_size => @batch_size}
|
92
|
+
}
|
79
93
|
}
|
80
|
-
|
94
|
+
else
|
95
|
+
request_tournament =
|
96
|
+
{
|
97
|
+
:body =>
|
98
|
+
{
|
99
|
+
:api_key => CF.api_key,
|
100
|
+
:station => {:type => @type, :jury_worker => @jury_worker, :auto_judge => @auto_judge, :input_formats => @station_input_formats, :batch_size => @batch_size, :acceptance_ratio => @acceptance_ratio}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
end
|
81
104
|
end
|
82
105
|
if @line_title
|
83
106
|
if @type == "Improve"
|
data/lib/cf/version.rb
CHANGED
data/spec/badge_spec.rb
CHANGED
@@ -33,12 +33,12 @@ module CF
|
|
33
33
|
line = CF::Line.create("badge_in_worker", "Digitization") do |l|
|
34
34
|
CF::InputFormat.new({:line => l, :name => "image_url", :required => true, :valid_type => "url"})
|
35
35
|
CF::Station.create({:line =>l, :type => "work"}) do |s|
|
36
|
-
CF::HumanWorker.new({:station => s, :number =>
|
36
|
+
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20, :skill_badge => badge})
|
37
37
|
end
|
38
38
|
end
|
39
39
|
line.stations.first.worker.badge = badge_1
|
40
40
|
line.stations.first.type.should eql("WorkStation")
|
41
|
-
line.stations.first.worker.number.should eql(
|
41
|
+
line.stations.first.worker.number.should eql(1)
|
42
42
|
line.stations.first.worker.reward.should eql(20)
|
43
43
|
line.stations.first.worker.skill_badges.first.should eql([{"title"=>"Football Fanatic", "description"=>"This qualification allows you to perform work at stations which have this badge.", "score"=>nil, "quality_rating"=>nil, "max_badges"=>3, "skill_test"=>{"score_after"=>"submit", "manual_scoring"=>false, "display_answers"=>false, "edit_answers"=>true, "retries"=>0, "pass_percentage"=>100, "test_units"=>[{"input"=>{"name"=>"Lionel Andres Messi", "country"=>"Argentina"}, "expected_output"=>[{"birthplace"=>"Rosario, Santa Fe, Argentina", "match_options"=>{"tolerance"=>"1", "ignore_case"=>"false"}, "position"=>"CF", "current-club"=>"Barcelona"}], "match_options"=>{"tolerance"=>0, "ignore_case"=>false}}]}}])
|
44
44
|
line.stations.first.worker.skill_badges.last.should eql([{"title"=>"Football Fanatic", "description"=>"This qualification allows you to perform work at stations which have this badge.", "score"=>nil, "quality_rating"=>nil, "max_badges"=>3, "skill_test"=>{"score_after"=>"submit", "manual_scoring"=>false, "display_answers"=>false, "edit_answers"=>true, "retries"=>0, "pass_percentage"=>100, "test_units"=>[{"input"=>{"name"=>"Cristiano Ronaldo", "country"=>"Portugal"}, "expected_output"=>[{"birthplace"=>"Rosario, Santa Fe, Portugal", "match_options"=>{"tolerance"=>"1", "ignore_case"=>"false"}, "position"=>"CF", "current-club"=>"Real Madrid"}], "match_options"=>{"tolerance"=>0, "ignore_case"=>false}}]}}])
|
@@ -53,11 +53,11 @@ module CF
|
|
53
53
|
line = CF::Line.create("stat_badge_in_worker", "Digitization") do |l|
|
54
54
|
CF::InputFormat.new({:line => l, :name => "image_url", :required => true, :valid_type => "url"})
|
55
55
|
CF::Station.create({:line =>l, :type => "work"}) do |s|
|
56
|
-
CF::HumanWorker.new({:station => s, :number =>
|
56
|
+
CF::HumanWorker.new({:station => s, :number => 1, :reward => 20, :stat_badge => stat_badge})
|
57
57
|
end
|
58
58
|
end
|
59
59
|
line.stations.first.type.should eql("WorkStation")
|
60
|
-
line.stations.first.worker.number.should eql(
|
60
|
+
line.stations.first.worker.number.should eql(1)
|
61
61
|
line.stations.first.worker.reward.should eql(20)
|
62
62
|
line.stations.first.worker.stat_badge.should eql({"approval_rating"=>40, "assignment_duration"=>1800, "abandonment_rate"=>30, "country"=>nil})
|
63
63
|
end
|
@@ -74,11 +74,11 @@ module CF
|
|
74
74
|
station = CF::Station.new({:type => "work"})
|
75
75
|
line.stations station
|
76
76
|
|
77
|
-
worker = CF::HumanWorker.new({:number =>
|
77
|
+
worker = CF::HumanWorker.new({:number => 1, :reward => 20, :stat_badge => stat_badge})
|
78
78
|
line.stations.first.worker = worker
|
79
79
|
|
80
80
|
line.stations.first.type.should eql("WorkStation")
|
81
|
-
line.stations.first.worker.number.should eql(
|
81
|
+
line.stations.first.worker.number.should eql(1)
|
82
82
|
line.stations.first.worker.reward.should eql(20)
|
83
83
|
line.stations.first.worker.stat_badge.should eql({"approval_rating"=>40, "assignment_duration"=>1800, "abandonment_rate"=>30, "country"=>nil})
|
84
84
|
end
|
@@ -14,6 +14,7 @@ module CF
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
run = CF::Run.create(line, "concept_tagging_robot_run", [{"url"=>"www.mosexindex.com"}])
|
17
|
+
# sleep 20 # require delay for final_output's processing
|
17
18
|
output = run.final_output
|
18
19
|
output.first['concept_tagging_of_url'].should eql(["Canada", "English language"])
|
19
20
|
output.first['concept_tagging_relevance_of_url'].should eql([89.5153, 79.0912])
|
@@ -39,6 +40,7 @@ module CF
|
|
39
40
|
line.stations.first.worker = worker
|
40
41
|
|
41
42
|
run = CF::Run.create(line, "concept_tagging_robot_run_1", [{"url"=>"www.mosexindex.com"}])
|
43
|
+
# sleep 20 # require delay for final_output's processing
|
42
44
|
output = run.final_output
|
43
45
|
output.first['concept_tagging_of_url'].should eql(["Canada", "English language"])
|
44
46
|
output.first['concept_tagging_relevance_of_url'].should eql([89.5153, 79.0912])
|
@@ -14,9 +14,10 @@ module CF
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
run = CF::Run.create(line, "content_scraping_robot_run", [{"url"=> "http://www.sprout-technology.com"}])
|
17
|
-
|
17
|
+
# sleep 30
|
18
18
|
output = run.final_output
|
19
|
-
output.first['scraped_link_from_document'].should eql([
|
19
|
+
output.first['scraped_link_from_document'].should eql([""])
|
20
|
+
output.first['scraped_text_from_document'].should eql([""])
|
20
21
|
|
21
22
|
line.stations.first.worker.class.should eql(CF::RobotWorker)
|
22
23
|
line.stations.first.worker.reward.should eql(0.5)
|
@@ -40,9 +41,10 @@ module CF
|
|
40
41
|
line.stations.first.worker = worker
|
41
42
|
|
42
43
|
run = CF::Run.create(line, "content_scraping_robot_run_1", [{"url"=> "http://www.sprout-technology.com"}])
|
43
|
-
|
44
|
+
# sleep 30
|
44
45
|
output = run.final_output
|
45
|
-
output.first['scraped_link_from_document'].should eql([
|
46
|
+
output.first['scraped_link_from_document'].should eql([""])
|
47
|
+
output.first['scraped_text_from_document'].should eql([""])
|
46
48
|
|
47
49
|
line.stations.first.worker.class.should eql(CF::RobotWorker)
|
48
50
|
line.stations.first.worker.reward.should eql(0.5)
|