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

Add makefile target to simplify process of compilation #240

Merged
merged 7 commits into from
Apr 8, 2021
Merged
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
81 changes: 7 additions & 74 deletions .github/workflows/local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ jobs:

- name: Install libgrape-lite
run: |
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
git clone -b master --single-branch --depth=1 https://github.com/alibaba/libgrape-lite.git
cd libgrape-lite
mkdir build && cd build
Expand All @@ -79,7 +78,6 @@ jobs:

- name: Install libvineyard
run: |
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
git clone -b v0.1.14 --single-branch --depth=1 https://github.com/alibaba/libvineyard.git
cd libvineyard
git submodule update --init
Expand All @@ -92,86 +90,21 @@ jobs:
python3 setup.py bdist_wheel
pip3 install ./dist/*.whl

- name: Build GraphScope GLE
run: |
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
pushd learning_engine/graph-learn
git submodule update --init third_party/pybind11
mkdir cmake-build && pushd cmake-build
cmake .. -DWITH_VINEYARD=ON -DTESTING=OFF
make -j`nproc`
sudo make install
popd

- name: Install GraphScope Python Client
run: |
export WITH_LEARNING_ENGINE=ON
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
pushd python
pip3 install -U setuptools
pip3 install -r requirements.txt -r requirements-dev.txt
python3 setup.py bdist_wheel
pip3 install ./dist/*.whl
popd

- name: Install GraphScope Coordinator
run: |
pushd coordinator
pip3 install -r requirements.txt -r requirements-dev.txt
python3 setup.py bdist_wheel
pip3 install ./dist/*.whl
popd

- name: Build GraphScope GAE
run: |
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
mkdir analytical_engine/build && pushd analytical_engine/build
cmake ..
make -j`nproc`
sudo make install
popd

- name: Build GraphScope GIE
- name: Build GraphScope
run: |
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=${JAVA_HOME}/bin:${PATH}:/usr/local/go/bin:/usr/local/zookeeper/bin:/usr/share/maven/bin
export GRAPHSCOPE_PREFIX=/tmp/graphscope_prefix

# build frontend coordinator graph-manager
pushd interactive_engine
mvn clean package -DskipTests -Pjava-release --quiet
popd

# build executor
pushd interactive_engine/src/executor
cargo build --all --release
popd

# copy dependencies into GRAPHSCOPE_PREFIX
mkdir -p ${GRAPHSCOPE_PREFIX}/pid ${GRAPHSCOPE_PREFIX}/logs
# copy mvn package
cp ./interactive_engine/src/instance-manager/target/0.0.1-SNAPSHOT.tar.gz ${GRAPHSCOPE_PREFIX}/0.0.1-instance-manager-SNAPSHOT.tar.gz
cp ./interactive_engine/src/assembly/target/0.0.1-SNAPSHOT.tar.gz ${GRAPHSCOPE_PREFIX}/0.0.1-SNAPSHOT.tar.gz
tar -xf ${GRAPHSCOPE_PREFIX}/0.0.1-SNAPSHOT.tar.gz -C ${GRAPHSCOPE_PREFIX}/
tar -xf ${GRAPHSCOPE_PREFIX}/0.0.1-instance-manager-SNAPSHOT.tar.gz -C ${GRAPHSCOPE_PREFIX}/
# coordinator
mkdir -p ${GRAPHSCOPE_PREFIX}/coordinator
cp -r ./interactive_engine/src/coordinator/target ${GRAPHSCOPE_PREFIX}/coordinator/
# frontend
mkdir -p ${GRAPHSCOPE_PREFIX}/frontend/frontendservice
cp -r ./interactive_engine/src/frontend/frontendservice/target ${GRAPHSCOPE_PREFIX}/frontend/frontendservice/
# executor
mkdir -p ${GRAPHSCOPE_PREFIX}/conf
cp ./interactive_engine/src/executor/target/release/executor ${GRAPHSCOPE_PREFIX}/bin/executor
cp ./interactive_engine/src/executor/store/log4rs.yml ${GRAPHSCOPE_PREFIX}/conf/log4rs.yml
export PATH=${JAVA_HOME}/bin:${PATH}:/usr/local/go/bin
# Default to /usr/local
make install WITH_LEARNING_ENGINE=ON

- name: Run Local Test
run: |
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=${JAVA_HOME}/bin:${PATH}:/usr/local/go/bin:/usr/local/zookeeper/bin:/usr/share/maven/bin
export GRAPHSCOPE_PREFIX=/tmp/graphscope_prefix
export PATH=${JAVA_HOME}/bin:${PATH}:/usr/local/go/bin:/usr/local/zookeeper/bin
export GRAPHSCOPE_PREFIX=/usr/local
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib

# install tensorflow for graphlearn
pip3 install pytest tensorflow --user

export GS_TEST_DIR=${GITHUB_WORKSPACE}/gstest
Expand Down
61 changes: 60 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
WORKING_DIR := $(dir $(MKFILE_PATH))

VERSION ?= 0.1.0
VERSION ?= 0.1.0
INSTALL_PREFIX ?= /usr/local

# GAE build options
EXPERIMENTAL_ON ?= OFF

# client build options
WITH_LEARNING_ENGINE ?= OFF

.PHONY: all
all: graphscope
Expand All @@ -26,6 +33,58 @@ interactive_manager:
push:
$(MAKE) -C $(WORKING_DIR)/k8s/ push

.PHONY: install
install: gle client coordinator gae gie

.PHONY: client
client: gle
cd $(WORKING_DIR)/python && \
pip3 install -r requirements.txt -r requirements-dev.txt && \
python3 setup.py install --user

.PHONY: coordinator
coordinator: client
cd $(WORKING_DIR)/coordinator && \
pip3 install -r requirements.txt -r requirements-dev.txt && \
python3 setup.py install --user

.PHONY: gae
gae:
mkdir -p $(WORKING_DIR)/analytical_engine/build
cd $(WORKING_DIR)/analytical_engine/build && \
cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX) -DEXPERIMENTAL_ON=$(EXPERIMENTAL_ON) .. && \
make -j`nproc` && \
sudo make install

.PHONY: gie
gie:
# coordinator/frontend/graphmanager
cd $(WORKING_DIR)/interactive_engine && \
mvn clean package -DskipTests -Pjava-release --quiet
# executor
cd $(WORKING_DIR)/interactive_engine/src/executor && \
cargo build --all --release
# install
mkdir -p $(WORKING_DIR)/.install_prefix && \
tar -xf $(WORKING_DIR)/interactive_engine/src/instance-manager/target/0.0.1-SNAPSHOT.tar.gz -C $(WORKING_DIR)/.install_prefix && \
tar -xf $(WORKING_DIR)/interactive_engine/src/assembly/target/0.0.1-SNAPSHOT.tar.gz -C $(WORKING_DIR)/.install_prefix && \
mkdir -p $(WORKING_DIR)/.install_prefix/coordinator $(WORKING_DIR)/.install_prefix/frontend/frontendservice $(WORKING_DIR)/.install_prefix/conf && \
cp -r $(WORKING_DIR)/interactive_engine/src/coordinator/target $(WORKING_DIR)/.install_prefix/coordinator && \
cp -r $(WORKING_DIR)/interactive_engine/src/frontend/frontendservice/target $(WORKING_DIR)/.install_prefix/frontend/frontendservice && \
cp $(WORKING_DIR)/interactive_engine/src/executor/target/release/executor $(WORKING_DIR)/.install_prefix/bin/executor && \
cp $(WORKING_DIR)/interactive_engine/src/executor/store/log4rs.yml $(WORKING_DIR)/.install_prefix/conf/log4rs.yml && \
sudo cp -r $(WORKING_DIR)/.install_prefix/* $(INSTALL_PREFIX) && \
rm -fr $(WORKING_DIR)/.install_prefix

.PHONY: gle
gle:
cd $(WORKING_DIR)/learning_engine/graph-learn && \
git submodule update --init third_party/pybind11 && \
mkdir -p cmake-build && cd cmake-build && \
cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX) -DWITH_VINEYARD=ON -DTESTING=OFF .. && \
make -j`nproc` && \
sudo make install

.PHONY: prepare-client
prepare-client:
cd $(WORKING_DIR)/python && \
Expand Down
32 changes: 32 additions & 0 deletions charts/graphscope/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,38 @@ See [*helm repo*](https://helm.sh/docs/helm/helm_repo/) for command documentatio

## Install Chart

GraphScope rely on some permissions to delete resources.

```shell
# example for `default` ServiceAccount with `default` namespace
$ cat role_and_binding.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: grole
namespace: default
rules:
- apiGroups: ["apps", ""]
resources: ["configmaps", "deployments", "deployments/status", "endpoints", "events", "pods", "pods/log", "pods/exec", "pods/status", "services", "replicasets"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: grole-binding
namespace: default
subjects:
- kind: ServiceAccount
name: default
namespace: default
roleRef:
kind: Role
name: grole
apiGroup: rbac.authorization.k8s.io

$ kubectl create -f ./role_and_binding.yaml
```

```shell
# Helm 3
$ helm install [RELEASE_NAME] graphscope/graphscope
Expand Down
1 change: 1 addition & 0 deletions coordinator/gscoordinator/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@ def launch_graphscope():
vineyard_socket=args.vineyard_socket,
shared_mem=args.k8s_vineyard_shared_mem,
log_level=args.log_level,
instance_id=args.instance_id,
timeout_seconds=args.timeout_seconds,
)
else:
Expand Down
4 changes: 3 additions & 1 deletion coordinator/gscoordinator/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def __init__(
vineyard_socket,
shared_mem,
log_level,
instance_id,
timeout_seconds,
):
super().__init__()
Expand All @@ -99,6 +100,7 @@ def __init__(
self._vineyard_socket = vineyard_socket
self._shared_mem = shared_mem
self._glog_level = parse_as_glog_level(log_level)
self._instance_id = instance_id
self._timeout_seconds = timeout_seconds

if "GRAPHSCOPE_PREFIX" not in os.environ:
Expand Down Expand Up @@ -195,7 +197,7 @@ def _launch_zookeeper(self):
def _launch_graph_manager(self):
port = self._get_free_port(self._hosts.split(",")[0])
gm_sh = os.path.join(self._graphscope_prefix, "bin", "start.sh")
cmd = ["bash", gm_sh, "local", str(port)]
cmd = ["bash", gm_sh, "local", str(port), self._instance_id]
print(" ".join(cmd))

process = subprocess.Popen(
Expand Down
1 change: 1 addition & 0 deletions coordinator/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def parse_version(root, **kwargs):
setup(
name="gscoordinator",
description="",
include_package_data=True,
long_description=long_description,
long_description_content_type="text/markdown",
author="GRAPE Team, Damo Academy",
Expand Down
4 changes: 2 additions & 2 deletions docs/deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Get Repo Info

.. code:: bash
$ helm repo add graphscope https://dl.bintray.com/graphscope/charts/
$ helm update
$ helm repo add graphscope https://graphscope.oss-cn-beijing.aliyuncs.com/charts/
$ helm repo update
Install Chart

Expand Down
4 changes: 2 additions & 2 deletions docs/zh/deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Coordinator 作为 GraphScope 后端服务的入口,通过 grpc 接收来自 P

.. code:: bash
$ helm repo add graphscope https://dl.bintray.com/graphscope/charts/
$ helm update
$ helm repo add graphscope https://graphscope.oss-cn-beijing.aliyuncs.com/charts/
$ helm repo update
安装

Expand Down
19 changes: 13 additions & 6 deletions interactive_engine/src/instance-manager/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,30 @@

export cluster_type=$1
export port=$2
export instance_id=$3

BINDIR=$(cd "$(dirname "$0")";pwd)
WORKSPACE=$BINDIR/../

if [ ! -n "$GRAPHSCOPE_RUNTIME" ]; then
export GRAPHSCOPE_RUNTIME=/tmp/graphscope/runtime
fi

LIBPATH="."
for file in `ls ${WORKSPACE}/lib`; do
LIBPATH=$LIBPATH":"$WORKSPACE/lib/$file
done

if [ "$cluster_type" == "local" ]; then
echo "server.port=${port}" > $WORKSPACE/config/application_local.properties
echo "logging.config=classpath:logback-spring.xml" >> $WORKSPACE/config/application_local.properties
echo "instance.createScript=$WORKSPACE/script/create_local_instance.sh" >> $WORKSPACE/config/application_local.properties
echo "instance.closeScript=$WORKSPACE/script/close_local_instance.sh" >> $WORKSPACE/config/application_local.properties
echo "instance.zookeeper.hosts=127.0.0.1:2181" >> $WORKSPACE/config/application_local.properties
INSTANCE_DIR=$GRAPHSCOPE_RUNTIME/$instance_id
mkdir -p $INSTANCE_DIR
echo "server.port=$port" > $INSTANCE_DIR/application_local.properties
echo "logging.config=classpath:logback-spring.xml" >> $INSTANCE_DIR/application_local.properties
echo "instance.createScript=$WORKSPACE/script/create_local_instance.sh" >> $INSTANCE_DIR/application_local.properties
echo "instance.closeScript=$WORKSPACE/script/close_local_instance.sh" >> $INSTANCE_DIR/application_local.properties
echo "instance.zookeeper.hosts=127.0.0.1:2181" >> $INSTANCE_DIR/application_local.properties

java -cp $LIBPATH -Dspring.config.location=$WORKSPACE/config/application_local.properties com.alibaba.maxgraph.admin.InstanceManagerApplication
java -cp $LIBPATH -Dspring.config.location=$INSTANCE_DIR/application_local.properties com.alibaba.maxgraph.admin.InstanceManagerApplication
else
java -cp $LIBPATH -Dspring.config.location=$WORKSPACE/config/application.properties com.alibaba.maxgraph.admin.InstanceManagerApplication
fi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Copyright 2020 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,10 +17,12 @@ object_id=$1

SCRIPT_DIR=$(cd "$(dirname "$0")";pwd)
WORKSPACE=$SCRIPT_DIR/../
export object_id
source $SCRIPT_DIR/common.sh

coordinator_id=`cat $WORKSPACE/pid/coordinator_$object_id.pid`
frontend_id=`cat $WORKSPACE/pid/frontend_$object_id.pid`
executor_id=`cat $WORKSPACE/pid/executor_$object_id.pid`
coordinator_id=`cat $PID_DIR/coordinator.pid`
frontend_id=`cat $PID_DIR/frontend.pid`
executor_id=`cat $PID_DIR/executor.pid`

sudo kill $coordinator_id || true
sudo kill $frontend_id || true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Copyright 2020 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,4 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

echo "hello close instance"
if [ ! -n "$GRAPHSCOPE_RUNTIME" ]; then
export GRAPHSCOPE_RUNTIME=/tmp/graphscope/runtime
fi

if [ -n "$object_id" ]; then
export LOG_DIR=$GRAPHSCOPE_RUNTIME/logs/$object_id
export CONFIG_DIR=$GRAPHSCOPE_RUNTIME/config/$object_id
export PID_DIR=$GRAPHSCOPE_RUNTIME/pid/$object_id
fi
16 changes: 0 additions & 16 deletions interactive_engine/src/instance-manager/script/createInstance.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Copyright 2020 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -20,6 +20,10 @@ VINEYARD_IPC_SOCKET=$4

SCRIPT_DIR=$(cd "$(dirname "$0")";pwd)

export object_id
source $SCRIPT_DIR/common.sh
mkdir -p $LOG_DIR $CONFIG_DIR $PID_DIR

bash ${SCRIPT_DIR}/start_local_coordinator.sh $object_id
sleep 1
bash ${SCRIPT_DIR}/start_local_frontend.sh $object_id $schema_path
Expand Down
Loading