Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function show_plan not working #433

Closed
JieRen98 opened this issue Sep 22, 2023 · 2 comments
Closed

function show_plan not working #433

JieRen98 opened this issue Sep 22, 2023 · 2 comments

Comments

@JieRen98
Copy link

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)
@jpsamaroo
Copy link
Member

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants