From 6d728639a74457018fd31a8ec525a42cc6892ea9 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Tue, 23 May 2023 18:39:05 +0000 Subject: [PATCH 1/4] Fix mg_graph for the usage under ANALYTICAL mode --- cpp/mg_utility/mg_graph.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/mg_utility/mg_graph.hpp b/cpp/mg_utility/mg_graph.hpp index d2679fdb3..598719a9f 100644 --- a/cpp/mg_utility/mg_graph.hpp +++ b/cpp/mg_utility/mg_graph.hpp @@ -73,6 +73,7 @@ class Graph : public GraphView { /// /// @return all incident edges const std::vector &IncidentEdges(TSize node_id) const override { + // TODO(gitbuda): This doesn't work in the ANALYTICAL mode because new nodes come in. if (node_id >= nodes_.size()) { throw mg_exception::InvalidIDException(); } From 333746dd6e8b0c6b502c9d3c0418616e15f5dd45 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Wed, 14 Jun 2023 12:20:13 +0000 Subject: [PATCH 2/4] Add build language picker --- setup | 50 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/setup b/setup index 9e3ee0b8b..59d79e1b9 100644 --- a/setup +++ b/setup @@ -32,6 +32,25 @@ HELP_MESSAGE = """\ For usage info run: python3 setup -h """ +class Lang(Enum): + PYTHON = "Python" + CPP = "Cpp" + RUST = "Rust" + + @staticmethod + def from_str(lang_str): + if lang_str.lower() == "python": + return Lang.PYTHON + elif lang_str.lower() == "cpp": + return Lang.CPP + elif lang_str.lower() == "rust": + return Lang.RUST + else: + raise BaseException("Wrong value for the lang parameter.") + + def __str__(self): + return str(self.value) + class BuildType(Enum): DEBUG = "Debug" RELEASE = "Release" @@ -42,6 +61,7 @@ class BuildType(Enum): class Parameter(Enum): GPU = "gpu" CPP_BUILD_FLAGS = "cpp_build_flags" + LANG = "lang" PATH = "path" TYPE = "type" @@ -57,6 +77,14 @@ def get_arguments(): build_args_parser.add_argument( "-p", "--path", help="Path to query modules directory", required=False ) + build_args_parser.add_argument( + "--lang", + help="Programming languages to build", + nargs='*', + type=Lang.from_str, + choices=Lang, + default=list(Lang), + ) build_args_parser.add_argument( "--type", help="Build type", @@ -265,18 +293,20 @@ def build(args:Dict[str, Any])->bool: os.makedirs(MAGE_BUILD_DIRECTORY, exist_ok=True) copytree(LICENCE_DIRECTORY, MAGE_BUILD_DIRECTORY) - - cpp_status = build_and_copy_cpp_modules(args) - if not cpp_status: - return False + if Lang.CPP in args[Parameter.LANG.value]: + cpp_status = build_and_copy_cpp_modules(args) + if not cpp_status: + return False - python_status = copy_python_modules() - if not python_status: - return False + if Lang.PYTHON in args[Parameter.LANG.value]: + python_status = copy_python_modules() + if not python_status: + return False - rust_status = build_and_copy_rust_modules(args) - if not rust_status: - return False + if Lang.RUST in args[Parameter.LANG.value]: + rust_status = build_and_copy_rust_modules(args) + if not rust_status: + return False return True From f7d7f492154b7af0d59a7101fa9342a88235772a Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Wed, 14 Jun 2023 13:24:31 +0000 Subject: [PATCH 3/4] Fix GetWeight tmp --- cpp/mg_utility/mg_graph.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cpp/mg_utility/mg_graph.hpp b/cpp/mg_utility/mg_graph.hpp index 598719a9f..a83ca2c99 100644 --- a/cpp/mg_utility/mg_graph.hpp +++ b/cpp/mg_utility/mg_graph.hpp @@ -73,7 +73,7 @@ class Graph : public GraphView { /// /// @return all incident edges const std::vector &IncidentEdges(TSize node_id) const override { - // TODO(gitbuda): This doesn't work in the ANALYTICAL mode because new nodes come in. + // TODO(gitbuda): This doesn't work in the ANALYTICAL mode because new nodes come in; UPDATE: this is probably fine. if (node_id >= nodes_.size()) { throw mg_exception::InvalidIDException(); } @@ -145,8 +145,10 @@ class Graph : public GraphView { /// /// @return double weight double GetWeight(TSize edge_id) const override { + // TODO(gitbuda): GetWeight fails in the ANALYTICAL, according to the current usage it's ok to return 0, but it + // would be probably be better to return optional. if (edge_id < 0 || edge_id >= edges_.size()) { - throw mg_exception::InvalidIDException(); + return 0; } return weights_[edge_id]; } From b93d5180525024c6daa8f479248d6797587de1e7 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Thu, 22 Jun 2023 13:51:21 +0000 Subject: [PATCH 4/4] Use latest memgraph commit --- cpp/memgraph | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/memgraph b/cpp/memgraph index ea969ba95..bcd23fe3c 160000 --- a/cpp/memgraph +++ b/cpp/memgraph @@ -1 +1 @@ -Subproject commit ea969ba951672148b11d2eaf29d5f6ad09ba3c0d +Subproject commit bcd23fe3cb1705f963a0b5c8c2365ea722a6eb6c