Skip to content
Open
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
77 changes: 67 additions & 10 deletions .github/workflows/test_python-client.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
Expand All @@ -15,7 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

name: Test - python client
on:
Expand All @@ -35,21 +33,80 @@ defaults:
run:
shell: bash

env:
ARTIFACT_NAME: release_for_python_client

jobs:
black-formatter:
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Black
working-directory: ./python-client
run: |
pip install black
python3 -m black . --diff --color
python3 -m black . --check

build_server:
name: Build server
needs: black-formatter
runs-on: ubuntu-latest
env:
USE_JEMALLOC: OFF
BUILD_OPTIONS: -t release
container:
image: apache/pegasus:thirdparties-bin-test-ubuntu2204-${{ github.base_ref }}
steps:
- uses: actions/checkout@v3
- uses: "./.github/actions/rebuild_thirdparty_if_needed"
- uses: "./.github/actions/build_pegasus"
- uses: "./.github/actions/upload_artifact"

test:
name: test
runs-on: ubuntu-20.04
name: Test Python client
needs: build_server
runs-on: ubuntu-latest
container:
image: apache/pegasus:thirdparties-bin-test-ubuntu2204-${{ github.base_ref }}
steps:
- name: Install thrift
# python-client imports thrift package of 0.13.0, so we must use thrift-compiler 0.13.0
# to generate code as well. The thrift-compiler version on ubuntu-20.04 is 0.13.0
run: sudo apt-get install -y thrift-compiler
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: test
# python-client imports thrift package of 0.13.0, so we must use thrift-compiler 0.13.0
# to generate code as well. The thrift-compiler version on ubuntu-22.04 is 0.16.0, so
# build and install thrift-compiler 0.13.0 manually.
- name: Install thrift
run: |
export THRIFT_VERSION=0.13.0
wget --progress=dot:giga https://github.com/apache/thrift/archive/refs/tags/v${THRIFT_VERSION}.tar.gz
tar -xzf v${THRIFT_VERSION}.tar.gz
cd thrift-${THRIFT_VERSION}
./bootstrap.sh
./configure --enable-libs=no
make -j $(nproc)
make install
cd - && rm -rf thrift-${THRIFT_VERSION} v${THRIFT_VERSION}.tar.gz
- name: Download artifact
uses: "./.github/actions/download_artifact"
- name: Start Pegasus cluster
run: |
export LD_LIBRARY_PATH=$(pwd)/thirdparty/output/lib:${JAVA_HOME}/jre/lib/amd64/server
ulimit -s unlimited
./run.sh start_onebox
- name: Run Python client tests
working-directory: ./python-client
run: |
pip install -r requirement.txt
./test.sh
thrift -v --gen py -out . ../idl/dsn.layer2.thrift
thrift -v --gen py -out . ../idl/rrdb.thrift
python3 setup.py install
python3 sample.py
cd tests
python3 -m unittest -v test_basics.TestBasics
1 change: 0 additions & 1 deletion python-client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

2 changes: 1 addition & 1 deletion python-client/pypegasus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
# specific language governing permissions and limitations
# under the License.

__version__ = '2.5.0'
__version__ = "2.5.0"
2 changes: 1 addition & 1 deletion python-client/pypegasus/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.

__all__ = ['ttypes', 'constants']
__all__ = ["ttypes", "constants"]
8 changes: 7 additions & 1 deletion python-client/pypegasus/base/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
# specific language governing permissions and limitations
# under the License.

from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.Thrift import (
TType,
TMessageType,
TFrozenDict,
TException,
TApplicationException,
)
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive import fix_spec

Expand Down
Loading