Skip to content

Commit

Permalink
Fixed the version at the time of releasing the pip package. (#49)
Browse files Browse the repository at this point in the history
* Add VERSION under GraphScope Dir.
* Resolve python package version using setuptools_scm.

Co-authored-by: Tao He <[email protected]>
  • Loading branch information
lidongze0629 and sighingnow authored Jan 4, 2021
1 parent 221536a commit 5c9a222
Show file tree
Hide file tree
Showing 17 changed files with 281 additions and 59 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ jobs:
sudo docker build -t registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:${{ github.sha }} \
--network=host \
-f ./graphscope.Dockerfile .
sudo docker build -t registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:1.0 \
sudo docker build -t registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:${{ github.sha }} \
--network=host \
-f ./manager.Dockerfile .
popd
Expand All @@ -377,6 +377,7 @@ jobs:
env:
CHANGE_MINIKUBE_NONE_USER: true
GS_IMAGE: registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:${{ github.sha }}
GIE_MANAGER_IMAGE: registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:${{ github.sha }}
run: |
export GS_TEST_DIR=${GITHUB_WORKSPACE}/gstest
git clone -b master --single-branch --depth=1 https://github.com/7br/gstest.git ${GS_TEST_DIR}
Expand All @@ -392,7 +393,7 @@ jobs:
- name: Clean
run: |
sudo docker rmi registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:${{ github.sha }} \
registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:1.0 || true
registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:${{ github.sha }} || true
gie-test:
runs-on: self-hosted
Expand Down Expand Up @@ -441,7 +442,7 @@ jobs:
sudo docker build -t registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:${{ github.sha }} \
--network=host \
-f ./graphscope.Dockerfile .
sudo docker build -t registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:1.0 \
sudo docker build -t registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:${{ github.sha }} \
--network=host \
-f ./manager.Dockerfile .
popd
Expand All @@ -454,12 +455,14 @@ jobs:
run: |
export PYTHONPATH=${GITHUB_WORKSPACE}/python
cd interactive_engine/tests
./function_test.sh 8111 1 registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:${{ github.sha }}
./function_test.sh 8111 2 registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:${{ github.sha }}
./function_test.sh 8111 1 registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:${{ github.sha }} \
registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:${{ github.sha }}
./function_test.sh 8111 2 registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:${{ github.sha }} \
registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:${{ github.sha }}
- name: Clean
run: |
sudo docker rmi registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:${{ github.sha }} \
registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:1.0 || true
registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:${{ github.sha }} || true
release-image:
runs-on: ubuntu-20.04
Expand All @@ -482,7 +485,7 @@ jobs:
sudo docker build -t registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:${{ github.sha }} \
--network=host \
-f ./graphscope.Dockerfile .
sudo docker build -t registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:1.0 \
sudo docker build -t registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:${{ github.sha }} \
--network=host \
-f ./manager.Dockerfile .
Expand All @@ -493,5 +496,8 @@ jobs:
registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:latest
sudo docker push registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:${{ github.sha }}
sudo docker push registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:latest
sudo docker push registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:1.0
sudo docker tag registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:${{ github.sha }} \
registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:latest
sudo docker push registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:${{ github.sha }}
sudo docker push registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:latest
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ a `runtime-base` image. To build images with latest version of GraphScope, go to
# ./scripts/prepare_dev.sh

make graphscope
# by default, the built image is tagged as graphscope/graphscope:SHORTSHA
make interactive_manager
# by default, the built image is tagged as graphscope/graphscope:SHORTSHA and graphscope/maxgraph_standalone_manager:SHORTSHA
```

### Building client library
Expand Down Expand Up @@ -347,7 +348,7 @@ You may run the whole test suite with commands:
./scripts/test.sh --all

# run all test cases on your built image
./scripts/test.sh --all --image graphscope/graphscope:SHORTSHA
./scripts/test.sh --all --gs_image graphscope/graphscope:SHORTSHA --gie_manager_image graphscope/maxgraph_standalone_manager:SHORTSHA

# or run the selected cases on a certain module. e.g.,
./scripts/test.sh --python
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
2 changes: 2 additions & 0 deletions coordinator/gscoordinator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

from gscoordinator.version import __version__
10 changes: 7 additions & 3 deletions coordinator/gscoordinator/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
# capture system stdout
sys.stdout = StdoutWrapper(sys.stdout)

from daemons.prefab import run
from graphscope.proto import attr_value_pb2
from graphscope.proto import coordinator_service_pb2_grpc
from graphscope.proto import engine_service_pb2_grpc
Expand All @@ -65,6 +64,7 @@
from gscoordinator.utils import generate_graph_type_sig
from gscoordinator.utils import str2bool
from gscoordinator.utils import to_maxgraph_schema
from gscoordinator.version import __version__

COORDINATOR_HOME = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
GRAPHSCOPE_HOME = os.path.join(COORDINATOR_HOME, "..")
Expand Down Expand Up @@ -683,7 +683,9 @@ def parse_sys_args():
parser.add_argument(
"--k8s_gs_image",
type=str,
default="registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:latest",
default="registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:{}".format(
__version__
),
help="Docker image of graphscope engines.",
)
parser.add_argument(
Expand All @@ -707,7 +709,9 @@ def parse_sys_args():
parser.add_argument(
"--k8s_gie_graph_manager_image",
type=str,
default="registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:1.0",
default="registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:{}".format(
__version__
),
help="Graph Manager image of graph interactive engine.",
)
parser.add_argument(
Expand Down
32 changes: 32 additions & 0 deletions coordinator/gscoordinator/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os

version_file_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "..", "..", "VERSION"
)

if os.path.isfile(version_file_path):
with open(version_file_path, "r", encoding="utf-8") as fp:
__version__ = fp.read().strip()
__version_tuple__ = (int(v) for v in __version__.split("."))
else:
__version__ = "0.1.0"
__version_tuple__ = (0, 1, 0)

del version_file_path
58 changes: 57 additions & 1 deletion coordinator/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,58 @@ def parsed_dev_reqs():
return fp.read().splitlines()


def parse_version(root, **kwargs):
"""
Parse function for setuptools_scm that first tries to read '../VERSION' file
to get a version number.
"""
from setuptools_scm.git import parse
from setuptools_scm.version import meta

version_file = os.path.join(repo_root, "..", "VERSION")
if os.path.isfile(version_file):
with open(version_file, "r", encoding="utf-8") as fp:
return meta(fp.read().strip())
return parse(root, **kwargs)


version_template = """#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
version_file_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "..", "..", "VERSION"
)
if os.path.isfile(version_file_path):
with open(version_file_path, "r", encoding="utf-8") as fp:
__version__ = fp.read().strip()
__version_tuple__ = (int(v) for v in __version__.split("."))
else:
__version__ = "{version}"
__version_tuple__ = {version_tuple}
del version_file_path
"""


setup(
name="gscoordinator",
version="0.1",
description="",
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -164,6 +213,13 @@ def parsed_dev_reqs():
"Programming Language :: Python :: 3.9",
],
keywords="GRAPE, Graph Computations",
use_scm_version={
"root": repo_root,
"parse": parse_version,
"write_to": os.path.join(repo_root, "gscoordinator/version.py"),
"write_to_template": version_template,
},
setup_requires=["setuptools_scm>=5.0.0", "grpcio", "grpcio-tools"],
package_dir={".": "."},
packages=find_packages("."),
package_data={
Expand Down
19 changes: 13 additions & 6 deletions interactive_engine/tests/function_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.
curdir=$(cd "$(dirname "$0")"; pwd)
version=$(cat ${curdir}/../../VERSION)

tmp_result="$curdir/tmp_result"
function _start {
_port=$1
workers=$2
image=$3
if [ -z "$image" ]; then
image="registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:latest"
gs_image=$3
gie_manager_image=$4
if [ -z "$gs_image" ]; then
gs_image="registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:${version}"
fi
if [ -z "$gie_manager_image" ]; then
gie_manager_image="registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:${version}"
fi

export GS_TEST_DIR=$curdir/src/main/resources
cd $curdir/../deploy/testing && python3 maxgraph_test_server.py ${_port} &
sleep 5s
curl -XPOST http://localhost:${_port} -d 'import graphscope'
curl -XPOST http://localhost:${_port} -d 'from graphscope.framework.loader import Loader'
curl_sess="curl -XPOST http://localhost:${_port} -d 'session = graphscope.session(num_workers=${workers}, show_log=True, k8s_coordinator_cpu=1.0, k8s_coordinator_mem='\''4Gi'\'', k8s_vineyard_cpu=1.0, k8s_vineyard_mem='\''4Gi'\'', k8s_vineyard_shared_mem='\''4Gi'\'', k8s_engine_cpu=1.0, k8s_engine_mem='\''4Gi'\'', k8s_gs_image='\''${image}'\'')' --write-out %{http_code} --silent --output ./curl.tmp"
curl_sess="curl -XPOST http://localhost:${_port} -d 'session = graphscope.session(num_workers=${workers}, show_log=True, k8s_coordinator_cpu=1.0, k8s_coordinator_mem='\''4Gi'\'', k8s_vineyard_cpu=1.0, k8s_vineyard_mem='\''4Gi'\'', k8s_vineyard_shared_mem='\''4Gi'\'', k8s_engine_cpu=1.0, k8s_engine_mem='\''4Gi'\'', k8s_gie_graph_manager_image='\''${gie_manager_image}'\'', k8s_gs_image='\''${gs_image}'\'')' --write-out %{http_code} --silent --output ./curl.tmp"

echo $curl_sess
code=`sh -c "$curl_sess"`
Expand Down Expand Up @@ -58,13 +65,13 @@ function _test {

opt=$1
if [ "$opt" = "_start" ]; then
_start $2 $3 $4
_start $2 $3 $4 $5
elif [ "$opt" = "_stop" ]; then
_stop
elif [ "$opt" = "_test" ]; then
_test
else
_start $1 $2 $3
_start $1 $2 $3 $4
_test
exit_code=$?
echo "test log ------------------------------------------------------------"
Expand Down
2 changes: 1 addition & 1 deletion k8s/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ graphscope: submodule
-f $(WORKING_DIR)/graphscope.Dockerfile ..
manager:
cd ../interactive_engine && docker build --target manager \
-t ${REGISTRY}/$(DOCKER_ORG)/maxgraph_standalone_manager:1.0 \
-t graphscope/maxgraph_standalone_manager:${SHORT_SHA} \
-f ../k8s/manager.Dockerfile .

graphscope-manylinux2010:
Expand Down
1 change: 1 addition & 0 deletions python/graphscope/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@
from graphscope.framework.graph import Graph
from graphscope.framework.graph_utils import g
from graphscope.framework.graph_utils import load_from
from graphscope.version import __version__
10 changes: 7 additions & 3 deletions python/graphscope/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@
""" GraphScope default configuration.
"""

from graphscope.version import __version__


class GSConfig(object):
k8s_namespace = None

# image
k8s_zookeeper_image = "zookeeper:3.4.14"
k8s_etcd_image = "quay.io/coreos/etcd:v3.4.13"
k8s_gs_image = "registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:latest"
k8s_gie_graph_manager_image = (
"registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:1.0"
k8s_gs_image = "registry.cn-hongkong.aliyuncs.com/graphscope/graphscope:{0}".format(
__version__
)
k8s_gie_graph_manager_image = "registry.cn-hongkong.aliyuncs.com/graphscope/maxgraph_standalone_manager:{0}".format(
__version__
)

# image pull configuration
Expand Down
Loading

0 comments on commit 5c9a222

Please sign in to comment.