batch_manager 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +2 -0
- data/app/assets/stylesheets/batch_manager/batches.css +12 -0
- data/app/controllers/batch_manager/application_controller.rb +15 -0
- data/app/controllers/batch_manager/batches_controller.rb +2 -10
- data/app/views/batch_manager/batches/index.html.erb +5 -0
- data/app/views/batch_manager/batches/log.html.erb +2 -0
- data/app/workers/batch_manager/exec_batch_worker.rb +3 -0
- data/lib/batch_manager/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Mjc1M2YyMmMxMDA0MjlmN2I5NDZhNzJlNGUyMWVkZGRjZmZiMTljNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzZhNmQ5MDNhZjFmNTA4NDQ0Mjg2YzJjMmI2OTI2NzUzMDhjM2NlYQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGE1MzRlMjFiNDY0YWFjMzEyNTcyYWNlNzc4YTgzYmViNmVhOWEyMjg3MDVj
|
10
|
+
NDFjM2QwYTY5YzFkMzE1YTFmODY5MzZkNGE4Y2U3MTdmZjkyMTdjMDAxYWY4
|
11
|
+
MmM1MDQ3ZDUxZDQ2OWI3YzE3Y2VkODBkZWU2N2Q0YjJhYmZiY2Y=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzY3YzVmNzVhMGFkMjcxYWI5NmQ3YjYzZjg0MTEyMWVmZGQ0YTNkMmZjNDA3
|
14
|
+
OTAzNjQyZGIyMjQ3ZjFkN2RmODkwNjJkNDQ1ZjEzYjg2OTIzMGQzNDZlYjUw
|
15
|
+
YjgxYzEzMWQzMWMyZTg4OTM5NGQ5NWQzYzJiYjc2NGZiMTlmMGQ=
|
data/README.md
CHANGED
@@ -82,6 +82,8 @@ You can also use web interface to execute batches.
|
|
82
82
|
|
83
83
|
If [resque](https://github.com/resque/resque) installed in you application, the batch script can be executed asynchronous. And the log can be checked on real time in the brower.
|
84
84
|
|
85
|
+
The QUEUE's name will be **"batch_manager".**
|
86
|
+
|
85
87
|
## Rake Tasks
|
86
88
|
|
87
89
|
show all batches
|
@@ -1,4 +1,19 @@
|
|
1
1
|
module BatchManager
|
2
2
|
class ApplicationController < ActionController::Base
|
3
|
+
def resque_supported?
|
4
|
+
begin
|
5
|
+
require 'resque'
|
6
|
+
if defined?(Resque)
|
7
|
+
queue_names = []
|
8
|
+
Resque.workers.map do |worker|
|
9
|
+
queue_names += worker.id.split(':')[-1].split(',')
|
10
|
+
end
|
11
|
+
return true if queue_names.include?(BatchManager::ExecBatchWorker.queue_name) || queue_names.include?("*")
|
12
|
+
end
|
13
|
+
false
|
14
|
+
rescue
|
15
|
+
false
|
16
|
+
end
|
17
|
+
end
|
3
18
|
end
|
4
19
|
end
|
@@ -3,13 +3,14 @@ module BatchManager
|
|
3
3
|
before_filter :retain_batch_params, :except => [:index]
|
4
4
|
|
5
5
|
def index
|
6
|
+
@resque_supported = resque_supported?
|
6
7
|
@details = BatchManager::Monitor.details
|
7
8
|
end
|
8
9
|
|
9
10
|
def exec
|
10
11
|
if resque_supported?
|
11
12
|
Resque.enqueue(BatchManager::ExecBatchWorker, @batch_name, :wet => @wet)
|
12
|
-
redirect_to(log_batches_url(:batch_name => @batch_name, :wet => @wet))
|
13
|
+
redirect_to(log_batches_url(:batch_name => @batch_name, :wet => @wet, :refresh => true))
|
13
14
|
else
|
14
15
|
BatchManager::Executor.exec(@batch_name, :wet => @wet)
|
15
16
|
redirect_to(batches_url)
|
@@ -33,15 +34,6 @@ module BatchManager
|
|
33
34
|
@wet = params[:wet]
|
34
35
|
end
|
35
36
|
|
36
|
-
def resque_supported?
|
37
|
-
begin
|
38
|
-
require 'resque'
|
39
|
-
defined?(Resque)
|
40
|
-
rescue
|
41
|
-
false
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
37
|
def log_file
|
46
38
|
20.times do
|
47
39
|
begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: batch_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weihu Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|