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

Remove the on_error keyword for parallel execution #452

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DAT/DAT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ function runLoop(dc::DATConfig, showprog)
"YAXArrays is not loaded on all workers. Please run `@everywhere using YAXArrays` to fix.",
)
mapfun = showprog ? progress_pmap : pmap
mapfun(CachingPool(workers()),allRanges, on_error=identity) do r
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just thinking that maybe we should pass this as a kwarg to mapfun via dc with the default as your fix, and then if for whatever reason this is needed in other use cases, then users could potentially set this to identity. That way, we could still support both scenarios.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but if we actually don't need it, I don't want to add it just in case. If @meggart also doesn't need it I would rather drop it for now and introduce the kwarg option if there is an actual use case.

m = mapfun(CachingPool(workers()),allRanges) do r
incaches, outcaches, args = getallargs(dc)
updateinars(dc, r, incaches)
if dc.ntr[myid()] > 1
Expand Down
10 changes: 10 additions & 0 deletions test/DAT/mapcube.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,14 @@
r = mapCube(simple_fun, (a1, a2), indims=(indims, indims), outdims=outdims, max_cache = "0.1GB")
@test r.data == a1.data .+ permutedims(a2.data,(1,3,2))
end

@testset "Error shown in parallel" begin
x,y,z = X(1:4), Y(1:5), Z(1:6)
a1 = YAXArray((x,y,z), rand(4,5,6))
indims = InDims("x")
outdims = OutDims("x")
@test_throws Exception mapCube((xout, xin) -> xout .= foo(xin), a1; indims, outdims, ispar=false)
@test_throws CapturedException mapCube((xout, xin) -> xout .= foo(xin), a1; indims, outdims, ispar=true)

end
end
Loading