Skip to content

Commit

Permalink
Upgrade to Grakn 1.8.0 (typedb#143)
Browse files Browse the repository at this point in the history
## What is the goal of this PR?

Upgrade KGLIB to work with Grakn 1.8.0, and to use the associated updates to the graknlabs build systems

## What are the changes implemented in this PR?

- Update build elements to conform to the latest dependency style in graknlabs
- Incorporate the syntax changes present in Grakn 1.8, `datatype` -> `value`, `date` -> `datetime`
  • Loading branch information
jmsfltchr authored Aug 14, 2020
1 parent 2e85dcc commit ce7fa2f
Show file tree
Hide file tree
Showing 38 changed files with 483 additions and 471 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.3.1
126 changes: 75 additions & 51 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
version: 2.1
commands:

install-bazel-linux-rbe:
install-bazel:
steps:
- run: curl -OL https://raw.githubusercontent.com/graknlabs/build-tools/master/ci/install-bazel-linux.sh
- run: bash ./install-bazel-linux.sh && rm ./install-bazel-linux.sh
- run: curl -OL https://raw.githubusercontent.com/graknlabs/build-tools/master/ci/install-bazel-rbe.sh
- run: bash ./install-bazel-rbe.sh && rm ./install-bazel-rbe.sh
- run: curl -OL https://raw.githubusercontent.com/graknlabs/dependencies/master/tool/bazelinstall/linux.sh
- run: bash ./linux.sh && rm ./linux.sh
- run: curl -OL https://raw.githubusercontent.com/graknlabs/dependencies/master/tool/bazelinstall/rbe.sh
- run: bash ./rbe.sh && rm ./rbe.sh

run-bazel:
parameters:
command:
type: string
steps:
- run: bazel run @graknlabs_dependencies//tool/bazelrun:rbe -- << parameters.command >>

run-grakn-server:
run-grakn:
steps:
- install-bazel-linux-rbe
- install-python
- run: bazel build @graknlabs_grakn_core//:assemble-linux-targz
- run: mkdir dist && tar -xvzf bazel-bin/external/graknlabs_grakn_core/grakn-core-all-linux.tar.gz -C ./dist/
- run-bazel:
command: bazel run //:grakn-extractor -- dist/grakn-core-all-linux
- run: nohup ./dist/grakn-core-all-linux/grakn server start

install-python:
Expand All @@ -23,47 +28,55 @@ commands:
- run: sudo unlink /usr/bin/python3
- run: sudo ln -s $(which python3) /usr/bin/python3
- run: sudo sed -i -e 's|python3|python|g' $(which lsb_release)
- run: sudo sed -i -e '/from optparse import OptionParser/ i from __future__ import print_function' $(which lsb_release)

jobs:
build:
machine: true
machine:
image: ubuntu-1604:201903-01
working_directory: ~/kglib
steps:
- install-bazel-linux-rbe
- install-bazel
- checkout
- install-python
- run: bazel build //...
- run-bazel:
command: bazel build //...

test:
machine: true
machine:
image: ubuntu-1604:201903-01
working_directory: ~/kglib
steps:
- install-bazel-linux-rbe
- install-bazel
- checkout
- install-python
- run: bazel test //kglib/... --test_output=streamed --spawn_strategy=standalone
- run-bazel:
command: bazel test //kglib/... --test_output=streamed --spawn_strategy=standalone

test-end-to-end:
machine: true
machine:
image: ubuntu-1604:201903-01
working_directory: ~/kglib
steps:
- install-bazel-linux-rbe
- install-bazel
- checkout
- install-python
- run: bazel test //tests/end_to_end/... --test_output=streamed --spawn_strategy=standalone

test-markdown-link-health:
machine: true
machine:
image: ubuntu-1604:201903-01
working_directory: ~/kglib
steps:
- checkout
- run: find . -name \*.md | xargs -L1 npx [email protected] -v

deploy-pip-snapshot:
machine: true
machine:
image: ubuntu-1604:201903-01
working_directory: ~/kglib
steps:
- install-bazel-linux-rbe
- install-bazel
- checkout
- install-python
- run: |
Expand All @@ -72,27 +85,30 @@ jobs:
bazel run --define version=$(git rev-parse HEAD) //:deploy-pip -- snapshot
test-deployment-pip:
machine: true
working_directory: ~/kglib
steps:
- checkout
- run-grakn-server
- run:
name: Run test-deployment-pip for kglib
command: |
echo -n "0.0.0-$CIRCLE_SHA1" > VERSION
sed -i -e "s/KGLIB_VERSION_MARKER/$(cat VERSION)/g" tests/deployment/requirements.txt
cat tests/deployment/requirements.txt
pip install -U pip setuptools
pip install -r tests/deployment/requirements.txt
./dist/grakn-core-all-linux/grakn console -k diagnosis -f kglib/utils/grakn/synthetic/examples/diagnosis/schema.gql
cd tests/deployment/ && python -m unittest kgcn.diagnosis
machine:
image: ubuntu-1604:201903-01
working_directory: ~/kglib
steps:
- install-bazel
- checkout
- run-grakn
- run:
name: Run test-deployment-pip for kglib
command: |
echo -n "0.0.0-$CIRCLE_SHA1" > VERSION
sed -i -e "s/KGLIB_VERSION_MARKER/$(cat VERSION)/g" tests/deployment/requirements.txt
cat tests/deployment/requirements.txt
pip install -U pip setuptools
pip install -r tests/deployment/requirements.txt
./dist/grakn-core-all-linux/grakn console -k diagnosis -f kglib/utils/grakn/synthetic/examples/diagnosis/schema.gql
cd tests/deployment/ && python -m unittest kgcn.diagnosis
release-approval:
machine: true
machine:
image: ubuntu-1604:201903-01
working_directory: ~/kglib
steps:
- install-bazel-linux-rbe
- install-bazel
- checkout
- install-python
- run: |
Expand All @@ -101,34 +117,37 @@ jobs:
bazel run @graknlabs_build_tools//ci:release-approval
release-validate:
machine: true
machine:
image: ubuntu-1604:201903-01
steps:
- install-bazel-linux-rbe
- install-bazel
- checkout
- install-python
- run: |
bazel run @graknlabs_build_tools//ci:release-validate-deps -- \
graknlabs_grakn_core graknlabs_client_python
deploy-github:
machine: true
machine:
image: ubuntu-1604:201903-01
working_directory: ~/kglib
steps:
- checkout
- run: wget https://github.com/tcnksm/ghr/releases/download/v0.12.0/ghr_v0.12.0_linux_386.tar.gz
- run: tar xvf ghr_v0.12.0_linux_386.tar.gz
- run:
name: "Publish Draft Release on GitHub"
command: |
VERSION_TAG=$(cat "VERSION")
curl -X POST --fail --data "{\"tag_name\": \"${VERSION_TAG}\",\"target_commitish\": \"${CIRCLE_SHA1}\",
\"name\": \"KGLIB ${VERSION_TAG}\",\"body\": \"\",\"draft\": true,\"prerelease\": false}" https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/releases?access_token=${GITHUB_DEPLOYMENT_TOKEN}
name: "Publish Draft Release on GitHub"
command: |
VERSION_TAG=$(cat "VERSION")
curl -X POST --fail --data "{\"tag_name\": \"${VERSION_TAG}\",\"target_commitish\": \"${CIRCLE_SHA1}\",
\"name\": \"KGLIB ${VERSION_TAG}\",\"body\": \"\",\"draft\": true,\"prerelease\": false}" https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/releases?access_token=${GITHUB_DEPLOYMENT_TOKEN}
deploy-pip-release:
machine: true
machine:
image: ubuntu-1604:201903-01
working_directory: ~/kglib
steps:
- install-bazel-linux-rbe
- install-bazel
- checkout
- install-python
- run: |
Expand All @@ -137,7 +156,8 @@ jobs:
bazel run --define version=$(cat VERSION) //:deploy-pip -- release
release-cleanup:
machine: true
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run: git push --delete https://[email protected]/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME $CIRCLE_BRANCH
Expand Down Expand Up @@ -165,7 +185,9 @@ workflows:
- deploy-pip-snapshot:
filters:
branches:
only: master
only:
- master
- development
requires:
- test
- test-end-to-end
Expand All @@ -174,7 +196,9 @@ workflows:
- test-deployment-pip:
filters:
branches:
only: master
only:
- master
- development
requires:
- deploy-pip-snapshot
- release-approval:
Expand Down
22 changes: 14 additions & 8 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
exports_files(["requirements.txt"])
exports_files(["requirements.txt", "deployment.properties", "RELEASE_TEMPLATE.md"])

load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@pypi_dependencies//:requirements.bzl", "requirement")
load("@graknlabs_bazel_distribution_pip//:requirements.bzl", deployment_requirement = "requirement")

load("@graknlabs_kglib_pip//:requirements.bzl",
graknlabs_kglib_requirement = "requirement")

load("@graknlabs_bazel_distribution//pip:rules.bzl", "assemble_pip", "deploy_pip")
load("@graknlabs_kglib_pip//:requirements.bzl",
graknlabs_kglib_requirement = "requirement")

load("@graknlabs_bazel_distribution//github:rules.bzl", "deploy_github")
load("@graknlabs_dependencies//distribution/artifact:rules.bzl", "artifact_extractor")

assemble_pip(
name = "assemble-pip",
Expand All @@ -29,7 +35,7 @@ assemble_pip(
license = "Apache-2.0",
install_requires=[
'enum-compat==0.0.2',
'grakn-client==1.7.2',
'grakn-client==1.8.0',
'absl-py==0.8.0',
'astor==0.8.0',
'cloudpickle==1.2.2',
Expand All @@ -41,7 +47,7 @@ assemble_pip(
'gast==0.3.1',
'google-pasta==0.1.7',
'graph-nets==1.0.4',
'grpcio==1.23.0',
'grpcio==1.24.1,<2',
'h5py==2.10.0',
'Keras-Applications==1.0.8',
'Keras-Preprocessing==1.1.0',
Expand All @@ -51,13 +57,13 @@ assemble_pip(
'networkx==2.3',
'numpy==1.17.2',
'pandas==0.25.1',
'protobuf==3.9.1',
'protobuf==3.6.1',
'pyparsing==2.4.2',
'python-dateutil==2.8.0',
'pytz==2019.2',
'scipy==1.3.1',
'semantic-version==2.8.2',
'six==1.12.0',
'six>=1.11.0',
'tensorboard==1.14.0',
'tensorflow==1.14.0',
'tensorflow-estimator==1.14.0',
Expand All @@ -76,5 +82,5 @@ assemble_pip(
deploy_pip(
name = "deploy-pip",
target = ":assemble-pip",
deployment_properties = "@graknlabs_build_tools//:deployment.properties",
deployment_properties = "@graknlabs_dependencies//distribution:deployment.properties",
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ At present this repo contains one project: [*Knowledge Graph Convolutional Netwo

- KGLIB installed via pip: `pip install grakn-kglib`.

- [Grakn Core 1.6.1](https://github.com/graknlabs/grakn/releases) running in the background
- [Grakn Core 1.8.0](https://github.com/graknlabs/grakn/releases) running in the background

- client-python 1.6.1 ([PyPi](https://pypi.org/project/grakn-client/), [GitHub release](https://github.com/graknlabs/client-python/releases))
- client-python 1.8.0 ([PyPi](https://pypi.org/project/grakn-client/), [GitHub release](https://github.com/graknlabs/client-python/releases))

**Run**
Take a look at [*Knowledge Graph Convolutional Networks* (KGCNs)](https://github.com/graknlabs/kglib/tree/master/kglib/kgcn) to see a walkthrough of how to use the library.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.1
0.2.2
Loading

0 comments on commit ce7fa2f

Please sign in to comment.