queue_dispatcher 1.1.19 → 1.2.0
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/LICENSE +2 -0
- data/README.rdoc +4 -2
- data/app/assets/images/icon_aborted.png +0 -0
- data/app/helpers/tasks_helper.rb +3 -0
- data/lib/queue_dispatcher/acts_as_task_queue.rb +23 -0
- data/lib/queue_dispatcher/version.rb +1 -1
- metadata +4 -3
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -52,6 +52,8 @@ The QueueWorkerDispatcher-script starts the workers (default are 10 workers). A
|
|
52
52
|
To start the QueueWorkerDispatcher as a daemon, use the option -b.
|
53
53
|
-b, --background work in background mode
|
54
54
|
|
55
|
-
==
|
55
|
+
== License
|
56
|
+
This project is licenced under the MIT license.
|
56
57
|
|
57
|
-
|
58
|
+
== Author
|
59
|
+
Philip Kurmann (philip (at) kman.ch)
|
Binary file
|
data/app/helpers/tasks_helper.rb
CHANGED
@@ -81,6 +81,24 @@ module QueueDispatcher
|
|
81
81
|
self.where(:name => name).where("state != 'error'").first || self.create(:name => name, :state => 'new', terminate_immediately: options[:terminate_immediately])
|
82
82
|
end
|
83
83
|
end
|
84
|
+
|
85
|
+
|
86
|
+
# Kill all running TaskQueues immediately and destroy them.
|
87
|
+
def reset_immediately!
|
88
|
+
all.each do |tq|
|
89
|
+
tq.update_attributes state: 'aborted'
|
90
|
+
|
91
|
+
# Kill the TaskQueue with SIGKILL
|
92
|
+
Process.kill 'KILL', tq.pid if tq.pid_running?
|
93
|
+
|
94
|
+
# Update task_state to aborted and release all its locks
|
95
|
+
tq.tasks.each do |task|
|
96
|
+
task.update_attributes state: 'aborted' unless task.state == 'successful' || task.state == 'finished'
|
97
|
+
tq.send(:release_lock_for, task)
|
98
|
+
end
|
99
|
+
tq.destroy
|
100
|
+
end
|
101
|
+
end
|
84
102
|
end
|
85
103
|
|
86
104
|
|
@@ -146,6 +164,8 @@ module QueueDispatcher
|
|
146
164
|
:acquire_lock
|
147
165
|
elsif states[:error]
|
148
166
|
:error
|
167
|
+
elsif states[:aborted]
|
168
|
+
:aborted
|
149
169
|
elsif states[:new]
|
150
170
|
:new
|
151
171
|
elsif states[:successful]
|
@@ -386,6 +406,7 @@ module QueueDispatcher
|
|
386
406
|
new = true
|
387
407
|
pending = false
|
388
408
|
error = false
|
409
|
+
aborted = false
|
389
410
|
running = false
|
390
411
|
acquire_lock = false
|
391
412
|
init_queue = false
|
@@ -397,6 +418,7 @@ module QueueDispatcher
|
|
397
418
|
new = false unless task.state == 'new' || task.state == 'new_popped' || task.state == 'build'
|
398
419
|
pending = true if (task.state == 'new' || task.state == 'new_popped' || task.state == 'build' || task.state == 'pending')
|
399
420
|
error = true if task.state == 'error'
|
421
|
+
aborted = true if task.state == 'aborted'
|
400
422
|
init_queue = true if task.state == 'init_queue'
|
401
423
|
end
|
402
424
|
|
@@ -406,6 +428,7 @@ module QueueDispatcher
|
|
406
428
|
:new => new,
|
407
429
|
:pending => pending,
|
408
430
|
:error => error,
|
431
|
+
:aborted => aborted,
|
409
432
|
:empty => task_array.empty?,
|
410
433
|
:init_queu => init_queue}
|
411
434
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: queue_dispatcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sys-proctable
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- LICENSE
|
120
120
|
- README.rdoc
|
121
121
|
- Rakefile
|
122
|
+
- app/assets/images/icon_aborted.png
|
122
123
|
- app/assets/images/icon_acquire_lock.png
|
123
124
|
- app/assets/images/icon_error.png
|
124
125
|
- app/assets/images/icon_init_queue.gif
|
@@ -180,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
181
|
version: '0'
|
181
182
|
requirements: []
|
182
183
|
rubyforge_project:
|
183
|
-
rubygems_version: 1.8.
|
184
|
+
rubygems_version: 1.8.23
|
184
185
|
signing_key:
|
185
186
|
specification_version: 3
|
186
187
|
summary: This Gem installs a queue dispatcher for handling asynchronous tasks
|