Skip to content

Commit

Permalink
Support build Insight through flexbuild command
Browse files Browse the repository at this point in the history
  • Loading branch information
lidongze0629 committed Mar 14, 2024
1 parent 5fccda5 commit 3d7a8bd
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def run_alert(self):
username=gremlin_interface["username"],
password=gremlin_interface["password"],
)
client.submit("g.with('evaluationTimeout', 5000).V().limit(1)").all.result()
client.submit(
"g.with('evaluationTimeout', 5000).V().limit(1)"
).all().result()
except Exception as e:
message = "Gremlin service unavailable: {0}".format(str(e))
# unable to distinguish whether frontend or executor is unavailable,
Expand Down
29 changes: 19 additions & 10 deletions flex/coordinator/gs_flex_coordinator/core/insight/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,29 @@

import graphscope
from dateutil import tz
from graphscope.deploy.kubernetes.utils import (get_service_endpoints,
resolve_api_client)
from graphscope.deploy.kubernetes.utils import get_service_endpoints, resolve_api_client
from gremlin_python.driver.client import Client
from kubernetes import client as kube_client
from kubernetes import config as kube_config

from gs_flex_coordinator.core.config import (CLUSTER_TYPE, CREATION_TIME,
ENABLE_DNS, GROOT_GREMLIN_PORT,
GROOT_GRPC_PORT, GROOT_PASSWORD,
GROOT_USERNAME, INSTANCE_NAME,
NAMESPACE, WORKSPACE)
from gs_flex_coordinator.core.config import (
CLUSTER_TYPE,
CREATION_TIME,
ENABLE_DNS,
GROOT_GREMLIN_PORT,
GROOT_GRPC_PORT,
GROOT_PASSWORD,
GROOT_USERNAME,
INSTANCE_NAME,
NAMESPACE,
WORKSPACE,
)
from gs_flex_coordinator.core.scheduler import schedule
from gs_flex_coordinator.core.utils import (data_type_to_groot,
encode_datetime, get_internal_ip,
get_public_ip)
from gs_flex_coordinator.core.utils import (
data_type_to_groot,
encode_datetime,
get_internal_ip,
)
from gs_flex_coordinator.version import __version__


Expand Down Expand Up @@ -285,6 +293,7 @@ def get_groot_graph_from_local():
pass
else:
break
time.sleep(5)
# groot graph
return GrootGraph(
name=INSTANCE_NAME,
Expand Down
1 change: 1 addition & 0 deletions flex/coordinator/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ pydantic >= 2
typing-extensions >= 4.7.1
psutil
schedule
graphscope-client >= 0.26.0
2 changes: 1 addition & 1 deletion flex/coordinator/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def run(self):
keywords=["OpenAPI", "GraphScope FLEX HTTP SERVICE API"],
install_requires=parsed_reqs(),
packages=find_packages(),
package_data={"": ["openapi/openapi.yaml"]},
package_data={"": ["openapi/openapi.yaml", "VERSION"]},
cmdclass={
"generate_flex_server": GenerateFlexServer,
"generate_interactive_sdk": GenerateInteractiveSDK,
Expand Down
5 changes: 3 additions & 2 deletions k8s/dockerfiles/graphscope-store.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN cd /home/graphscope/graphscope \
RUN cd /home/graphscope/graphscope/flex/coordinator \
&& python3 setup.py bdist_wheel \
&& mkdir -p /home/graphscope/groot/wheel \
&& cp dist/*.wml /home/graphscope/groot/wheel
&& cp dist/*.whl /home/graphscope/groot/wheel

FROM ubuntu:22.04

Expand All @@ -45,7 +45,8 @@ RUN useradd -m graphscope -u 1001 \
RUN sudo chmod a+wrx /tmp

# install coordinator
RUN pip3 install /usr/local/groot/wheel/*.whl
RUN pip3 install --upgrade pip \
&& pip3 install /usr/local/groot/wheel/*.whl

USER graphscope
WORKDIR /home/graphscope
Expand Down
31 changes: 30 additions & 1 deletion python/graphscope/gsctl/commands/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,36 @@ def flexbuild():
"--app",
type=click.Choice(["docker"]),
required=True,
help="Applicatin type of the built artifacts you want to build",
help="Application type of the built artifacts you want to build",
)
@click.option(
"--graphscope-repo",
required=False,
help="GraphScope code repo location.",
)
def insight(app, graphscope_repo):
"""Build GraphScope Insight for BI analysis scenarios"""
if graphscope_repo is None:
graphscope_repo = default_graphscope_repo_path
insight_build_dir = os.path.join(graphscope_repo, "k8s")
if not os.path.exists(insight_build_dir) or not os.path.isdir(
insight_build_dir
):
click.secho(
f"No such file or directory {insight_build_dir}, try --graphscope-repo param.",
fg="red",
)
return
cmd = ["make", "graphscope-store"]
run_shell_cmd(cmd, os.path.join(graphscope_repo, insight_build_dir))


@flexbuild.command()
@click.option(
"--app",
type=click.Choice(["docker"]),
required=True,
help="Application type of the built artifacts you want to build",
)
@click.option(
"--graphscope-repo",
Expand Down
2 changes: 1 addition & 1 deletion python/graphscope/gsctl/commands/insight.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def _construct_and_display_data(graphs):


@describe.command()
@click.argument("graph_name", required=False)
@click.argument("graph_name", required=True)
def graph(graph_name): # noqa: F811
"""Show details of graphs"""
try:
Expand Down

0 comments on commit 3d7a8bd

Please sign in to comment.