# Stopping pmap when one of the node hit an error

**URL:** https://discourse.julialang.org/t/stopping-pmap-when-one-of-the-node-hit-an-error/109389
**Category:** General Usage
**Tags:** distributed, pmap
**Created:** [January 29, 2024, 11:05am UTC](https://discourse.julialang.org/t/stopping-pmap-when-one-of-the-node-hit-an-error/109389 "2024-01-29T11:05:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![muuusso](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/muuusso/32/206612_2.png) [@muuusso](https://discourse.julialang.org/u/muuusso)
#### Post date: [January 29, 2024, 11:05am UTC](https://discourse.julialang.org/t/stopping-pmap-when-one-of-the-node-hit-an-error/109389/1 "2024-01-29T11:05:36Z")

</div>

I’m using pmap on my cluster university to distribute computation between different nodes. I’d like to be able to stop all the workers when one of them fails/throw an error. I’ve been looking for a while and I couldn’t find any solution.

For example if I start Julia with 4 processes like this  
`julia -p 4`  
and run the following code

```julia
pmap(1:nworkers()) do j
    if myid() == 3
        throw(ErrorException("End"))
    end
    sleep(5)
    println(myid())
end

```

I would like to see the error and no print at all, so that every workers stop when one of them throw an exception.
