mperham--sidekiq/web/views/busy.erb

138 lines
4.6 KiB
Plaintext

<div class="row header">
<div class="col-sm-4 pull-left flip">
<h3><%= t('Status') %></h3>
</div>
</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="row header">
<div class="col-sm-4 pull-left flip">
<h3><%= t('Processes') %></h3>
</div>
<div class="col-sm-3 pull-right flip">
<form method="POST" class="warning-messages">
<%= csrf_tag %>
<div class="btn-group pull-right flip">
<button class="btn btn-warn" type="submit" name="quiet" value="1" data-confirm="<%= t('AreYouSure') %>"><%= t('QuietAll') %></button>
<button class="btn btn-danger" type="submit" name="stop" value="1" data-confirm="<%= t('AreYouSure') %>"><%= t('StopAll') %></button>
</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/mperham/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>&nbsp;</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.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>
<%= process.queues.join(", ") %>
</td>
<td><%= relative_time(Time.at(process['started_at'])) %></td>
<td><%= format_memory(process['rss'].to_i) %></td>
<td><%= process['concurrency'] %></td>
<td><%= process['busy'] %></td>
<td>
<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>
</td>
</tr>
<% end %>
</table>
</div>
<div class="row header">
<div class="col-sm-7">
<h3><%= t('Jobs') %></h3>
</div>
<% if @workset.size > 0 && @total_size > @count %>
<div class="col-sm-4">
<%= erb :_paging, locals: { url: "#{root_path}busy" } %>
</div>
<% 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, msg| %>
<% job = Sidekiq::JobRecord.new(msg['payload']) %>
<tr>
<td><%= process %></td>
<td><%= thread %></td>
<td><%= job.jid %></td>
<td>
<a href="<%= root_path %>queues/<%= msg['queue'] %>"><%= msg['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(Time.at(msg['run_at'])) %></td>
</tr>
<% end %>
</table>
</div>