Skip to content

Commit

Permalink
fixup! Various Thunk->DTask renames
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsamaroo committed Jul 22, 2024
1 parent df10fb4 commit 4994ab3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion test/mutation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ end
x = Dagger.@mutable worker=w Ref{Int}()
@test fetch(Dagger.@spawn mutable_update!(x)) == w
wo_scope = Dagger.ProcessScope(wo)
@test_throws_unwrap Dagger.ThunkFailedException fetch(Dagger.@spawn scope=wo_scope mutable_update!(x))
@test_throws_unwrap Dagger.DTaskFailedException fetch(Dagger.@spawn scope=wo_scope mutable_update!(x))
end
end # @testset "@mutable"

Expand Down
4 changes: 2 additions & 2 deletions test/processors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ end
end
@testset "Processor exhaustion" begin
opts = ThunkOptions(proclist=[OptOutProc])
@test_throws_unwrap Dagger.ThunkFailedException ex isa Dagger.Sch.SchedulingException ex.reason="No processors available, try widening scope" collect(delayed(sum; options=opts)([1,2,3]))
@test_throws_unwrap Dagger.DTaskFailedException ex isa Dagger.Sch.SchedulingException ex.reason="No processors available, try widening scope" collect(delayed(sum; options=opts)([1,2,3]))
opts = ThunkOptions(proclist=(proc)->false)
@test_throws_unwrap Dagger.ThunkFailedException ex isa Dagger.Sch.SchedulingException ex.reason="No processors available, try widening scope" collect(delayed(sum; options=opts)([1,2,3]))
@test_throws_unwrap Dagger.DTaskFailedException ex isa Dagger.Sch.SchedulingException ex.reason="No processors available, try widening scope" collect(delayed(sum; options=opts)([1,2,3]))
opts = ThunkOptions(proclist=nothing)
@test collect(delayed(sum; options=opts)([1,2,3])) == 6
end
Expand Down
2 changes: 1 addition & 1 deletion test/scheduler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ end
@testset "allow errors" begin
opts = ThunkOptions(;allow_errors=true)
a = delayed(error; options=opts)("Test")
@test_throws_unwrap Dagger.ThunkFailedException collect(a)
@test_throws_unwrap Dagger.DTaskFailedException collect(a)
end
end

Expand Down
10 changes: 5 additions & 5 deletions test/scopes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

# Different nodes
for (ch1, ch2) in [(ns1_ch, ns2_ch), (ns2_ch, ns1_ch)]
@test_throws_unwrap Dagger.ThunkFailedException ex.reason<"Scopes are not compatible:" fetch(Dagger.@spawn ch1 + ch2)
@test_throws_unwrap Dagger.DTaskFailedException ex.reason<"Scopes are not compatible:" fetch(Dagger.@spawn ch1 + ch2)
end
end
@testset "Process Scope" begin
Expand All @@ -75,15 +75,15 @@

# Different process
for (ch1, ch2) in [(ps1_ch, ps2_ch), (ps2_ch, ps1_ch)]
@test_throws_unwrap Dagger.ThunkFailedException ex.reason<"Scopes are not compatible:" fetch(Dagger.@spawn ch1 + ch2)
@test_throws_unwrap Dagger.DTaskFailedException ex.reason<"Scopes are not compatible:" fetch(Dagger.@spawn ch1 + ch2)
end

# Same process and node
@test fetch(Dagger.@spawn process_scope_test(ps1_ch, ns1_ch)) == wid1

# Different process and node
for (ch1, ch2) in [(ps1_ch, ns2_ch), (ns2_ch, ps1_ch)]
@test_throws_unwrap Dagger.ThunkFailedException ex.reason<"Scopes are not compatible:" fetch(Dagger.@spawn ch1 + ch2)
@test_throws_unwrap Dagger.DTaskFailedException ex.reason<"Scopes are not compatible:" fetch(Dagger.@spawn ch1 + ch2)
end
end
@testset "Exact Scope" begin
Expand All @@ -104,14 +104,14 @@

# Different process, different processor
for (ch1, ch2) in [(es1_ch, es2_ch), (es2_ch, es1_ch)]
@test_throws_unwrap Dagger.ThunkFailedException ex.reason<"Scopes are not compatible:" fetch(Dagger.@spawn ch1 + ch2)
@test_throws_unwrap Dagger.DTaskFailedException ex.reason<"Scopes are not compatible:" fetch(Dagger.@spawn ch1 + ch2)
end

