Skip to content

Conversation

@KDr2
Copy link
Member

@KDr2 KDr2 commented Feb 25, 2019

To fix #7.

@KDr2 KDr2 changed the title [WIP] Catch task exception Catch task exception Feb 26, 2019
@KDr2 KDr2 requested a review from yebai February 26, 2019 07:07
@yebai
Copy link
Member

yebai commented Feb 26, 2019

Thanks, @KDr2. I have tested this PR against the MWE from TuringLang/Turing.jl#586. Libtask can successfully catch the exception/error now. Below is an example output

julia> sample(mf, SMC(10))
ERROR: BoundsError: attempt to access 1-element Array{Int64,1} at index [2]
Stacktrace:
 [1] consume(::Task) at /Users/hg344/.julia/packages/Libtask/ldg9e/src/taskcopy.jl:178
 [2] consume at /Users/hg344/.julia/packages/Turing/sghu6/src/core/container.jl:35 [inlined]
 [3] consume(::Turing.Core.ParticleContainer{Turing.Core.Trace,Turing.Model{Tuple{:x},Tuple{},getfield(Main, Symbol("###inner_function#369#5")){Array{Int64,1}},NamedTuple{(),Tuple{}},NamedTuple{(),Tuple{}}}}) at /Users/hg344/.julia/packages/Turing/sghu6/src/core/container.jl:151
 [4] sample(::Turing.Model{Tuple{:x},Tuple{},getfield(Main, Symbol("###inner_function#369#5")){Array{Int64,1}},NamedTuple{(),Tuple{}},NamedTuple{(),Tuple{}}}, ::SMC{Union{},typeof(Turing.Utilities.resample_systematic)}) at /Users/hg344/.julia/packages/Turing/sghu6/src/inference/smc.jl:81
 [5] top-level scope at none:0

@KDr2 KDr2 requested a review from yebai February 27, 2019 01:00
@yebai yebai merged commit cedc118 into master Feb 28, 2019
@yebai yebai deleted the task_exception branch February 28, 2019 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Libtask waits for ever is function body has errors.

3 participants