-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 18.04
- Ray installed from (source or binary): source
- Ray version: 0.7.0.dev2
- Python version: 3.7.2
Describe the problem
The timeout argument in signal.receive() does not work with non-integer values. For instance, calling signal.receive(sources, timeout=0.01) causes a redis.exceptions.ResponseError: timeout is not an integer or out of range.
This is because of L131 in signal.py, where the timeout is converted to ms and then converted to a string - redis expects an int, but if you pass a double to the method (like 0.1), the result of str(1000 * timeout) is 100.0. The correct string would have been 100. A fix would be to change str(1000 * timeout) to str(int(1000 * timeout)) and have checks to ensure timeout is not < 1000.
ray/python/ray/experimental/signal.py
Lines 129 to 133 in d951eb7
| query = "XREAD BLOCK " | |
| # Multiply by 1000x since timeout is in sec and redis expects ms. | |
| query += str(1000 * timeout) | |
| query += " STREAMS " | |
| query += " ".join([task_id for task_id in task_id_to_sources]) |
Source code / logs
Traceback:
Traceback (most recent call last):
File "driver.py", line 21, in <module>
signals = signal.receive(self.clients, timeout=0.01)
File "/home/romilb/ray/python/ray/experimental/signal.py", line 141, in receive
answers = ray.worker.global_worker.redis_client.execute_command(query)
File "/home/romilb/anaconda3/lib/python3.7/site-packages/redis/client.py", line 668, in execute_command
return self.parse_response(connection, command_name, **options)
File "/home/romilb/anaconda3/lib/python3.7/site-packages/redis/client.py", line 680, in parse_response
response = connection.read_response()
File "/home/romilb/anaconda3/lib/python3.7/site-packages/redis/connection.py", line 629, in read_response
raise response
redis.exceptions.ResponseError: timeout is not an integer or out of range
I also printed the corresponding redis query:
(pid=31330) XREAD BLOCK 10.0 STREAMS fc96f993802bb5a31b5868e69179fe76b62b7c3b 0