Skip to content

Commit

Permalink
DaggerWebDash: UI and functionality improvements
Browse files Browse the repository at this point in the history
DaggerWebDash: Generalize for non-Dagger users
ProcessorSaturation: Move from TimespanLogging to Dagger
ProcessorSaturation: Avoid bad JSON serialization
DaggerWebDash.GanttPlot: Remove timeline key
DaggerWebDash: Add custom x-label, block coloring, and line disable opts
DaggerWebDash: Show tooltip on hover
  • Loading branch information
jpsamaroo committed Aug 5, 2022
1 parent b953efb commit 03391da
Show file tree
Hide file tree
Showing 10 changed files with 172 additions and 134 deletions.
18 changes: 9 additions & 9 deletions benchmarks/benchmark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ function main()
end
elseif render == "webdash" || savelogs
ml = TimespanLogging.MultiEventLog()
ml[:core] = TimespanLogging.CoreMetrics()
ml[:id] = TimespanLogging.IDMetrics()
# FIXME: ml[:timeline] = TimespanLogging.TimelineMetrics()
profile && (ml[:profile] = TimespanLoggingWebDash.ProfileMetrics())
ml[:wsat] = TimespanLogging.WorkerSaturation()
ml[:loadavg] = TimespanLogging.CPULoadAverages()
ml[:core] = TimespanLogging.Events.CoreMetrics()
ml[:id] = TimespanLogging.Events.IDMetrics()
# FIXME: ml[:timeline] = TimespanLogging.Events.TimelineMetrics()
profile && (ml[:profile] = DaggerWebDash.ProfileMetrics())
ml[:wsat] = Dagger.Events.WorkerSaturation()
ml[:loadavg] = TimespanLogging.Events.CPULoadAverages()
ml[:bytes] = Dagger.Events.BytesAllocd()
ml[:mem] = TimespanLogging.MemoryFree()
ml[:esat] = TimespanLogging.EventSaturation()
ml[:mem] = TimespanLogging.Events.MemoryFree()
ml[:esat] = TimespanLogging.Events.EventSaturation()
ml[:psat] = Dagger.Events.ProcessorSaturation()
lw = TimespanLogging.Events.LogWindow(5*10^9, :core)
logs_df = DataFrame([key=>[] for key in keys(ml.consumers)]...)
Expand All @@ -178,7 +178,7 @@ function main()
d3r = DaggerWebDash.D3Renderer(live_port; seek_store=ts)
push!(lw.creation_handlers, d3r)
push!(lw.deletion_handlers, d3r)
push!(d3r, GanttPlot(:core, :id, :timeline, :esat, :psat, "Overview"))
push!(d3r, GanttPlot(:core, :id, :esat, :psat, "Overview"))
# TODO: push!(d3r, ProfileViewer(:core, :profile, "Profile Viewer"))
push!(d3r, LinePlot(:core, :wsat, "Worker Saturation", "Running Tasks"))
push!(d3r, LinePlot(:core, :loadavg, "CPU Load Average", "Average Running Threads"))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ TimespanLogging.Events.FullMetrics
TimespanLogging.Events.CPULoadAverages
TimespanLogging.Events.MemoryFree
TimespanLogging.Events.EventSaturation
TimespanLogging.Events.WorkerSaturation
Dagger.Events.BytesAllocd
Dagger.Events.ProcessorSaturation
Dagger.Events.WorkerSaturation
```

The `MultiEventLog` also has a mechanism to call a set of functions, called
Expand Down
2 changes: 1 addition & 1 deletion docs/src/scheduler-visualization.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ d3r = DaggerWebDash.D3Renderer(8080)
## Add some plots! Rendered top-down in order

# Show an overview of all generated events as a Gantt chart
push!(d3r, GanttPlot(:core, :id, :timeline, :esat, :psat, "Overview"))
push!(d3r, GanttPlot(:core, :id, :esat, :psat, "Overview"))

# Show various numerical events as line plots over time
push!(d3r, LinePlot(:core, :wsat, "Worker Saturation", "Running Tasks"))
Expand Down
3 changes: 2 additions & 1 deletion lib/DaggerWebDash/src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ using StructTypes, JSON3
sanitize(t::Tuple) = map(sanitize, t)
sanitize(t::NamedTuple) = map(sanitize, t)
sanitize(x::Function) = repr(x)
sanitize(d::Dict) = Dict([sanitize(k)=>sanitize(d[k]) for k in keys(d)])
sanitize(d::Dict) = Dict(sanitize(k)=>sanitize(d[k]) for k in keys(d))
sanitize(a::Array) = sanitize.(a)
sanitize(s::Set) = Set(sanitize.(s))
sanitize(x) = x

StructTypes.StructType(::Type{<:Dagger.Processor}) = StructTypes.CustomStruct()
Expand Down
10 changes: 8 additions & 2 deletions lib/DaggerWebDash/src/d3.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,22 @@ end
StructTypes.StructType(::Type{LinePlot}) = StructTypes.CustomStruct()
StructTypes.lower(lp::LinePlot) = "linePlot(svg_container, \"$(lp.core_key)\", \"$(lp.data_key)\", \"$(lp.xlabel)\", \"$(lp.ylabel)\")"

const GanttPlotFieldSpec = Tuple{Union{Symbol,Nothing},Symbol,Float64,Bool}
struct GanttPlot
core_key::Symbol
id_key::Symbol
timeline_key::Symbol
esat_key::Symbol
psat_key::Symbol
title::String
x_label::String
x_key::Union{Symbol,Nothing}
to_color::Vector{GanttPlotFieldSpec}
end
GanttPlot(core_key, id_key, esat_key, psat_key; title="Overview", x_label="Time", x_key=nothing, to_color=GanttPlotFieldSpec[]) =
GanttPlot(core_key, id_key, esat_key, psat_key,
title, x_label, x_key, to_color)
StructTypes.StructType(::Type{GanttPlot}) = StructTypes.CustomStruct()
StructTypes.lower(lp::GanttPlot) = "ganttPlot(svg_container, \"$(lp.core_key)\", \"$(lp.id_key)\", \"$(lp.timeline_key)\", \"$(lp.esat_key)\", \"$(lp.psat_key)\", \"$(lp.title)\")"
StructTypes.lower(lp::GanttPlot) = "ganttPlot(svg_container, \"$(lp.core_key)\", \"$(lp.id_key)\", \"$(lp.esat_key)\", \"$(lp.psat_key)\", \"$(lp.title)\", \"$(lp.x_label)\", \"$(lp.x_key)\", $(JSON3.write(sanitize(lp.to_color))))"

struct GraphPlot
core_key::Symbol
Expand Down
Loading

0 comments on commit 03391da

Please sign in to comment.