mini_autobot 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/lib/mini_autobot/parallel.rb +43 -41
- data/lib/mini_autobot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cc67ceef5896e0d638609b72025a40233cd24ab
|
4
|
+
data.tar.gz: b0f4a4bc84afd272d3b969c93f157cbfe9617496
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ae15ae997a355a466464bb92fab425ab82e28e1f4b94b5853873d2bbe69a79207e9075f52d37623e4f660a8bc357cf298229850ec41825fd32e84a449053586
|
7
|
+
data.tar.gz: 52cfa030069a7dfa2c7dfc45d36743dbe445965b7f2b90d90638fbb89b87f4f2d1075c7376202bfe8f672fc48cd53ac4a9a77241daf9e5e168e23d830906647e
|
@@ -23,8 +23,7 @@ module MiniAutobot
|
|
23
23
|
# return true only if specified to run on mac in connector
|
24
24
|
# @return [boolean]
|
25
25
|
def run_on_mac?
|
26
|
-
|
27
|
-
return false
|
26
|
+
@platform.include?('osx')
|
28
27
|
end
|
29
28
|
|
30
29
|
# remove all results files under logs/tap_results/
|
@@ -34,9 +33,8 @@ module MiniAutobot
|
|
34
33
|
end
|
35
34
|
|
36
35
|
def count_autobot_process
|
37
|
-
|
38
|
-
|
39
|
-
count_of_processes
|
36
|
+
counting_process_output = IO.popen "ps -ef | grep 'bin/#{@static_run_command}' -c"
|
37
|
+
counting_process_output.readlines[0].to_i - 1 # minus grep process
|
40
38
|
end
|
41
39
|
|
42
40
|
# run multiple commands with logging to start multiple tests in parallel
|
@@ -48,7 +46,7 @@ module MiniAutobot
|
|
48
46
|
if run_on_mac?
|
49
47
|
@simultaneous_jobs = 10 # saucelabs account limit for parallel is 10 for mac
|
50
48
|
else
|
51
|
-
@simultaneous_jobs =
|
49
|
+
@simultaneous_jobs = 20 # saucelabs account limit for parallel is 15 for non-mac
|
52
50
|
end
|
53
51
|
end
|
54
52
|
|
@@ -65,62 +63,55 @@ module MiniAutobot
|
|
65
63
|
keep_running_full(all_to_run)
|
66
64
|
end
|
67
65
|
|
68
|
-
|
69
|
-
wait_for_pids(@pids) unless ENV['JENKINS_HOME']
|
66
|
+
Process.waitall
|
70
67
|
puts "\nAll Complete! Started at #{@start_time} and finished at #{Time.now}\n"
|
71
68
|
exit
|
72
69
|
end
|
73
70
|
|
74
|
-
def wait_for_pids(pids)
|
75
|
-
running_pids = pids # assume all pids are running at this moment
|
76
|
-
while running_pids.size > 1
|
77
|
-
sleep 5
|
78
|
-
puts "running_pids = #{running_pids}"
|
79
|
-
running_pids.each do |pid|
|
80
|
-
unless process_running?(pid)
|
81
|
-
puts "#{pid} is not running, removing it from pool"
|
82
|
-
running_pids.delete(pid)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def process_running?(pid)
|
89
|
-
begin
|
90
|
-
Process.getpgid(pid)
|
91
|
-
true
|
92
|
-
rescue Errno::ESRCH
|
93
|
-
false
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
71
|
# runs each test from a test set in a separate child process
|
98
72
|
def run_test_set(test_set)
|
99
73
|
test_set.each do |test|
|
100
74
|
run_command = "#{@static_run_command} -n #{test} #{@pipe_tap} > logs/tap_results/#{test}.t"
|
101
75
|
pipe = IO.popen(run_command)
|
102
76
|
puts "Running #{test} #{pipe.pid}"
|
103
|
-
@pids << pipe.pid
|
104
77
|
end
|
105
78
|
end
|
106
79
|
|
80
|
+
# recursively keep running #{simultaneous_jobs} number of tests in parallel
|
81
|
+
# exit when no test left to run
|
107
82
|
def keep_running_full(all_to_run)
|
108
|
-
|
109
|
-
|
110
|
-
|
83
|
+
running_subprocess_count = count_autobot_process - 1 # minus parent process
|
84
|
+
puts "WARNING: running_subprocess_count = #{running_subprocess_count}
|
85
|
+
is more than what it is supposed to run(#{simultaneous_jobs}),
|
86
|
+
notify mini_autobot maintainers" if running_subprocess_count > simultaneous_jobs + 1
|
87
|
+
while running_subprocess_count >= simultaneous_jobs
|
111
88
|
sleep 5
|
112
|
-
|
89
|
+
running_subprocess_count = count_autobot_process - 1
|
113
90
|
end
|
114
|
-
to_run_count =
|
91
|
+
to_run_count = simultaneous_jobs - running_subprocess_count
|
115
92
|
tests_to_run = all_to_run.slice!(0, to_run_count)
|
93
|
+
|
116
94
|
run_test_set(tests_to_run)
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
95
|
+
|
96
|
+
keep_running_full(all_to_run) if all_to_run.size > 0
|
97
|
+
end
|
98
|
+
|
99
|
+
# @deprecated Use more native wait/check of Process
|
100
|
+
def wait_for_pids(pids)
|
101
|
+
running_pids = pids # assume all pids are running at this moment
|
102
|
+
while running_pids.size > 1
|
103
|
+
sleep 5
|
104
|
+
puts "running_pids = #{running_pids}"
|
105
|
+
running_pids.each do |pid|
|
106
|
+
unless process_running?(pid)
|
107
|
+
puts "#{pid} is not running, removing it from pool"
|
108
|
+
running_pids.delete(pid)
|
109
|
+
end
|
110
|
+
end
|
121
111
|
end
|
122
112
|
end
|
123
113
|
|
114
|
+
# @deprecated Too time consuming and fragile, should use more native wait/check of Process
|
124
115
|
def wait_all_done_saucelabs
|
125
116
|
size = all_tests.size
|
126
117
|
job_statuses = saucelabs_last_n_statuses(size)
|
@@ -131,6 +122,8 @@ module MiniAutobot
|
|
131
122
|
end
|
132
123
|
end
|
133
124
|
|
125
|
+
private
|
126
|
+
|
134
127
|
# call saucelabs REST API to get last #{limit} jobs' statuses
|
135
128
|
# possible job status: complete, error, in progress
|
136
129
|
def saucelabs_last_n_statuses(limit)
|
@@ -193,5 +186,14 @@ module MiniAutobot
|
|
193
186
|
end
|
194
187
|
end
|
195
188
|
|
189
|
+
def process_running?(pid)
|
190
|
+
begin
|
191
|
+
Process.getpgid(pid)
|
192
|
+
true
|
193
|
+
rescue Errno::ESRCH
|
194
|
+
false
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
196
198
|
end
|
197
199
|
end
|
data/lib/mini_autobot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_autobot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ripta Pasay
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-08-
|
13
|
+
date: 2015-08-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|