-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpctree_module.cpp
More file actions
26 lines (21 loc) · 984 Bytes
/
pctree_module.cpp
File metadata and controls
26 lines (21 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "MasterPythonApi.hpp"
#include "PyFuture.cpp"
namespace py = pybind11;
PYBIND11_MODULE(pctree, m){
py::class_<PyFuture>(m, "PyFuture")
.def("done", &PyFuture::done)
.def("result", &PyFuture::result);
m.doc() = "PCTree Distributed Node System Python bindings";
m.def("start_master", &initMaster, "Start the master server");
m.def("client_list", &listActiveClients, "Return a list of connected clients");
m.def("send_file_async",
[](int client_index, const std::string& file_path, const std::string& func_name) {
return PyFuture(sendToClientAsync(client_index, file_path, func_name));
},
py::arg("client_index"), py::arg("file_path"), py::arg("function_name"));
m.def("ping_client", &pingClient, "Ping client at index",
py::arg("client_index"));
m.def("kill_master", &killMaster, "Kills the master server");
}