Skip to content

Commit

Permalink
Copied over our changes in zillow/kserve, only those which are still …
Browse files Browse the repository at this point in the history
…relevant.

We don't need to remove ray anymore as it has been upgraded.
  • Loading branch information
akdigitalself committed Jan 8, 2024
1 parent 32e1398 commit fb1cf95
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ bin
# Notebook Checkpoints
.ipynb_checkpoints

.gitlab-ci.yml
.openapi-generator-ignore
.openapi-generator/

Expand Down
60 changes: 60 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
include:
- project: 'analytics/artificial-intelligence/ai-platform/aip-infrastructure/ci-templates/ci-cd-template'
ref: &include_ref 'v3'
file: 'environments/devex.yml'
- project: 'analytics/artificial-intelligence/ai-platform/aip-infrastructure/ci-templates/ci-cd-template'
ref: *include_ref
file: '/blocks/python.yml'

variables:
PY_LIBRARY_NAME: "zillow-kserve"
MAJOR_VERSION: "0"
MINOR_VERSION: "7"
KSERVE_VERSION_PATH: "python/kserve/setup.py"
PUBLISH: "true"

stages:
- build

.version: &version |
# Extract the open source KServe version as the basis for our forked library version.
KSERVE_VERSION=$(cat $KSERVE_VERSION_PATH | sed -nr "s/^ *version=['\"]([^'\"]*)['\"],/\1/p")

PY_LIBRARY_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${CI_PIPELINE_IID}"
if [ "${CI_COMMIT_BRANCH}" != "${CI_DEFAULT_BRANCH}" ]; then
PY_LIBRARY_VERSION="${PY_LIBRARY_VERSION}-dev.${CI_PIPELINE_IID}"
# Ensure the image tag is compliant with PEP-440,
IMAGE_TAG="${PY_LIBRARY_VERSION}.dev${CI_PIPELINE_IID}"
else
IMAGE_TAG="${PY_LIBRARY_VERSION}"
fi
# Only apply the KServe version to the python library as Docker versions do not have the concept of
# build metadata and the "+" character causes errors.
PY_LIBRARY_VERSION="${PY_LIBRARY_VERSION}+${KSERVE_VERSION}"

build:publish:
extends: .aip_python_debian_image
stage: build
script:
- *version
# Now write back the zillow-kserve version back to the original location we found the original so
# python package managers can reference it as they need the version stored internally.
- sed -i "s/\(version=['\"]\)[^'\"]*\(['\"]\)/\1${PY_LIBRARY_VERSION}\2/" $KSERVE_VERSION_PATH
- cd python/kserve
- python setup.py sdist
# Set up the configuration for Artifactory to publish the python package internally.
- |
cat >~/.pypirc <<EOL
[distutils]
index-servers = local
[local]
repository: ${ANALYTICS_PYPI_REPOSITORY}
username: ${PYPI_USERNAME}
password: ${PYPI_PASSWORD}
EOL
- python setup.py sdist upload --repository "${ANALYTICS_PYPI_REPOSITORY}"
rules:
- if: '$PUBLISH == "true"'
# only trigger on zillow/ branches
- if: '$CI_COMMIT_BRANCH =~ /^zillow.*/'

13 changes: 10 additions & 3 deletions python/kserve/kserve/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@
from azure.storage.blob._list_blobs_helper import BlobPrefix
from azure.storage.fileshare import ShareServiceClient

from botocore.client import Config
from botocore import UNSIGNED
import boto3
# AIP: we'll never use them
try:
from botocore.client import Config
from botocore import UNSIGNED
import boto3
except ImportError:
Config = None
UNSIGNED = None
boto3 = None

from google.auth import exceptions
from google.cloud import storage

Expand Down
6 changes: 4 additions & 2 deletions python/kserve/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ azure-storage-file-share==12.7.0
azure-identity>=1.8.0
cloudevents>=1.6.2
avro>=1.11.0
boto3~=1.21
# AIP: remove boto dependencies as we are not using them and they will slow down dependency resolution
# boto3~=1.21
psutil>=5.9.0
ray[serve]==2.0.0
# AIP: relax ray for vllm
ray[serve]>=2.0.0
grpcio>=1.34.0
tritonclient==2.18.0
protobuf>=3.19.0
Expand Down
2 changes: 1 addition & 1 deletion python/kserve/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
version = version_file.read().strip()

setuptools.setup(
name='kserve',
name='zillow-kserve',
version=version,
author="The KServe Authors",
author_email='[email protected], [email protected], [email protected]',
Expand Down

0 comments on commit fb1cf95

Please sign in to comment.