[RPC profiling] Add test to ensure using record_function works for RPC (#43657)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/43657
We didn't have a test that ensures functions ran over RPC that are being profiled can use `with record_function()` to profile specific blocks in the function execution. This is useful if the user wants certain information about specific blocks in the function ran over RPC composed of many torch ops and some custom logic, for example.
Currently, this will not work if the function is TorchScripted since `with record_function()` is not torchscriptable yet. We can add support for this in future PRs so that torchscript RPC functions can also be profiled like this.
ghstack-source-id: 111033981
Reviewed By: mrshenli
Differential Revision: D23355215
fbshipit-source-id: 318d92e285afebfeeb2a7896b4959412c5c241d4