Dagger.jl icon indicating copy to clipboard operation
Dagger.jl copied to clipboard

function show_plan not working

Open JieRen98 opened this issue 1 year ago • 1 comments

Tested environment: Ubuntu22.04 and macOS 13.5.2

Julia version: 1.9.3

Error string:

ERROR: LoadError: MethodError: no method matching show_plan(::IOStream, ::Vector{TimespanLogging.Timespan}, ::Thunk)
Stacktrace:
 [1] (::Dagger.var"#140#141"{Thunk, Vector{TimespanLogging.Timespan}})(io::IOStream)
   @ Dagger ~/.julia/packages/Dagger/xGAvM/src/compute.jl:28
 [2] open(::Dagger.var"#140#141"{Thunk, Vector{TimespanLogging.Timespan}}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Base ./io.jl:395
 [3] open(::Function, ::String, ::String)
   @ Base ./io.jl:392
 [4] compute(ctx::Context, d::Thunk; options::Nothing)
   @ Dagger ~/.julia/packages/Dagger/xGAvM/src/compute.jl:27
 [5] compute(ctx::Context, d::Thunk)
   @ Dagger ~/.julia/packages/Dagger/xGAvM/src/compute.jl:22
 [6] top-level scope
   @ ~/JuliaProjects/show_plan/run.jl:39

Code:

using Pkg
Pkg.add("Dagger")
Pkg.add("TimespanLogging")

using Dagger
using TimespanLogging

ctx = Dagger.Sch.eager_context()
log = TimespanLogging.LocalEventLog()
ctx.log_sink = log

function taskA()
    println("In taskA")
    return "Executed A"
end

function taskB(x)
    println("In taskB")
    return "Executed B after " * x
end

function taskC(x)
    println("In taskC")
    return "Executed C after " * x
end

function taskD(x, y)
    println("In taskD")
    return "Executed D after " * x * " and " * y
end

a = Dagger.delayed(taskA)()
b = Dagger.delayed(taskB)(a)
c = Dagger.delayed(taskC)(a)
d = Dagger.delayed(taskD)(b, c)

# Execute the task graph
ctx.log_file = "out.svg"
result = Dagger.compute(ctx, d)

JieRen98 avatar Sep 22 '23 08:09 JieRen98

This probably needs to be documented better, but you now need to make sure you load Colors.jl manually (via using Colors) to get access to the show_plan implementation.

jpsamaroo avatar Sep 26 '23 00:09 jpsamaroo

Now that #468 is merged, we have Dagger.show_logs and Dagger.render_logs - see the documentation (https://juliaparallel.org/Dagger.jl/dev/logging-visualization/#Logs-Visualization) for how to use these.

jpsamaroo avatar Apr 23 '24 17:04 jpsamaroo