Skip to content

Commit

Permalink
Test that no new Context is created
Browse files Browse the repository at this point in the history
  • Loading branch information
DrChainsaw committed Sep 29, 2020
1 parent 14316e8 commit 42124a7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/scheduler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,31 @@ end
end
@everywhere (pop!(Dagger.PROCESSOR_CALLBACKS); empty!(Dagger.OSPROC_CACHE))

@testset "Add new workers" begin
using Distributed
ps1 = addprocs(2, exeflags="--project");

@everywhere begin
using Dagger, Distributed
# Condition to guarantee that processing is not completed before we add new workers
c = Condition()
function testfun(i)
i < 2 && return myid()
wait(c)
return myid()
end
end

ts = delayed(vcat)((delayed(testfun)(i) for i in 1:4)...);
job = @async collect(Context(ps1), ts);

ps2 = addprocs(2, exeflags="--project");

while !istaskdone(job)
@everywhere ps1 notify(c)
end
@test fetch(job) |> unique |> sort == ps1

wait(rmprocs(vcat(ps1,ps2)))
end
end

0 comments on commit 42124a7

Please sign in to comment.