batch_manager 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2M2ODYwMWZjOWY0NjQyZTZiN2ExYjk2MTAyYzk3MzVkZTc4Mzk0Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjliZTg3YzE4Mzk5ZjZkZjgxY2U3MmE4MDBkNzhiYmM1Y2QzYmI5Ng==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODZkMzU2MDQ1NWM0NWZjZTljOGRiM2M0NWVlMDc1ZWNhMDQzNDViZWM5NWJl
|
10
|
+
ZjE3YzkxMzE5ZDE2NjYxZWQxNWI4MWE3NGZkMDNjNGI4NDg0MjhhZTJiMzIw
|
11
|
+
YjE2YWRkMGYwNzIxMTFiNjlkNDc4NTBlZWM4ZGM3OTlmMjQ5N2Y=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzI1YWYwMWFmZjEwOThkNDFjODYxOTIwMGMwN2Q2NzMxM2MyN2I5YmExYzZl
|
14
|
+
OGFlYjc4NTg4NDY5NDE0OTk5ZjdjNTJkZWFmZWMwNjg2MDg0NWQ1OTZlMjhi
|
15
|
+
NjJlOTgyMjk0YTM4NmFhMmUzZmQ5NjllMTcxYjUyMmY5NGUyZTc=
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module BatchManager
|
2
2
|
class BatchesController < ApplicationController
|
3
|
+
before_filter :retain_batch_params, :except => [:index]
|
4
|
+
|
3
5
|
def index
|
4
6
|
@details = BatchManager::Monitor.details
|
5
7
|
end
|
6
8
|
|
7
9
|
def exec
|
8
|
-
@batch_name = params[:batch_name]
|
9
|
-
@wet = params[:wet]
|
10
10
|
if resque_supported?
|
11
11
|
Resque.enqueue(BatchManager::ExecBatchWorker, @batch_name, :wet => @wet)
|
12
|
-
@
|
12
|
+
redirect_to(log_batches_url(:batch_name => @batch_name, :wet => @wet))
|
13
13
|
else
|
14
14
|
BatchManager::Executor.exec(@batch_name, :wet => @wet)
|
15
15
|
redirect_to(batches_url)
|
@@ -17,18 +17,22 @@ module BatchManager
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def async_read_log
|
20
|
-
|
21
|
-
|
22
|
-
render :json => {:content => file.read, :offset => file.size}
|
20
|
+
log_file.seek(params[:offset].to_i) if params[:offset].present?
|
21
|
+
render :json => {:content => log_file.read, :offset => log_file.size}
|
23
22
|
end
|
24
23
|
|
25
24
|
def log
|
26
|
-
|
27
|
-
|
25
|
+
@offset = log_file.size
|
26
|
+
@content = log_file.read
|
28
27
|
end
|
29
28
|
|
30
29
|
private
|
31
30
|
|
31
|
+
def retain_batch_params
|
32
|
+
@batch_name = params[:batch_name]
|
33
|
+
@wet = params[:wet]
|
34
|
+
end
|
35
|
+
|
32
36
|
def resque_supported?
|
33
37
|
begin
|
34
38
|
require 'resque'
|
@@ -39,7 +43,15 @@ module BatchManager
|
|
39
43
|
end
|
40
44
|
|
41
45
|
def log_file
|
42
|
-
|
46
|
+
20.times do
|
47
|
+
begin
|
48
|
+
@log_file ||= File.open(BatchManager::Logger.log_file_path(@batch_name, @wet), 'r')
|
49
|
+
return @log_file
|
50
|
+
rescue
|
51
|
+
sleep 3
|
52
|
+
retry
|
53
|
+
end
|
54
|
+
end
|
43
55
|
end
|
44
56
|
end
|
45
57
|
end
|
@@ -16,7 +16,7 @@
|
|
16
16
|
});
|
17
17
|
</script>
|
18
18
|
|
19
|
-
<h2><%= @batch_name
|
19
|
+
<h2><%= @batch_name %><h2>
|
20
20
|
|
21
|
-
<%= text_area_tag :log,
|
21
|
+
<%= text_area_tag :log, @content, :id => "log_box" %>
|
22
22
|
<%= hidden_field_tag :offset, @offset, :id => :offset %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weihu Chen
|
@@ -122,8 +122,8 @@ files:
|
|
122
122
|
- app/assets/stylesheets/batch_manager/batches.css
|
123
123
|
- app/controllers/batch_manager/application_controller.rb
|
124
124
|
- app/controllers/batch_manager/batches_controller.rb
|
125
|
-
- app/views/batch_manager/batches/exec.html.erb
|
126
125
|
- app/views/batch_manager/batches/index.html.erb
|
126
|
+
- app/views/batch_manager/batches/log.html.erb
|
127
127
|
- app/views/layouts/batch_manager/application.html.erb
|
128
128
|
- app/workers/batch_manager/exec_batch_worker.rb
|
129
129
|
- config/routes.rb
|