# \[Core\] Issue with running Ray code from Jupyter notebook

**URL:** https://discuss.ray.io/t/core-issue-with-running-ray-code-from-jupyter-notebook/1814
**Category:** Ray Core
**Created:** [April 21, 2021, 12:33pm UTC](https://discuss.ray.io/t/core-issue-with-running-ray-code-from-jupyter-notebook/1814 "2021-04-21T12:33:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![SumanthDatta](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sumanthdatta/32/476_2.png) [@SumanthDatta](https://discuss.ray.io/u/SumanthDatta)
#### Post date: [April 21, 2021, 12:33pm UTC](https://discuss.ray.io/t/core-issue-with-running-ray-code-from-jupyter-notebook/1814/1 "2021-04-21T12:33:00Z")

</div>

When you run ray parallel iterator code in jupyter notebook . The worker processes are not killed, even after the script finishes execution. We can reproduce with simple code like this.

import ray  
ray.init(address=‘auto’, \_redis\_password=‘5241590000000000’, ignore\_reinit\_error=True)  
it = ray.util.iter.from\_items([1, 2, 3, 4], num\_shards=2)  
for val in it.gather\_async():  
print(val)

---

<div class="post-metadata">

### Author: ![SumanthDatta](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sumanthdatta/32/476_2.png) [@SumanthDatta](https://discuss.ray.io/u/SumanthDatta)
#### Post date: [April 21, 2021, 5:20pm UTC](https://discuss.ray.io/t/core-issue-with-running-ray-code-from-jupyter-notebook/1814/2 "2021-04-21T17:20:13Z")

</div>

This is the expected behaviour of jupyter notebook , if you shutdown notebook which ran the script . Only then the worker processes are killed. Just found out.
