Skip to content

Commit f792c15

Browse files
authored
Merge pull request #247 from JuliaParallel/jps/lazy-cache-errored-fix
Fix bug in lazy API state.errored check
2 parents e31ca5c + d6e1852 commit f792c15

File tree

4 files changed

+15
-20
lines changed

4 files changed

+15
-20
lines changed

Diff for: Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Dagger"
22
uuid = "d58978e5-989f-55fb-8d15-ea34adc7bf54"
3-
version = "0.11.9"
3+
version = "0.11.10"
44

55
[deps]
66
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"

Diff for: src/sch/Sch.jl

+5-3
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ function compute_dag(ctx, d::Thunk; options=SchedulerOptions())
447447
@async cleanup_proc(state, p)
448448
end
449449
value = state.cache[d] # TODO: move(OSProc(), state.cache[d])
450-
if state.errored[d]
450+
if get(state.errored, d, false)
451451
throw(value)
452452
end
453453
if options.checkpoint !== nothing
@@ -747,7 +747,9 @@ function finish_task!(ctx, state, node, thunk_failed)
747747
end
748748
GC.@preserve inp begin
749749
pop!(state.cache, inp)
750-
pop!(state.errored, inp)
750+
if haskey(state.errored, inp)
751+
pop!(state.errored, inp)
752+
end
751753
end
752754
elseif inp isa Chunk
753755
push!(to_evict, inp)
@@ -788,7 +790,7 @@ function fire_tasks!(ctx, thunks::Vector{<:Tuple}, (gproc, proc), state)
788790
if data !== nothing
789791
# cache hit
790792
state.cache[thunk] = data
791-
thunk_failed = state.errored[thunk]
793+
thunk_failed = get(state.errored, thunk, false)
792794
finish_task!(ctx, state, thunk, thunk_failed)
793795
continue
794796
else

Diff for: test/cache.jl

+8-15
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
using Base.Test
2-
using Dagger
3-
using MemPool
4-
using Base.Test
5-
61
@testset "cache" begin
7-
@everywhere gc(true)
8-
# set available memory to 80KB on each worker
2+
@everywhere GC.gc()
3+
#= set available memory to 80KB on each worker
94
@everywhere empty!(MemPool.datastore)
105
@everywhere empty!(MemPool.lru_order)
116
@everywhere MemPool.max_memsize[] = 8*10^4
7+
=#
128

139
thunks1 = map(delayed(_ -> rand(10^3), cache=true), workers())
1410
sum1 = delayed((x...)->sum([x...]))(map(delayed(sum), thunks1)...)
@@ -19,12 +15,9 @@ using Base.Test
1915
@test s1 == collect(sum1)
2016
@test -collect(sum1) == collect(sum2)
2117

22-
thunks1 = map(delayed(_ -> rand(10^4), cache=true), workers())
23-
sum1 = delayed((x...)->sum([x...]))(map(delayed(sum), thunks1)...)
24-
s1 = collect(sum1)
25-
thunks2 = map(delayed(_ -> rand(10^4), cache=true), workers())
26-
sum2 = delayed((x...)->sum([x...]))(map(delayed(sum), thunks2)...)
27-
s2 = collect(sum2) # this should evict thunk1s from memory
28-
@test s1 != collect(sum1)
29-
@test s2 != collect(sum2)
18+
# Issue #246
19+
z = delayed(identity)(10)
20+
zz = delayed(identity; cache=true)(10)
21+
@test collect(z) == collect(z)
22+
@test collect(zz) == collect(zz)
3023
end

Diff for: test/runtests.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ include("ui.jl")
3030
include("checkpoint.jl")
3131
include("domain.jl")
3232
include("array.jl")
33+
include("cache.jl")
3334
try # TODO: Fault tolerance is sometimes unreliable
3435
include("fault-tolerance.jl")
3536
catch
3637
end
3738
println(stderr, "tests done. cleaning up...")
3839
Dagger.cleanup()
39-
#include("cache.jl")
4040
println(stderr, "all done.")

0 commit comments

Comments
 (0)