1#pragma once
2
3#include <torch/csrc/distributed/rpc/rpc_command_base.h>
4#include <torch/csrc/distributed/rpc/types.h>
5
6namespace torch {
7namespace distributed {
8namespace rpc {
9
10// RPC call representing calling a Python function over RPC.
11class TORCH_API PythonCall final : public RpcCommandBase {
12 public:
13 PythonCall(SerializedPyObj&& serializedPyObj, bool isAsyncExecution);
14
15 c10::intrusive_ptr<Message> toMessageImpl() && override;
16
17 static std::unique_ptr<PythonCall> fromMessage(const Message& message);
18
19 const SerializedPyObj& serializedPyObj() const;
20
21 inline bool isAsyncExecution() const {
22 return isAsyncExecution_;
23 }
24
25 private:
26 SerializedPyObj serializedPyObj_;
27 const bool isAsyncExecution_;
28};
29
30} // namespace rpc
31} // namespace distributed
32} // namespace torch
33