Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mg_graph for the usage under ANALYTICAL mode #220

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp/memgraph
Submodule memgraph updated 383 files
5 changes: 4 additions & 1 deletion cpp/mg_utility/mg_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class Graph : public GraphView<TSize> {
///
/// @return all incident edges
const std::vector<TSize> &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();
}
Expand Down Expand Up @@ -144,8 +145,10 @@ class Graph : public GraphView<TSize> {
///
/// @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.
Comment on lines +148 to +149
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In community_detection_online it seems to me there is Update function which should propagate changes to graph. I will have a sync with @antepusic to check what is happening on Monday and to have sync about the return value.

Copy link
Collaborator

@antoniofilipovic antoniofilipovic Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gitbuda I am waiting @antepusic to return and when we sync we will update you here

if (edge_id < 0 || edge_id >= edges_.size()) {
throw mg_exception::InvalidIDException();
return 0;
}
return weights_[edge_id];
}
Expand Down
50 changes: 40 additions & 10 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Comment on lines +35 to +50
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of different PR, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is just merged here to make use of it, but in the end this won't be part of this PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here #226

def __str__(self):
return str(self.value)

class BuildType(Enum):
DEBUG = "Debug"
RELEASE = "Release"
Expand All @@ -42,6 +61,7 @@ class BuildType(Enum):
class Parameter(Enum):
GPU = "gpu"
CPP_BUILD_FLAGS = "cpp_build_flags"
LANG = "lang"
PATH = "path"
TYPE = "type"

Expand All @@ -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",
Expand Down Expand Up @@ -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

Expand Down
Loading