Skip to content

Conversation

@pietern
Copy link
Contributor

@pietern pietern commented Oct 3, 2019

Stack from ghstack:

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.

Differential Revision: D17808208

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");
Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_python_udf_remote_run?

Copy link
Contributor

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_call
  • load_python_udf_result_internal -> _deserialize_python_ret

Copy link
Contributor Author

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.

@mrshenli mrshenli requested a review from zhaojuanmao October 3, 2019 20:20
Copy link
Contributor

@zhaojuanmao zhaojuanmao left a 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)
Copy link
Contributor

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.
pietern added a commit that referenced this pull request Oct 7, 2019
Per discussion in #27286, the `UDF` part is superfluous.

This makes the naming consistent with the `MessageType` enum.
pietern added a commit that referenced this pull request Oct 7, 2019
Per discussion in #27286, the `UDF` part is superfluous.

This makes the naming consistent with the `MessageType` enum.
@pietern
Copy link
Contributor Author

pietern commented Oct 7, 2019

@mrshenli @zhaojuanmao @xush6528 Renamed to remove UDF and added py prefix to indicate the C++ code is calling into Python code (which is good to know).

Copy link
Contributor

@zhaojuanmao zhaojuanmao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

pietern added a commit that referenced this pull request Oct 7, 2019
Per discussion in #27286, the `UDF` part is superfluous.

This makes the naming consistent with the `MessageType` enum.
pietern added a commit that referenced this pull request Oct 7, 2019
Per discussion in #27286, the `UDF` part is superfluous.

This makes the naming consistent with the `MessageType` enum.
Copy link
Contributor

@xush6528 xush6528 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Looks better!

pietern added a commit that referenced this pull request Oct 8, 2019
Per discussion in #27286, the `UDF` part is superfluous.

This makes the naming consistent with the `MessageType` enum.
pietern added a commit that referenced this pull request Oct 8, 2019
Per discussion in #27286, the `UDF` part is superfluous.

This makes the naming consistent with the `MessageType` enum.
pietern added a commit that referenced this pull request Oct 8, 2019
Per discussion in #27286, the `UDF` part is superfluous.

This makes the naming consistent with the `MessageType` enum.
@facebook-github-bot
Copy link
Contributor

@pietern merged this pull request in 48a571b.

1 similar comment
@facebook-github-bot
Copy link
Contributor

@pietern merged this pull request in 48a571b.

pietern added a commit that referenced this pull request Oct 9, 2019
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)
@facebook-github-bot facebook-github-bot deleted the gh/pietern/41/head branch October 28, 2019 22:18
pietern added a commit that referenced this pull request Oct 29, 2019
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)
pietern added a commit that referenced this pull request Oct 29, 2019
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)
pietern added a commit that referenced this pull request Nov 4, 2019
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)
facebook-github-bot pushed a commit that referenced this pull request Nov 5, 2019
Summary:
Pull Request resolved: #27530

Per discussion in #27286, the `UDF` part is superfluous.

This makes the naming consistent with the `MessageType` enum.

Test Plan: Imported from OSS

Differential Revision: D17808211

Pulled By: pietern

fbshipit-source-id: 0ff925de26d027951ce285750ad276ed17fee4c6
thiagocrepaldi pushed a commit to thiagocrepaldi/pytorch that referenced this pull request Feb 4, 2020
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged module: pybind Related to our Python bindings / interactions with other Python libraries oncall: distributed Add this issue/PR to distributed oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants