# Specifying suppress with RAY\_IGNORE\_UNHANDLED\_ERRORS=1

**URL:** <https://discuss.ray.io/t/specifying-suppress-with-ray-ignore-unhandled-errors-1/1917>\
**Category:** Ray Clusters\
**Created:** [April 26, 2021, 10:16pm UTC](https://discuss.ray.io/t/specifying-suppress-with-ray-ignore-unhandled-errors-1/1917 "2021-04-26T22:16:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![blublinsky](https://avatars.discourse-cdn.com/v4/letter/b/f05b48/32.png) [@blublinsky](https://discuss.ray.io/u/blublinsky)\
**Post date:** [April 26, 2021, 10:16pm UTC](https://discuss.ray.io/t/specifying-suppress-with-ray-ignore-unhandled-errors-1/1917/1 "2021-04-26T22:16:17Z")

</div>

I was trying to experiment with throttling ray execution and ensuring that tasks do not overrun predefined duration. Here is my code:

> import ray, time  
> ray.init()
> 
> @ray.remote  
> def busy(i):  
> time.sleep(i)  
> return i
> 
> #dictionary of execution times  
> executions = {}  
> ids =
> 
> extime = 2
> 
> #start first 5 executions  
> current\_time = time.time()  
> for x in range(0, 5):  
> id = busy.remote(extime)  
> ids.append(id)  
> executions[id] = current\_time  
> extime = extime + 5
> 
> print(‘ids’, ids)  
> print(‘executions’, executions)
> 
> while(True):  
> # Run every sec  
> ready, not\_ready = ray.wait(ids, timeout = 5.0)  
> # adjust duration  
> if extime \>= 40:  
> extime = 2  
> # Nothing completed  
> if not ready:  
> continue
> 
> ```
> current_time = time.time()
> # Process not_ready ones
> for key in not_ready:
> execution_time = current_time - executions[key]
> #print('key ', key, ' execution time ', execution_time)
> if execution_time >= 20.0:
> # we timed out
> print('execution ', key, ' is too long, canceling ')
> ray.cancel(key, force=True, recursive=True)
> ids.remove(key)
> executions.pop(key, 0)
> # add new execution
> id = busy.remote(extime)
> ids.append(id)
> executions[id] = current_time
> extime = extime + 5 # Process ready ones
> for key in ready:
> print('complete execution of ', key, ' value ', ray.get(key), ' duration ', current_time - executions[key])
> executions.pop(key)
> ids.remove(key)
> # add new execution
> id = busy.remote(extime)
> ids.append(id)
> executions[id] = current_time
> extime = extime + 5
> 
> ```

It seems to work fine, but because I delete long running Ray tasks, it gives me these wornings:

> execution ObjectRef(480a853c2c4c6f27ffffffffffffffffffffffff0100000001000000) is too long, canceling  
> execution ObjectRef(623b26bdd75b28e9ffffffffffffffffffffffff0100000001000000) is too long, canceling  
> complete execution of ObjectRef(c6953afc4a9f69e9ffffffffffffffffffffffff0100000001000000) value 12 duration 12.00232195854187  
> 2021-04-26 17:10:37,529 ERROR worker.py:78 – Unhandled error (suppress with RAY\_IGNORE\_UNHANDLED\_ERRORS=1): The worker died unexpectedly while executing this task. Check python-core-worker-_.log files for more information.  
> 2021-04-26 17:10:37,529 ERROR worker.py:78 – Unhandled error (suppress with RAY\_IGNORE\_UNHANDLED\_ERRORS=1): The worker died unexpectedly while executing this task. Check python-core-worker-_.log files for more information.  
> complete execution of ObjectRef(402ddcfdf56ca87affffffffffffffffffffffff0100000001000000) value 17 duration 17.004695892333984  
> complete execution of ObjectRef(24eed4584329c19affffffffffffffffffffffff0100000001000000) value 2 duration 2.0068249702453613

Where exactly do I suppress with RAY\_IGNORE\_UNHANDLED\_ERRORS=1 ?

---

<div class="post-metadata">

**Author:** ![rliaw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rliaw/32/24_2.png) [@rliaw](https://discuss.ray.io/u/rliaw)\
**Post date:** [April 26, 2021, 11:37pm UTC](https://discuss.ray.io/t/specifying-suppress-with-ray-ignore-unhandled-errors-1/1917/2 "2021-04-26T23:37:19Z")

</div>

> [@blublinsky](#):
>
> RAY\_IGNORE\_UNHANDLED\_ERRORS

You should be able to set this like:

`RAY_IGNORE_UNHANDLED_ERRORS=1 python script `
