kimurai-dashboard 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +58 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/kimurai-dashboard.gemspec +30 -0
- data/lib/kimurai/dashboard.rb +49 -0
- data/lib/kimurai/dashboard/app.rb +151 -0
- data/lib/kimurai/dashboard/base.rb +53 -0
- data/lib/kimurai/dashboard/helpers.rb +78 -0
- data/lib/kimurai/dashboard/models/run.rb +74 -0
- data/lib/kimurai/dashboard/models/session.rb +37 -0
- data/lib/kimurai/dashboard/models/spider.rb +20 -0
- data/lib/kimurai/dashboard/public/application.css +61 -0
- data/lib/kimurai/dashboard/public/application.js +4 -0
- data/lib/kimurai/dashboard/runner.rb +31 -0
- data/lib/kimurai/dashboard/version.rb +5 -0
- data/lib/kimurai/dashboard/views/_header.erb +19 -0
- data/lib/kimurai/dashboard/views/layout.erb +29 -0
- data/lib/kimurai/dashboard/views/runs/_errors.erb +18 -0
- data/lib/kimurai/dashboard/views/runs/_table.erb +38 -0
- data/lib/kimurai/dashboard/views/runs/index.erb +11 -0
- data/lib/kimurai/dashboard/views/runs/show.erb +142 -0
- data/lib/kimurai/dashboard/views/sessions/index.erb +46 -0
- data/lib/kimurai/dashboard/views/sessions/show.erb +87 -0
- data/lib/kimurai/dashboard/views/spiders/index.erb +40 -0
- data/lib/kimurai/dashboard/views/spiders/show.erb +46 -0
- metadata +172 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
<%= breadcrumbs("/" => "Home", "" => "Sessions") %>
|
2
|
+
|
3
|
+
<div class="row">
|
4
|
+
<div class="col-lg-12">
|
5
|
+
<h1>Sessions</h1>
|
6
|
+
<div class="table-responsive">
|
7
|
+
<table class="table table-hover table-sm">
|
8
|
+
<thead>
|
9
|
+
<tr>
|
10
|
+
<th scope="col"># id</th>
|
11
|
+
<th scope="col">Status</th>
|
12
|
+
<th scope="col">Start time</th>
|
13
|
+
<th scope="col">Stop time</th>
|
14
|
+
<th scope="col">Jobs</th>
|
15
|
+
<th scope="col">Spiders</th>
|
16
|
+
<th scope="col" data-toggle="tooltip" title="Total (Running / Completed / Failed)">Runs*</th>
|
17
|
+
</tr>
|
18
|
+
</thead>
|
19
|
+
<tbody>
|
20
|
+
<% @sessions.each do |session| %>
|
21
|
+
<tr>
|
22
|
+
<th scope="row">
|
23
|
+
<a href="/sessions/<%= session.id %>"><%= session.id %></a>
|
24
|
+
</th>
|
25
|
+
<td><%= get_badge(session.status) %></td>
|
26
|
+
<td><%= session.start_time %></td>
|
27
|
+
<td><%= session.stop_time %></td>
|
28
|
+
<td><%= session.concurrent_jobs %></td>
|
29
|
+
<td>
|
30
|
+
<a class="dotted" href="#" data-toggle="tooltip" title="<%= session.spiders.join(', ') %>">
|
31
|
+
<%= session.spiders.size %>
|
32
|
+
</a>
|
33
|
+
</td>
|
34
|
+
<td>
|
35
|
+
<%= session.runs_dataset.count %>
|
36
|
+
(<span class="text-primary"><%= session.running_runs.count %></span>/<span class="text-success"><%= session.completed_runs.count %></span>/<span class="text-danger"><%= session.failed_runs.count %></span>)
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
<% end %>
|
40
|
+
</tbody>
|
41
|
+
</table>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<%= pagy_nav_bootstrap(@pagy) if @pagy && @pagy.pages > 1 %>
|
45
|
+
</div>
|
46
|
+
</div>
|
@@ -0,0 +1,87 @@
|
|
1
|
+
<%= breadcrumbs("/" => "Home", "/sessions" => "Sessions", "" => @session.id) %>
|
2
|
+
|
3
|
+
<div class="row">
|
4
|
+
<div class="col-lg-12">
|
5
|
+
<h1>Session #<%= @session.id %></h1>
|
6
|
+
|
7
|
+
<table class="table table-bordered">
|
8
|
+
<tbody>
|
9
|
+
<tr>
|
10
|
+
<th>ID</th>
|
11
|
+
<td><%= @session.id %></td>
|
12
|
+
</tr>
|
13
|
+
<tr>
|
14
|
+
<th>Status</th>
|
15
|
+
<td>
|
16
|
+
<%= get_badge(@session.status) %>
|
17
|
+
<% if error = @session.error %>
|
18
|
+
<i>(<%= h(error) %>)</i>
|
19
|
+
<% end %>
|
20
|
+
</td>
|
21
|
+
</tr>
|
22
|
+
<tr>
|
23
|
+
<th>Start time</th>
|
24
|
+
<td><%= @session.start_time %></td>
|
25
|
+
</tr>
|
26
|
+
<tr>
|
27
|
+
<th>Stop time</th>
|
28
|
+
<td><%= @session.stop_time %></td>
|
29
|
+
</tr>
|
30
|
+
<tr>
|
31
|
+
<th>Total time</th>
|
32
|
+
<td><%= @session.total_time.duration %></td>
|
33
|
+
</tr>
|
34
|
+
<tr>
|
35
|
+
<th>Environment</th>
|
36
|
+
<td><%= @session.environment %></td>
|
37
|
+
</tr>
|
38
|
+
<tr>
|
39
|
+
<th>Concurrent Jobs</th>
|
40
|
+
<td><%= @session.concurrent_jobs %></td>
|
41
|
+
</tr>
|
42
|
+
<tr>
|
43
|
+
<th>Spiders list</th>
|
44
|
+
<td><%= @session.spiders.size %>: <%= convert_to_links(@session.spiders, base: "/spiders").join(", ") %></td>
|
45
|
+
</tr>
|
46
|
+
</tbody>
|
47
|
+
</table>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<% if @session.processing? && queue = @session.spiders_in_queue %>
|
51
|
+
<div class="col-lg-12 mb-4">
|
52
|
+
<h2>In queue <small class="text-muted"><%= queue.size %></small></h2>
|
53
|
+
<span><%= convert_to_links(queue, base: "/spiders").join(", ") %></span>
|
54
|
+
|
55
|
+
<div class="progress mt-2" style="height: 1px;">
|
56
|
+
<div class="progress-bar" role="progressbar" style="width: <%= ((queue.size.to_f / @session.spiders.size) * 100).to_i %>%;">
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
<% end %>
|
61
|
+
|
62
|
+
<div class="col-lg-12">
|
63
|
+
<h2>Runs
|
64
|
+
<small class="text-muted">
|
65
|
+
<%= @session.runs_dataset.count %>
|
66
|
+
(<a class="dotted gray" href="#running"><%= @session.running_runs.count %> running</a> /
|
67
|
+
<a class="dotted gray" href="#completed"><%= @session.completed_runs.count %> completed</a> /
|
68
|
+
<a class="dotted gray" href="#failed"><%= @session.failed_runs.count %> failed</a>)
|
69
|
+
</small>
|
70
|
+
</h2>
|
71
|
+
|
72
|
+
<% if @session.running_runs.any? %>
|
73
|
+
<p class="fancy-hr" id="running">Running</p>
|
74
|
+
<%= erb :'runs/_table', locals: { runs: @session.running_runs } %>
|
75
|
+
<% end %>
|
76
|
+
|
77
|
+
<% if @session.completed_runs.any? %>
|
78
|
+
<p class="fancy-hr" id="completed">Completed</p>
|
79
|
+
<%= erb :'runs/_table', locals: { runs: @session.completed_runs } %>
|
80
|
+
<% end %>
|
81
|
+
|
82
|
+
<% if @session.failed_runs.any? %>
|
83
|
+
<p class="fancy-hr" id="failed">Failed</p>
|
84
|
+
<%= erb :'runs/_table', locals: { runs: @session.failed_runs } %>
|
85
|
+
<% end %>
|
86
|
+
</div>
|
87
|
+
</div>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%= breadcrumbs("/" => "Home", "" => "Spiders") %>
|
2
|
+
|
3
|
+
<div class="row">
|
4
|
+
<div class="col-lg-12">
|
5
|
+
<h1>Spiders</h1>
|
6
|
+
<div class="table-responsive">
|
7
|
+
<table class="table table-hover table-sm">
|
8
|
+
<thead>
|
9
|
+
<tr>
|
10
|
+
<th scope="col"># id</th>
|
11
|
+
<th scope="col">Name</th>
|
12
|
+
<th scope="col">Current state</th>
|
13
|
+
<th scope="col">Runs</th>
|
14
|
+
</tr>
|
15
|
+
</thead>
|
16
|
+
<tbody>
|
17
|
+
<% @spiders.each do |spider| %>
|
18
|
+
<tr>
|
19
|
+
<th scope="row">
|
20
|
+
<a href="/spiders/<%= spider.id %>"><%= spider.id %></a>
|
21
|
+
</th>
|
22
|
+
<td><%= spider.name %></td>
|
23
|
+
<td>
|
24
|
+
<%= get_badge(spider.current_state) %>
|
25
|
+
<% if session_id = spider.current_session&.id %>
|
26
|
+
(active session <a href="/sessions/<%= session_id %>"><%= session_id %></a>)
|
27
|
+
<% end %>
|
28
|
+
</td>
|
29
|
+
<td>
|
30
|
+
<a href="/runs?spider_id=<%= spider.id %>"><%= spider.runs.size %></a>
|
31
|
+
</td>
|
32
|
+
</tr>
|
33
|
+
<% end %>
|
34
|
+
</tbody>
|
35
|
+
</table>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<%= pagy_nav_bootstrap(@pagy) if @pagy && @pagy.pages > 1 %>
|
39
|
+
</div>
|
40
|
+
</div>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<%= breadcrumbs("/" => "Home", "/spiders" => "Spiders", "" => @spider.id) %>
|
2
|
+
|
3
|
+
<div class="row">
|
4
|
+
<div class="col-lg-12">
|
5
|
+
<h1><%= @spider.name %></h1>
|
6
|
+
<table class="table table-bordered">
|
7
|
+
<tbody>
|
8
|
+
<tr>
|
9
|
+
<th>ID</th>
|
10
|
+
<td><%= @spider.id %></td>
|
11
|
+
</tr>
|
12
|
+
<tr>
|
13
|
+
<th>Name</th>
|
14
|
+
<td><%= @spider.name %></td>
|
15
|
+
</tr>
|
16
|
+
<tr>
|
17
|
+
<th>Current state</th>
|
18
|
+
<td>
|
19
|
+
<%= get_badge(@spider.current_state) %>
|
20
|
+
<% if session_id = @spider.current_session&.id %>
|
21
|
+
(active session <a href="/sessions/<%= session_id %>"><%= session_id %></a>)
|
22
|
+
<% end %>
|
23
|
+
</td>
|
24
|
+
</tr>
|
25
|
+
<tr>
|
26
|
+
<th>Latest log</th>
|
27
|
+
<td>
|
28
|
+
<% if latest = @spider.runs_dataset.last %>
|
29
|
+
<a target="_blank" href="/runs/<%= latest.id %>/log"><%= latest.spider_name %>.log</a>
|
30
|
+
(run <a href="/runs/<%= latest.id %>">#<%= latest.id %></a>)
|
31
|
+
<% else %>
|
32
|
+
Not available
|
33
|
+
<% end %>
|
34
|
+
</td>
|
35
|
+
</tr>
|
36
|
+
</tbody>
|
37
|
+
</table>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div class="col-lg-12">
|
41
|
+
<h2>Runs</h2>
|
42
|
+
<%= erb :'runs/_table', locals: { runs: @spider_runs } %>
|
43
|
+
|
44
|
+
<%= pagy_nav_bootstrap(@pagy) if @pagy && @pagy.pages > 1 %>
|
45
|
+
</div>
|
46
|
+
</div>
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kimurai-dashboard
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Victor Afanasev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-09-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: kimurai
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sequel
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sinatra-contrib
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pagy
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.16'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.16'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: minitest
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '5.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '5.0'
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- vicfreefly@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
120
|
+
- Gemfile
|
121
|
+
- LICENSE.txt
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- bin/console
|
125
|
+
- bin/setup
|
126
|
+
- kimurai-dashboard.gemspec
|
127
|
+
- lib/kimurai/dashboard.rb
|
128
|
+
- lib/kimurai/dashboard/app.rb
|
129
|
+
- lib/kimurai/dashboard/base.rb
|
130
|
+
- lib/kimurai/dashboard/helpers.rb
|
131
|
+
- lib/kimurai/dashboard/models/run.rb
|
132
|
+
- lib/kimurai/dashboard/models/session.rb
|
133
|
+
- lib/kimurai/dashboard/models/spider.rb
|
134
|
+
- lib/kimurai/dashboard/public/application.css
|
135
|
+
- lib/kimurai/dashboard/public/application.js
|
136
|
+
- lib/kimurai/dashboard/runner.rb
|
137
|
+
- lib/kimurai/dashboard/version.rb
|
138
|
+
- lib/kimurai/dashboard/views/_header.erb
|
139
|
+
- lib/kimurai/dashboard/views/layout.erb
|
140
|
+
- lib/kimurai/dashboard/views/runs/_errors.erb
|
141
|
+
- lib/kimurai/dashboard/views/runs/_table.erb
|
142
|
+
- lib/kimurai/dashboard/views/runs/index.erb
|
143
|
+
- lib/kimurai/dashboard/views/runs/show.erb
|
144
|
+
- lib/kimurai/dashboard/views/sessions/index.erb
|
145
|
+
- lib/kimurai/dashboard/views/sessions/show.erb
|
146
|
+
- lib/kimurai/dashboard/views/spiders/index.erb
|
147
|
+
- lib/kimurai/dashboard/views/spiders/show.erb
|
148
|
+
homepage: https://github.com/vifreefly/kimurai-dashboard
|
149
|
+
licenses:
|
150
|
+
- MIT
|
151
|
+
metadata: {}
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
require_paths:
|
155
|
+
- lib
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 2.5.0
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
requirements: []
|
167
|
+
rubyforge_project:
|
168
|
+
rubygems_version: 2.7.6
|
169
|
+
signing_key:
|
170
|
+
specification_version: 4
|
171
|
+
summary: Simple dashboard for a Kimurai web scraping framework
|
172
|
+
test_files: []
|