Skip to content

Commit

Permalink
Merge branch 'mainline' into dev/loka/multi_column_value_constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie256 committed Jan 25, 2022
2 parents 4938126 + 6bc0957 commit c1c2967
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 32 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/python-continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ jobs:
run: make release
- name: Run tests
run: make test-system-python
- name: Smoke test wheel in client environment
run: |
python -m venv verify
source verify/bin/activate
pip install --upgrade pip
pip install dist/whylogs*.whl
python tests/smoketest.py
deactivate
rm -rf verify
- name: Coveralls Parallel
if: ${{matrix.os == 'ubuntu-latest'}}
env:
Expand Down
31 changes: 15 additions & 16 deletions examples/sagemaker_whylabs_example/code/serve
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import sys

cpu_count = multiprocessing.cpu_count()

model_server_timeout = os.environ.get('MODEL_SERVER_TIMEOUT', 60)
model_server_workers = int(os.environ.get('MODEL_SERVER_WORKERS', cpu_count))
model_server_timeout = os.environ.get("MODEL_SERVER_TIMEOUT", 60)
model_server_workers = int(os.environ.get("MODEL_SERVER_WORKERS", cpu_count))


def sigterm_handler(nginx_pid, gunicorn_pid):
try:
Expand All @@ -37,21 +38,18 @@ def sigterm_handler(nginx_pid, gunicorn_pid):
pass
sys.exit(0)

def start_server():
print('Starting the inference server with {} workers.'.format(model_server_workers))

def start_server():
print("Starting the inference server with {} workers.".format(model_server_workers))

# link the log streams to stdout/err so they will be logged to the container logs
subprocess.check_call(['ln', '-sf', '/dev/stdout', '/var/log/nginx/access.log'])
subprocess.check_call(['ln', '-sf', '/dev/stderr', '/var/log/nginx/error.log'])
subprocess.check_call(["ln", "-sf", "/dev/stdout", "/var/log/nginx/access.log"])
subprocess.check_call(["ln", "-sf", "/dev/stderr", "/var/log/nginx/error.log"])

nginx = subprocess.Popen(['nginx', '-c', '/opt/program/nginx.conf'])
gunicorn = subprocess.Popen(['gunicorn',
'--timeout', str(model_server_timeout),
'-k', 'gevent',
'-b', 'unix:/tmp/gunicorn.sock',
'-w', str(model_server_workers),
'wsgi:app'])
nginx = subprocess.Popen(["nginx", "-c", "/opt/program/nginx.conf"])
gunicorn = subprocess.Popen(
["gunicorn", "--timeout", str(model_server_timeout), "-k", "gevent", "-b", "unix:/tmp/gunicorn.sock", "-w", str(model_server_workers), "wsgi:app"]
)

signal.signal(signal.SIGTERM, lambda a, b: sigterm_handler(nginx.pid, gunicorn.pid))

Expand All @@ -63,9 +61,10 @@ def start_server():
break

sigterm_handler(nginx.pid, gunicorn.pid)
print('Inference server exiting')
print("Inference server exiting")


# The main routine just invokes the start function.

if __name__ == '__main__':
start_server()
if __name__ == "__main__":
start_server()
26 changes: 13 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/whylogs/proto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
Protobuf allows us to serialize/deserialize classes across languages
"""
from .constraints_pb2 import * # noqa
from .messages_pb2 import * # noqa
from .summaries_pb2 import * # noqa
from .constraints_pb2 import * # noqa
from .messages_pb2 import * # noqa
from .summaries_pb2 import * # noqa
26 changes: 26 additions & 0 deletions tests/smoketest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
This is here to verify that the produced wheel includes
all the necessary dependencies. This is exercised by
the CI workflow and does not use pytest because it is
intended to test the wheel in a production environment,
not a development environment.
"""

import os

import pandas as pd

import whylogs
from whylogs import get_or_create_session
from whylogs.app import Session
from whylogs.app.writers import WhyLabsWriter

writer = WhyLabsWriter()
session = Session(writers=[writer])

whylogs_session = get_or_create_session()

print(session)
print(whylogs_session)
print("Successfully created whylogs session with version:")
print(whylogs.__version__)

0 comments on commit c1c2967

Please sign in to comment.