Skip to content

Commit 6f5df8c

Browse files
author
=
committed
Added Multicast dynamic config
This commit adds a multicast configuration server to update at runtime the CAPIO-CL configuration. It migrates from a REST based API webserver to a multicast API Server. This also updates the python bindings to expose the logic to the decorator @CapioCLRule
1 parent 753b77b commit 6f5df8c

36 files changed

Lines changed: 356 additions & 897 deletions

CMakeLists.txt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,11 @@ FetchContent_Declare(
5757
GIT_TAG v1.4.3
5858
)
5959

60-
FetchContent_Declare(
61-
httplib
62-
GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git
63-
GIT_TAG v0.29.0
64-
)
65-
66-
6760
set(JSONCONS_BUILD_TESTS OFF CACHE BOOL "" FORCE)
6861
set(JSONCONS_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
6962
set(JSONCONS_BUILD_FUZZERS OFF CACHE BOOL "" FORCE)
70-
set(HTTPLIB_USE_ZSTD_IF_AVAILABLE OFF CACHE BOOL "" FORCE)
7163

72-
FetchContent_MakeAvailable(jsoncons tomlplusplus httplib)
64+
FetchContent_MakeAvailable(jsoncons tomlplusplus)
7365

7466
if (BUILD_PYTHON_BINDINGS)
7567
FetchContent_Declare(
@@ -143,13 +135,11 @@ target_include_directories(libcapio_cl PUBLIC
143135
${jsoncons_SOURCE_DIR}/include
144136
${CAPIOCL_JSON_SCHEMAS_DIRECTORY}
145137
${TOMLPLUSPLUS_SOURCE_DIR}/include
146-
${httplib_SOURCE_DIR}
147138
)
148139

149140
target_link_libraries(libcapio_cl PUBLIC)
150141
target_link_libraries(libcapio_cl PRIVATE
151142
tomlplusplus::tomlplusplus
152-
httplib::httplib
153143
)
154144

155145
find_library(LIBANL anl)

bindings/python_bindings.cpp

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
#include <iostream>
12
#include <pybind11/operators.h>
23
#include <pybind11/pybind11.h>
34
#include <pybind11/stl.h>
45
#include <pybind11/stl/filesystem.h>
6+
#include <string>
57

68
#include "capiocl.hpp"
79
#include "capiocl/engine.h"
810
#include "capiocl/monitor.h"
911
#include "capiocl/parser.h"
10-
#include "capiocl/printer.h"
1112
#include "capiocl/serializer.h"
1213

1314
namespace py = pybind11;
@@ -20,6 +21,11 @@ PYBIND11_MODULE(_py_capio_cl, m) {
2021
py::register_exception<capiocl::serializer::SerializerException>(m, "SerializerException");
2122
py::register_exception<capiocl::monitor::MonitorException>(m, "MonitorException");
2223

24+
m.attr("CAPIO_CL_DEFAULT_WF_NAME") = py::str(capiocl::CAPIO_CL_DEFAULT_WF_NAME);
25+
m.attr("DEFAULT_MCAST_GROUP") =
26+
py::make_tuple(capiocl::configuration::defaults::DEFAULT_API_MULTICAST_IP.v,
27+
std::stoi(capiocl::configuration::defaults::DEFAULT_API_MULTICAST_PORT.v));
28+
2329
py::module_ fire_rules = m.def_submodule("fire_rules", "CAPIO-CL fire rules");
2430
fire_rules.attr("UPDATE") = py::str(capiocl::fireRules::UPDATE);
2531
fire_rules.attr("NO_UPDATE") = py::str(capiocl::fireRules::NO_UPDATE);
@@ -40,9 +46,14 @@ PYBIND11_MODULE(_py_capio_cl, m) {
4046
.def("print", &capiocl::engine::Engine::print)
4147
.def("contains", &capiocl::engine::Engine::contains, py::arg("path"))
4248
.def("size", &capiocl::engine::Engine::size)
43-
.def("add", &capiocl::engine::Engine::add, py::arg("path"), py::arg("producers"),
44-
py::arg("consumers"), py::arg("commit_rule"), py::arg("fire_rule"),
45-
py::arg("permanent"), py::arg("exclude"), py::arg("dependencies"))
49+
.def("add",
50+
py::overload_cast<std::filesystem::path &, std::vector<std::string> &,
51+
std::vector<std::string> &, const std::string &, const std::string &,
52+
bool, bool, std::vector<std::filesystem::path> &>(
53+
&capiocl::engine::Engine::add),
54+
py::arg("path"), py::arg("producers"), py::arg("consumers"), py::arg("commit_rule"),
55+
py::arg("fire_rule"), py::arg("permanent"), py::arg("exclude"),
56+
py::arg("dependencies"))
4657
.def("addProducer", &capiocl::engine::Engine::addProducer, py::arg("path"),
4758
py::arg("producer"))
4859
.def("addConsumer", &capiocl::engine::Engine::addConsumer, py::arg("path"),
@@ -98,8 +109,7 @@ PYBIND11_MODULE(_py_capio_cl, m) {
98109
.def("isCommitted", &capiocl::engine::Engine::isCommitted, py::arg("path"))
99110
.def("setHomeNode", &capiocl::engine::Engine::setHomeNode, py::arg("path"))
100111
.def("getPaths", &capiocl::engine::Engine::getPaths)
101-
.def("startApiServer", &capiocl::engine::Engine::startApiServer,
102-
py::arg("address") = "127.0.0.1", py::arg("port") = 5520)
112+
.def("startApiServer", &capiocl::engine::Engine::startApiServer)
103113
.def("__str__", &capiocl::engine::Engine::print)
104114
.def("__repr__",
105115
[](const capiocl::engine::Engine &e) {
@@ -120,4 +130,24 @@ PYBIND11_MODULE(_py_capio_cl, m) {
120130

121131
m.def("serialize", &capiocl::serializer::Serializer::dump, py::arg("engine"),
122132
py::arg("filename"), py::arg("version") = capiocl::CAPIO_CL_VERSION::V1);
133+
134+
py::class_<capiocl::engine::CapioCLEntry>(m, "CapioCLEntry")
135+
.def(py::init<>())
136+
.def_readwrite("producers", &capiocl::engine::CapioCLEntry::producers)
137+
.def_readwrite("consumers", &capiocl::engine::CapioCLEntry::consumers)
138+
.def_readwrite("file_dependencies", &capiocl::engine::CapioCLEntry::file_dependencies)
139+
.def_readwrite("commit_rule", &capiocl::engine::CapioCLEntry::commit_rule)
140+
.def_readwrite("fire_rule", &capiocl::engine::CapioCLEntry::fire_rule)
141+
.def_readwrite("directory_children_count",
142+
&capiocl::engine::CapioCLEntry::directory_children_count)
143+
.def_readwrite("commit_on_close_count",
144+
&capiocl::engine::CapioCLEntry::commit_on_close_count)
145+
.def_readwrite("enable_directory_count_update",
146+
&capiocl::engine::CapioCLEntry::enable_directory_count_update)
147+
.def_readwrite("store_in_memory", &capiocl::engine::CapioCLEntry::store_in_memory)
148+
.def_readwrite("permanent", &capiocl::engine::CapioCLEntry::permanent)
149+
.def_readwrite("excluded", &capiocl::engine::CapioCLEntry::excluded)
150+
.def_readwrite("is_file", &capiocl::engine::CapioCLEntry::is_file)
151+
.def_static("from_json", &capiocl::engine::CapioCLEntry::fromJson, py::arg("in"))
152+
.def("to_json", &capiocl::engine::CapioCLEntry::toJson);
123153
}

bruno_webapi_tests/add_consumer.bru

Lines changed: 0 additions & 23 deletions
This file was deleted.

bruno_webapi_tests/add_file_dependency.bru

Lines changed: 0 additions & 23 deletions
This file was deleted.

bruno_webapi_tests/add_producer.bru

Lines changed: 0 additions & 23 deletions
This file was deleted.

bruno_webapi_tests/add_workflow_name.bru

Lines changed: 0 additions & 22 deletions
This file was deleted.

bruno_webapi_tests/bruno.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

bruno_webapi_tests/collection.bru

Whitespace-only changes.

bruno_webapi_tests/get_commit_close_count.bru

Lines changed: 0 additions & 22 deletions
This file was deleted.

bruno_webapi_tests/get_commit_on_n_files_count.bru

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)