You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Doing the following fails in a regular Python interpreter (it works in IPython).
importray@ray.remotedeff():
return1
It fails with
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/rkn/Workspace/ray/python/ray/worker.py", line 1886, in remote
return make_remote_decorator(num_return_vals, num_cpus, num_gpus)(args[0])
File "/Users/rkn/Workspace/ray/python/ray/worker.py", line 1798, in remote_decorator
function_id_hash.update(inspect.getsource(func).encode("ascii"))
File "/Users/rkn/anaconda3/lib/python3.6/inspect.py", line 938, in getsource
lines, lnum = getsourcelines(object)
File "/Users/rkn/anaconda3/lib/python3.6/inspect.py", line 925, in getsourcelines
lines, lnum = findsource(object)
File "/Users/rkn/anaconda3/lib/python3.6/inspect.py", line 756, in findsource
raise OSError('could not get source code')
OSError: could not get source code
Note (from #394), in Python 2, this will raise an IOError instead of an OSError. For example (from #394)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/conda/lib/python2.7/site-packages/ray-0.0.1-py2.7.egg/ray/worker.py", line 2104, in remote
return make_remote_decorator(num_return_vals, num_cpus, num_gpus)(args[0])
File "/opt/conda/lib/python2.7/site-packages/ray-0.0.1-py2.7.egg/ray/worker.py", line 2014, in remote_decorator
function_id_hash.update(inspect.getsource(func).encode("ascii"))
File "/opt/conda/lib/python2.7/inspect.py", line 701, in getsource
lines, lnum = getsourcelines(object)
File "/opt/conda/lib/python2.7/inspect.py", line 690, in getsourcelines
lines, lnum = findsource(object)
File "/opt/conda/lib/python2.7/inspect.py", line 538, in findsource
raise IOError('could not get source code')
IOError: could not get source code
Doing the following fails in a regular Python interpreter (it works in IPython).
It fails with
The error is probably the same as this https://mail.python.org/pipermail/python-list/2014-August/677076.html. The interpreter just compiles the code you type to bytecode, executes it, and throws away the source. That means that you can't get the source.
We don't actually need the inspect module. We're currently using it to get the source code to hash when we compute function IDs.
The text was updated successfully, but these errors were encountered: