refactor: Manage all py plugins (md and exe) in one class
All calls to/from python are performed on one thread via a simple message queue (necessary because of the global interpreter lock).
This commit is contained in:
1 parent
c7db105533
commit
8c23665d65
29 files changed
+855
-602
No files matched your search
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include "python_interop/execution/execution_gateway.h"
|
||||
#include "python_interop/execution/execution_gateway_bridge.h"
|
||||
#include "python_interop/md/md_bridge.h"
|
||||
#include "python_interop/md/md_provider.h"
|
||||
#include "python_interop/python_object.h"
|
||||
|
||||
#include <functional>
|
||||
#include <future>
|
||||
#include <memory>
|
||||
#include <pybind11/pytypes.h>
|
||||
#include <string>
|
||||
|
||||
namespace python_interop {
|
||||
|
||||
class PluginManager {
|
||||
void *me_;
|
||||
|
||||
public:
|
||||
PluginManager();
|
||||
~PluginManager();
|
||||
|
||||
void start_work_thread();
|
||||
void stop_work_thread();
|
||||
|
||||
std::future<std::shared_ptr<PythonObjectT<bts::md::py_interop::MdProvider>>>
|
||||
start_md_provider(
|
||||
std::string provider_name,
|
||||
std::string target,
|
||||
std::shared_ptr<bts::md::py_interop::MdBridge> bridge);
|
||||
void stop_md_provider(const std::string &provider_name);
|
||||
|
||||
std::future<
|
||||
std::shared_ptr<PythonObjectT<python_execution::ExecutionGateway>>>
|
||||
start_execution_gateway(
|
||||
std::string gateway_name,
|
||||
std::string target,
|
||||
std::shared_ptr<python_execution::ExecutionGatewayBridge> bridge);
|
||||
void stop_execution_gateway(const std::string &gateway_name);
|
||||
|
||||
void invoke(std::function<void()> callback);
|
||||
};
|
||||
|
||||
} // namespace python_interop
|
||||
Reference in new issue
Block a user