fasten 0.8.0 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile.lock +2 -2
- data/lib/fasten/runner.rb +17 -11
- data/lib/fasten/task.rb +3 -2
- data/lib/fasten/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c1260fd4b0ae5e2b82ec028a37a463d50aa0226ea08151b3095b1247280a1de
|
4
|
+
data.tar.gz: 3d2e0e59f36063da7d57930d29d341ab09cd85a831e81e6e3506f7151a3e27e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f172e77abad01cd436f5cd29a377b955a65dfdfc96c2efb8aebff4e14cb8ee49d6c107ad2d7a61e415fa3190567c118353754dbad50a9ab640108babc0a5229b
|
7
|
+
data.tar.gz: edc13bf78878b9bc857ea192b34d03bf017a76424d0e2fe2814bc382724678acd007a8780dbd79f1eae70020e7eae4be1caf988caf9543f9bf1a7b93dbdacc9e
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.5.
|
1
|
+
ruby-2.5.3
|
data/Gemfile.lock
CHANGED
data/lib/fasten/runner.rb
CHANGED
@@ -178,7 +178,7 @@ module Fasten
|
|
178
178
|
end
|
179
179
|
|
180
180
|
def show_error_tasks
|
181
|
-
|
181
|
+
tasks.failed.each do |task|
|
182
182
|
log_info "task: #{task} error:#{task.error}\n#{task.error&.backtrace&.join("\n")}"
|
183
183
|
end
|
184
184
|
end
|
@@ -188,7 +188,7 @@ module Fasten
|
|
188
188
|
|
189
189
|
show_error_tasks
|
190
190
|
|
191
|
-
message = "Stopping because the following tasks failed: #{
|
191
|
+
message = "Stopping because the following tasks failed: #{tasks.failed.map(&:to_s).join(', ')}"
|
192
192
|
|
193
193
|
if developer
|
194
194
|
ui.cleanup
|
@@ -205,18 +205,20 @@ module Fasten
|
|
205
205
|
end
|
206
206
|
|
207
207
|
def remove_workers_as_needed
|
208
|
-
|
209
|
-
|
208
|
+
workers.group_by(&:class).each do |_clazz, worker_list|
|
209
|
+
while worker_list.count > jobs
|
210
|
+
break unless (worker = workers.find { |item| item.running_task.nil? })
|
210
211
|
|
211
|
-
|
212
|
-
|
212
|
+
worker.kill
|
213
|
+
workers.delete worker
|
213
214
|
|
214
|
-
|
215
|
+
ui.force_clear
|
216
|
+
end
|
215
217
|
end
|
216
218
|
end
|
217
219
|
|
218
|
-
def find_or_create_worker
|
219
|
-
worker = workers.find { |item| item.running_task.nil? }
|
220
|
+
def find_or_create_worker(worker_class: )
|
221
|
+
worker = workers.find { |item| item.class == worker_class && item.running_task.nil? }
|
220
222
|
|
221
223
|
unless worker
|
222
224
|
@worker_id = (@worker_id || 0) + 1
|
@@ -234,9 +236,13 @@ module Fasten
|
|
234
236
|
|
235
237
|
def dispatch_pending_tasks
|
236
238
|
while tasks.waiting? && tasks.running.count < jobs
|
237
|
-
worker = find_or_create_worker
|
238
|
-
|
239
239
|
task = tasks.next
|
240
|
+
|
241
|
+
task_worker_class = task.worker_class || worker_class
|
242
|
+
task_worker_class = Object.const_get(task_worker_class) if task_worker_class.is_a? String
|
243
|
+
|
244
|
+
worker = find_or_create_worker worker_class: task_worker_class
|
245
|
+
|
240
246
|
log_ini task, "on worker #{worker}"
|
241
247
|
worker.send_request_to_child(task)
|
242
248
|
tasks.running << task
|
data/lib/fasten/task.rb
CHANGED
@@ -4,16 +4,17 @@ module Fasten
|
|
4
4
|
class Task
|
5
5
|
include Fasten::Support::State
|
6
6
|
|
7
|
-
attr_accessor :name, :after, :shell, :ruby
|
7
|
+
attr_accessor :name, :after, :shell, :ruby, :worker_class
|
8
8
|
attr_accessor :dependants, :depends, :request, :response, :worker, :run_score, :block
|
9
9
|
|
10
|
-
def initialize(name:, shell: nil, ruby: nil, block: nil, request: nil, after: nil)
|
10
|
+
def initialize(name:, shell: nil, ruby: nil, block: nil, request: nil, after: nil, worker_class: nil)
|
11
11
|
self.name = name
|
12
12
|
self.shell = shell
|
13
13
|
self.ruby = ruby
|
14
14
|
self.block = block
|
15
15
|
self.request = request
|
16
16
|
self.after = after
|
17
|
+
self.worker_class = worker_class
|
17
18
|
end
|
18
19
|
|
19
20
|
def marshal_dump
|
data/lib/fasten/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fasten
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aldrin Martoq
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
213
|
version: '0'
|
214
214
|
requirements: []
|
215
215
|
rubyforge_project:
|
216
|
-
rubygems_version: 2.7.
|
216
|
+
rubygems_version: 2.7.8
|
217
217
|
signing_key:
|
218
218
|
specification_version: 4
|
219
219
|
summary: Fasten your seatbelts! Run jobs in parallel, intelligently.
|