Create RemoteFunction class, remove FunctionProperties, simplify worker Python code.#2052
Create RemoteFunction class, remove FunctionProperties, simplify worker Python code.#2052pcmoritz merged 10 commits intoray-project:masterfrom robertnishihara:workercleanups
Conversation
|
Would it make sense for @ray.method to be renamed as @ray.split? |
|
Test PASSed. |
|
The reasoning for Your suggestion would definitely clean up certain applications, although it might be confusing for |
|
Though it sounds like the current behavior is also confusing as described in #1665. If we do that, then we should probably also change the behavior of |
|
Test FAILed. |
|
Test FAILed. |
|
Test PASSed. |
|
I think having a list of return values would be better (whether it be |
…ve FunctionProperties object.
|
@richardliaw you're talking about the case where |
|
yeah, for the specified case. Subsequent PR would be fine if others also approve. |
|
Test PASSed. |
| function_id_hash.update(inspect.getsource(function).encode("ascii")) | ||
| # Compute the function ID. | ||
| function_id = function_id_hash.digest() | ||
| assert len(function_id) == 20 |
There was a problem hiding this comment.
Yeah, that's the size of our IDs. I started fixing this, by replacing it with a variable ray._ID_SIZE. However, this touches many many files so I think I'll submit a separate PR for that (the 20 isn't introduced here, it is just moved around from somewhere else).
| num_cpus=None, | ||
| num_gpus=None, | ||
| resources=None): | ||
| """An experimental alternate way to submit remote functions.""" |
There was a problem hiding this comment.
given that this is marked experimental, is this used?
There was a problem hiding this comment.
It's used in Pandas on Ray (to change the number of return values), and I think it will be used more in the future (e.g., to specify different resource requirements at runtime).
| ) += 1 | ||
|
|
||
| reached_max_executions = (self.num_task_executions[task.driver_id().id( | ||
| )][function_id.id()] == self.function_properties[task.driver_id().id()] |
There was a problem hiding this comment.
task.driver_id(), task.task_id() and function_id.id() seem to be used multiple times - can consider abstracting into variable to decrease verbosity.
There was a problem hiding this comment.
Fixed for task.driver_id(). It didn't obviously make sense to me for the others, but I do want to do a subsequent PR cleaning up some of this stuff (but not super sure what the scope of that is yet).
python/ray/worker.py
Outdated
|
|
||
| def remote(*args, **kwargs): | ||
| """This decorator is used to define remote functions and to define actors. | ||
| worker = ray.worker.global_worker |
There was a problem hiding this comment.
Fixed, thx
|
Test PASSed. |
|
Test PASSed. |
* master: Create RemoteFunction class, remove FunctionProperties, simplify worker Python code. (ray-project#2052) Don't crash on duplicate actor notifications (ray-project#2043) Fixed attribute name in code example (ray-project#2054) [xray] Add Travis build for testing xray on Linux. (ray-project#2047) Added missing comma to code example (ray-project#2050) Use more CPUs for testMultipleWaitsAndGets. (ray-project#2051) use jobid_nil (ray-project#2044) Fix typo in tune. (ray-project#2046) Fix error in api.rst. (ray-project#2048) Improve shared_ptr usage (ray-project#2030)
* master: Create RemoteFunction class, remove FunctionProperties, simplify worker Python code. (ray-project#2052) Don't crash on duplicate actor notifications (ray-project#2043) Fixed attribute name in code example (ray-project#2054) [xray] Add Travis build for testing xray on Linux. (ray-project#2047) Added missing comma to code example (ray-project#2050) Use more CPUs for testMultipleWaitsAndGets. (ray-project#2051) use jobid_nil (ray-project#2044) Fix typo in tune. (ray-project#2046) Fix error in api.rst. (ray-project#2048) Improve shared_ptr usage (ray-project#2030)
* fix-a3c-torch: Fix shape error in conv nets Ensure that values are flat list rm all use of torch Variables Create RemoteFunction class, remove FunctionProperties, simplify worker Python code. (ray-project#2052) Don't crash on duplicate actor notifications (ray-project#2043) rm unnecessary Variable wrapper Fixed attribute name in code example (ray-project#2054) [xray] Add Travis build for testing xray on Linux. (ray-project#2047) Added missing comma to code example (ray-project#2050) Use more CPUs for testMultipleWaitsAndGets. (ray-project#2051) use jobid_nil (ray-project#2044) Fix typo in tune. (ray-project#2046) Fix error in api.rst. (ray-project#2048) Improve shared_ptr usage (ray-project#2030) replace deprecated function Fmt Fix shapes of tensors Rename argument name to out_size Use correct pytorch functions Use F.softmax instead of a pointless network layer
Related to #614 and #2016. Some initial cleanups.