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 diff --git a/cpp/mg_utility/mg_graph.hpp b/cpp/mg_utility/mg_graph.hpp index d2679fdb3..a83ca2c99 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; UPDATE: this is probably fine. if (node_id >= nodes_.size()) { throw mg_exception::InvalidIDException(); } @@ -144,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]; } 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