# Same process, different processor
es1_2 = ExactScope(Dagger.ThreadProc(wid1, 2))
es1_2_ch = Dagger.tochunk(nothing, OSProc(), es1_2)
for (ch1, ch2) in [(es1_ch, es1_2_ch), (es1_2_ch, es1_ch)]
@test_throws_unwrap Dagger.ThunkFailedException ex.reason<"Scopes are not compatible:" fetch(Dagger.@spawn ch1 + ch2)
@test_throws_unwrap Dagger.DTaskFailedException ex.reason<"Scopes are not compatible:" fetch(Dagger.@spawn ch1 + ch2)
end
end
@testset "Union Scope" begin
Expand Down
26 changes: 13 additions & 13 deletions test/thunk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ end
A = rand(4, 4)
@test fetch(@spawn sum(A; dims=1)) sum(A; dims=1)

@test_throws_unwrap Dagger.ThunkFailedException fetch(@spawn sum(A; fakearg=2))
@test_throws_unwrap Dagger.DTaskFailedException fetch(@spawn sum(A; fakearg=2))

@test fetch(@spawn reduce(+, A; dims=1, init=2.0))
reduce(+, A; dims=1, init=2.0)
Expand Down Expand Up @@ -162,7 +162,7 @@ end
a = @spawn error("Test")
wait(a)
@test isready(a)
@test_throws_unwrap Dagger.ThunkFailedException fetch(a)
@test_throws_unwrap Dagger.DTaskFailedException fetch(a)
b = @spawn 1+2
@test fetch(b) == 3
end
Expand All @@ -177,7 +177,7 @@ end
end
ex = Dagger.Sch.unwrap_nested_exception(ex)
ex_str = sprint(io->Base.showerror(io,ex))
@test occursin(r"^ThunkFailedException:", ex_str)
@test occursin(r"^DTaskFailedException:", ex_str)
@test occursin("Test", ex_str)
@test !occursin("Root Thunk", ex_str)

Expand All @@ -194,36 +194,36 @@ end
@testset "single dependent" begin
a = @spawn error("Test")
b = @spawn a+2
@test_throws_unwrap Dagger.ThunkFailedException fetch(a)
@test_throws_unwrap Dagger.DTaskFailedException fetch(a)
end
@testset "multi dependent" begin
a = @spawn error("Test")
b = @spawn a+2
c = @spawn a*2
@test_throws_unwrap Dagger.ThunkFailedException fetch(b)
@test_throws_unwrap Dagger.ThunkFailedException fetch(c)
@test_throws_unwrap Dagger.DTaskFailedException fetch(b)
@test_throws_unwrap Dagger.DTaskFailedException fetch(c)
end
@testset "dependent chain" begin
a = @spawn error("Test")
@test_throws_unwrap Dagger.ThunkFailedException fetch(a)
@test_throws_unwrap Dagger.DTaskFailedException fetch(a)
b = @spawn a+1
@test_throws_unwrap Dagger.ThunkFailedException fetch(b)
@test_throws_unwrap Dagger.DTaskFailedException fetch(b)
c = @spawn b+2
@test_throws_unwrap Dagger.ThunkFailedException fetch(c)
@test_throws_unwrap Dagger.DTaskFailedException fetch(c)
end
@testset "single input" begin
a = @spawn 1+1
b = @spawn (a->error("Test"))(a)
@test fetch(a) == 2
@test_throws_unwrap Dagger.ThunkFailedException fetch(b)
@test_throws_unwrap Dagger.DTaskFailedException fetch(b)
end
@testset "multi input" begin
a = @spawn 1+1
b = @spawn 2*2
c = @spawn ((a,b)->error("Test"))(a,b)
@test fetch(a) == 2
@test fetch(b) == 4
@test_throws_unwrap Dagger.ThunkFailedException fetch(c)
@test_throws_unwrap Dagger.DTaskFailedException fetch(c)
end
@testset "diamond" begin
a = @spawn 1+1
Expand All @@ -233,7 +233,7 @@ end
@test fetch(a) == 2
@test fetch(b) == 3
@test fetch(c) == 4
@test_throws_unwrap Dagger.ThunkFailedException fetch(d)
@test_throws_unwrap Dagger.DTaskFailedException fetch(d)
end
end
@testset "remote spawn" begin
Expand All @@ -251,7 +251,7 @@ end
t1 = Dagger.@spawn 1+"fail"
Dagger.@spawn t1+1
end
@test_throws_unwrap Dagger.ThunkFailedException fetch(t2)
@test_throws_unwrap Dagger.DTaskFailedException fetch(t2)
end
@testset "undefined function" begin
# Issues #254, #255
Expand Down

0 comments on commit 4994ab3

Please sign in to comment.