-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Rename variables and add comments #27286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The name `runUDFFunction` stutters because the F in UDF also stands for function. Renamed these variables to be identical to their Python equivalents. Renamed those to share a prefix and drop `internal`, because internal functions can use an underscore prefix.
| py::module::import("torch.distributed.internal_rpc_utils"); | ||
| runUDFFunction_ = getFunction(module, "run_python_udf_internal"); | ||
| loadResultFunction_ = getFunction(module, "load_python_udf_result_internal"); | ||
| pythonUDFRun_ = getFunction(module, "_python_udf_run"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think "Python" + "UDF" is a good name here?
It's just any Python function.
I learned the word UDF in SQL, SparkSQL, where UDF is somoething beyond the built-in capability of the domain-specific language.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll use @mrshenli's suggestion below.
| Unpickles a Python function and its arguments, runs the function, | ||
| and pickles and returns the function's return value. | ||
| """ | ||
| python_udf = _internal_rpc_pickler.deserialize(pickled_python_udf, tensors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name "_python_udf_run" doesn't indicate it's actually taking a serialized python function with args, deserialize it, run it, and serialize it.
Should we call it something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_python_udf_remote_run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to avoid using remote here, as dist.remote is another API with a different scope.
In the message level, we have PYTHON_CALL and PYTHON_RET. Shall we use a similar name here? For example:
_python_udf_run->_run_serialized_python_callload_python_udf_result_internal->_deserialize_python_ret
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points. I stuck with the original naming because I didn't know about the intent here. As it can be any Python function, I think @mrshenli's suggestions are good.
zhaojuanmao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for improving it, lgtm
| Unpickles a Python function and its arguments, runs the function, | ||
| and pickles and returns the function's return value. | ||
| """ | ||
| python_udf = _internal_rpc_pickler.deserialize(pickled_python_udf, tensors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_python_udf_remote_run?
The name `runUDFFunction` stutters because the F in UDF also stands for function. Renamed these variables to be identical to their Python equivalents. Renamed those to share a prefix and drop `internal`, because internal functions can use an underscore prefix.
Per discussion in #27286, the `UDF` part is superfluous. This makes the naming consistent with the `MessageType` enum.
Per discussion in #27286, the `UDF` part is superfluous. This makes the naming consistent with the `MessageType` enum.
|
@mrshenli @zhaojuanmao @xush6528 Renamed to remove UDF and added |
zhaojuanmao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Per discussion in #27286, the `UDF` part is superfluous. This makes the naming consistent with the `MessageType` enum.
Per discussion in #27286, the `UDF` part is superfluous. This makes the naming consistent with the `MessageType` enum.
xush6528
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Looks better!
Per discussion in #27286, the `UDF` part is superfluous. This makes the naming consistent with the `MessageType` enum.
Per discussion in #27286, the `UDF` part is superfluous. This makes the naming consistent with the `MessageType` enum.
Per discussion in #27286, the `UDF` part is superfluous. This makes the naming consistent with the `MessageType` enum.
1 similar comment
Per discussion in #27286, the `UDF` part is superfluous. This makes the naming consistent with the `MessageType` enum. Differential Revision: [D17808211](https://our.internmc.facebook.com/intern/diff/D17808211)
Per discussion in #27286, the `UDF` part is superfluous. This makes the naming consistent with the `MessageType` enum. Differential Revision: [D17808211](https://our.internmc.facebook.com/intern/diff/D17808211)
Per discussion in #27286, the `UDF` part is superfluous. This makes the naming consistent with the `MessageType` enum. Differential Revision: [D17808211](https://our.internmc.facebook.com/intern/diff/D17808211)
Per discussion in #27286, the `UDF` part is superfluous. This makes the naming consistent with the `MessageType` enum. Differential Revision: [D17808211](https://our.internmc.facebook.com/intern/diff/D17808211)
Summary: Pull Request resolved: pytorch#27286 The name `runUDFFunction` stutters because the F in UDF also stands for function. Renamed these variables to be identical to their Python equivalents. Renamed those to share a prefix and drop `internal`, because internal functions can use an underscore prefix. Test Plan: Imported from OSS Differential Revision: D17808208 Pulled By: pietern fbshipit-source-id: 7619f07fc8215203dfb1da1eb281845edcd2bb99
Stack from ghstack:
The name
runUDFFunctionstutters because the F in UDF also standsfor function. Renamed these variables to be identical to their Python
equivalents. Renamed those to share a prefix and drop
internal,because internal functions can use an underscore prefix.
Differential Revision: D17808208