Skip to content
This repository has been archived by the owner on Nov 25, 2023. It is now read-only.

Commit

Permalink
Changing interpreter initialization location + importing packages wit…
Browse files Browse the repository at this point in the history
…hin cpp
  • Loading branch information
stevenewald committed Oct 5, 2023
1 parent b5db7a1 commit fbdfe7c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN cmake --preset=ci-docker \


# Main stage
FROM python:3.11
FROM python:3.11-slim

RUN pip install numpy pandas polars scipy scikit-learn

Expand Down
1 change: 0 additions & 1 deletion src/lint/lint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ lint(const std::string& uid, const std::string& algo_id)
return "Could not find algorithm";
}

pybind11::scoped_interpreter guard{};
bool e = nutc::pywrapper::create_api_module(nutc::mock_api::getMarketFunc());
if (!e) {
log_e(linting, "Failed to create API module");
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ main(int argc, const char** argv)

crow::SimpleApp app;

pybind11::scoped_interpreter guard{};

CROW_ROUTE(app, "/")
([&](const crow::request& req) {
if (!req.url_params.get("uid")) {
Expand Down
3 changes: 3 additions & 0 deletions src/pywrapper/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ create_api_module(
"nutc_api", "Official NUTC Exchange API", new py::module::module_def
);
m.def("publish_market_order", publish_market_order);
py::module_::import("numpy");
py::module_::import("scipy");
py::module_::import("pandas");

py::module_ sys = py::module_::import("sys");
py::dict sys_modules = sys.attr("modules").cast<py::dict>();
Expand Down

0 comments on commit fbdfe7c

Please sign in to comment.