diff --git a/lib/scheduler/views/history.erb b/lib/scheduler/views/history.erb
index f6c8f5c92fc..c1cc026ba71 100644
--- a/lib/scheduler/views/history.erb
+++ b/lib/scheduler/views/history.erb
@@ -15,7 +15,7 @@
Hostname:Pid |
Live Slots delta |
Started At |
- Duration (ms) |
+ Duration |
|
@@ -28,11 +28,13 @@
<%= stat.live_slots_finish - stat.live_slots_start %>
<% end %>
- <%= relative_time stat.started_at %> |
- <%= stat.duration_ms %> |
+ <%= sane_time stat.started_at %> |
+ <%= sane_duration stat.duration_ms %> |
- <% if !stat.success %>
- FAILED
+ <% if stat.success.nil? %>
+ RUNNING
+ <% elsif !stat.success %>
+ FAILED
<% end %>
|
diff --git a/lib/scheduler/views/scheduler.erb b/lib/scheduler/views/scheduler.erb
index d50aaa861ea..85fb6da8d97 100644
--- a/lib/scheduler/views/scheduler.erb
+++ b/lib/scheduler/views/scheduler.erb
@@ -43,7 +43,7 @@
<%= @info.prev_result %>
- <%= @info.prev_duration %>
+ <%= sane_duration @info.prev_duration %>
|
<%= @info.current_owner %>
diff --git a/lib/scheduler/web.rb b/lib/scheduler/web.rb
index d3af236433f..6d414ce8e91 100644
--- a/lib/scheduler/web.rb
+++ b/lib/scheduler/web.rb
@@ -4,6 +4,23 @@ module Scheduler
VIEWS = File.expand_path('views', File.dirname(__FILE__)) unless defined? VIEWS
def self.registered(app)
+
+ app.helpers do
+ def sane_time(time)
+ return unless time
+ time
+ end
+
+ def sane_duration(duration)
+ return unless duration
+ if duration < 1000
+ "#{duration}ms"
+ elsif duration < 60*1000
+ "#{'%.2f' % (duration/1000.0)} secs"
+ end
+ end
+ end
+
app.get "/scheduler" do
RailsMultisite::ConnectionManagement.with_connection("default") do
@manager = Scheduler::Manager.without_runner
|