Skip to content

CaaS - test APIs and E2E tests #2191

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

Merged
merged 41 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
89b0f4c
Remove unnecessary examples
RobertLucian May 24, 2021
747d6bb
More APIs removed
RobertLucian May 24, 2021
a68fd68
Add test apis (realtime/async)
RobertLucian May 24, 2021
83079a1
Require less memory for text-generator api
RobertLucian May 24, 2021
8b37a94
Add tensorflow cpu/gpu api
RobertLucian May 25, 2021
52a42d1
Merge branch 'feature/caas-api' into caas/test-apis
RobertLucian May 25, 2021
8c7ba0b
Changes to the realtime APIs
RobertLucian May 25, 2021
73c0419
Remove tensorflow dir from tests
RobertLucian May 25, 2021
6cfc3f2
Add iris-classifier trainer task
RobertLucian May 25, 2021
2e1b8a6
Remove more unnecessary APIs
RobertLucian May 25, 2021
db5ed8a
Add batch API
RobertLucian May 25, 2021
16d7519
Add batch submitter
RobertLucian May 25, 2021
fc9bf12
Add batch sum API
RobertLucian May 25, 2021
ab61fa0
Finalize async E2E
RobertLucian May 25, 2021
80bd36c
Finalize autoscaling E2E test
RobertLucian May 25, 2021
4e671fb
Finalize batch E2E test
RobertLucian May 25, 2021
90d1d43
Finalize load E2E test
RobertLucian May 25, 2021
45d07c2
Finalize long running E2E test
RobertLucian May 25, 2021
2a95e0c
Finalize realtime E2E test
RobertLucian May 25, 2021
b24bded
Finalize task E2E test
RobertLucian May 25, 2021
69b54a0
Add TrafficSplitter API
RobertLucian May 25, 2021
10b5ad0
Tweak make file commands to build the api images
RobertLucian May 25, 2021
1f93a17
Use the correct image names (not considering the registry) for the te…
RobertLucian May 25, 2021
d144cb0
Remove the "sample/" word from the test API images
RobertLucian May 25, 2021
96aa2fe
Fix traffic splitter image builder
RobertLucian May 25, 2021
d22d287
Use master instead of latest tag
RobertLucian May 25, 2021
cdeac2a
Fix naming scheme of container images (for APIs)
RobertLucian May 25, 2021
2d29c7e
Address some PR comments
RobertLucian May 26, 2021
142aba8
Revert to using query params for sleep API
RobertLucian May 26, 2021
0cb8c60
Create make test-images-* commands
RobertLucian May 26, 2021
e099f7d
Fixes for the E2E tests
RobertLucian May 26, 2021
686aa51
Use the correct api name for the iris-classifier trainer
RobertLucian May 26, 2021
a833339
Rename test_async_api to test_async_api_gpu
RobertLucian May 26, 2021
85b0861
update traffic splitter example
deliahu May 26, 2021
b73d66b
Address PR thoughts
RobertLucian May 27, 2021
06faae8
Create hello-world realtime API
RobertLucian May 27, 2021
38601c9
Fix naming scheme of the test api images (in make cmd)
RobertLucian May 27, 2021
aa7e53e
Minor log correction
RobertLucian May 27, 2021
fbf79de
Use quay images for the test APIs
RobertLucian May 27, 2021
dba2883
Batch sum API fix
RobertLucian May 27, 2021
56e6810
Nits
RobertLucian May 27, 2021
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
Prev Previous commit
Next Next commit
Add TrafficSplitter API
  • Loading branch information
RobertLucian committed May 25, 2021
commit 69b54a01e92e6e3bebc79b6f9b267fb841c90bd5
8 changes: 8 additions & 0 deletions test/apis/traffic-splitter/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Dockerfile
README.md
sample.json
*.pyc
*.pyo
*.pyd
__pycache__
.pytest_cache
18 changes: 18 additions & 0 deletions test/apis/traffic-splitter/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3.8-slim

# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True

# Install production dependencies
RUN pip install --no-cache-dir "uvicorn[standard]" gunicorn fastapi pydantic

# Copy local code to the container image.
COPY . /app
WORKDIR /app/

ENV PYTHONPATH=/app
ENV CORTEX_PORT=9000

# Run the web service on container startup. Here we use the gunicorn
# webserver, with one worker process and one thread.
CMD gunicorn -k uvicorn.workers.UvicornWorker --bind :$CORTEX_PORT main:app
106 changes: 0 additions & 106 deletions test/apis/traffic-splitter/README.md

This file was deleted.

36 changes: 0 additions & 36 deletions test/apis/traffic-splitter/cortex.yaml

This file was deleted.

63 changes: 63 additions & 0 deletions test/apis/traffic-splitter/cortex_cpu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
- name: prime-generator-a
kind: RealtimeAPI
pod:
port: 9000
containers:
- name: api
image: 499593605069.dkr.ecr.us-west-2.amazonaws.com/sample/realtime-prime-generator:latest
readiness_probe:
http_get:
path: "/healthz"
port: 9000
compute:
cpu: 200m
mem: 128M
autoscaling:
max_concurrency: 1

- name: prime-generator-b
kind: RealtimeAPI
pod:
port: 9000
containers:
- name: api
image: 499593605069.dkr.ecr.us-west-2.amazonaws.com/sample/realtime-prime-generator:latest
readiness_probe:
http_get:
path: "/healthz"
port: 9000
compute:
cpu: 200m
mem: 128M
autoscaling:
max_concurrency: 1

- name: request-recorder
kind: RealtimeAPI
pod:
port: 9000
containers:
- name: api
image: 499593605069.dkr.ecr.us-west-2.amazonaws.com/sample/realtime-prime-generator:latest
env:
RECORD_ONLY: "true"
readiness_probe:
http_get:
path: "/healthz"
port: 9000
compute:
cpu: 200m
mem: 128M
autoscaling:
max_concurrency: 1

- name: iris-classifier
kind: TrafficSplitter
apis:
- name: prime-generator-a
weight: 30
- name: prime-generator-b
weight: 70
- name: request-recorder
shadow: true
weight: 100
42 changes: 42 additions & 0 deletions test/apis/traffic-splitter/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import os
from typing import DefaultDict

from fastapi import FastAPI
from pydantic import BaseModel


def generate_primes(limit=None):
"""Sieve of Eratosthenes"""
not_prime = DefaultDict(list)
num = 2
while limit is None or num <= limit:
if num in not_prime:
for prime in not_prime[num]:
not_prime[prime + num].append(prime)
del not_prime[num]
else:
yield num
not_prime[num * num] = [num]
num += 1


class Request(BaseModel):
primes_to_generate: float


app = FastAPI()
record_only = os.getenv("RECORD_ONLY", "false")


@app.get("/healthz")
def healthz():
return "ok"


@app.post("/")
def prime_numbers(request: Request):
if record_only == "true":
print(f"received payload", request.primes_to_generate)
return

return {"prime_numbers": list(generate_primes(request.primes_to_generate))}
58 changes: 0 additions & 58 deletions test/apis/traffic-splitter/model.py

This file was deleted.

37 changes: 0 additions & 37 deletions test/apis/traffic-splitter/onnx_handler.py

This file was deleted.

2 changes: 0 additions & 2 deletions test/apis/traffic-splitter/onnx_requirements.txt

This file was deleted.

Loading