-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
busy.erb
148 lines (142 loc) · 5.08 KB
/
busy.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<div class="header-container">
<h1><%= t('Status') %></h1>
</div>
<div class="stats-wrapper">
<div class="stats-container">
<div class="stat">
<h3><%= s = processes.size; number_with_delimiter(s) %></h3>
<p><%= t('Processes') %></p>
</div>
<div class="stat">
<h3><%= x = processes.total_concurrency; number_with_delimiter(x) %></h3>
<p><%= t('Threads') %></p>
</div>
<div class="stat">
<h3><%= ws = workset.size; number_with_delimiter(ws) %></h3>
<p><%= t('Busy') %></p>
</div>
<div class="stat">
<h3><%= x == 0 ? 0 : ((ws / x.to_f) * 100).round(0) %>%</h3>
<p><%= t('Utilization') %></p>
</div>
<div class="stat">
<h3><%= format_memory(processes.total_rss) %></h3>
<p><%= t('RSS') %></p>
</div>
</div>
</div>
<div class="header-container">
<h1><%= t('Processes') %></h1>
<div>
<form method="POST" class="warning-messages">
<%= csrf_tag %>
<div class="btn-group pull-right flip">
<input class="btn btn-warn" type="submit" name="quiet" value="<%= t('QuietAll') %>" data-confirm="<%= t('AreYouSure') %>"/>
<input class="btn btn-danger" type="submit" name="stop" value="<%= t('StopAll') %>" data-confirm="<%= t('AreYouSure') %>"/>
</div>
</form>
</div>
</div>
<div class="table_container">
<table class="processes table table-hover table-bordered table-striped">
<thead>
<th><%= t('Name') %></th>
<th><%= t('Started') %></th>
<th class="col-sm-1"><%= t('RSS') %><a target="blank" href="https://github.com/sidekiq/sidekiq/wiki/Memory#rss"><span class="info-circle" title="Click to learn more about RSS">?</span></a></th>
<th class="col-sm-1"><%= t('Threads') %></th>
<th class="col-sm-1"><%= t('Busy') %></th>
<th> </th>
</thead>
<% lead = processes.leader %>
<% sorted_processes.each do |process| %>
<tr>
<td class="box">
<%= "#{process['hostname']}:#{process['pid']}" %>
<span class="label label-success"><%= process.tag %></span>
<% process.labels.each do |label| %>
<span class="label label-info"><%= label %></span>
<% end %>
<% if process.embedded? %>
<span class="label label-default">embedded</span>
<% end %>
<% if process.stopping? %>
<span class="label label-danger">quiet</span>
<% end %>
<% if process.identity == lead %>
<span class="label label-warning">leader</span>
<% end %>
<br>
<b><%= "#{t('Queues')}: " %></b>
<% if process.weights %>
<%= busy_weights(process.weights) %>
<% else %>
<%= process.queues.sort.join(", ") %>
<% end %>
<% if process.version != Sidekiq::VERSION %>
<br>
<b><%= "#{t('Version')}: " %></b>
<% if process.version %>
<%= process.version %>
<% else %>
<%= t('Unknown') %>
<% end %>
<% end %>
</td>
<td><%= relative_time(Time.at(process['started_at'])) %></td>
<td class="num"><%= format_memory(process['rss'].to_i) %></td>
<td class="num"><%= number_with_delimiter(process['concurrency']) %></td>
<td class="num"><%= number_with_delimiter(process['busy']) %></td>
<td>
<% unless process.embedded? %>
<form method="POST">
<%= csrf_tag %>
<input type="hidden" name="identity" value="<%= process['identity'] %>"/>
<div class="btn-group pull-right flip">
<% unless process.stopping? %><button class="btn btn-xs btn-warn" type="submit" name="quiet" value="1"><%= t('Quiet') %></button><% end %>
<button class="btn btn-xs btn-danger" type="submit" name="stop" value="1"><%= t('Stop') %></button>
</div>
</form>
<% end %>
</td>
</tr>
<% end %>
</table>
</div>
<div class="header-container">
<h1><%= t('Jobs') %></h1>
<% if @workset.size > 0 && @total_size > @count %>
<%= erb :_paging, locals: { url: "#{root_path}busy" } %>
<% end %>
</div>
<div class="table_container">
<table class="workers table table-hover table-bordered table-striped">
<thead>
<th><%= t('Process') %></th>
<th><%= t('TID') %></th>
<th><%= t('JID') %></th>
<th><%= t('Queue') %></th>
<th><%= t('Job') %></th>
<th><%= t('Arguments') %></th>
<th><%= t('Started') %></th>
</thead>
<% @workset.each do |process, thread, work| %>
<% job = work.job %>
<tr>
<td><%= process %></td>
<td><%= thread %></td>
<td><%= job.jid %></td>
<td>
<a href="<%= root_path %>queues/<%= work.queue %>"><%= work.queue %></a>
</td>
<td>
<%= job.display_class %>
<%= display_tags(job, nil) %>
</td>
<td>
<div class="args"><%= display_args(job.display_args) %></div>
</td>
<td><%= relative_time(work.run_at) %></td>
</tr>
<% end %>
</table>
</div>