Skip to content

Commit 73d9951

Browse files
authored
Merge pull request #43 from Techainer/starllete
Fixes and improvement for mlchain 0.2
2 parents e48cc3a + 9adc4f2 commit 73d9951

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2078
-1491
lines changed

.github/workflows/ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
9+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
10+
jobs:
11+
# This workflow contains a single job called "build"
12+
build:
13+
# The type of runner that the job will run on
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [macos-latest, ubuntu-latest, windows-latest]
19+
python-version: [3.6, 3.7, 3.8, 3.9]
20+
21+
if: "!contains(github.event.head_commit.message, 'ci skip')"
22+
23+
# Steps represent a sequence of tasks that will be executed as part of the job
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v2
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
33+
- name: Set up conda
34+
# if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.6' }}
35+
if: ${{ matrix.os != 'windows-latest' }}
36+
uses: s-weigand/setup-conda@v1
37+
with:
38+
python-version: ${{ matrix.python-version}}
39+
40+
- name: Install dependencies for Unix
41+
if: ${{ matrix.os != 'windows-latest' }}
42+
run: |
43+
pip3 install -U scikit-build
44+
pip3 install -U awscli pip pytest coverage codecov
45+
46+
- name: Install dependencies for Windows
47+
if: ${{ matrix.os == 'windows-latest' }}
48+
run: |
49+
pip3 install -U scikit-build --user
50+
pip3 install -U awscli pip pytest coverage codecov --user
51+
52+
- name: Build and install
53+
run: python3 setup.py install
54+
55+
- name: Run unittest
56+
env:
57+
KMP_DUPLICATE_LIB_OK: "TRUE"
58+
OBJC_DISABLE_INITIALIZE_FORK_SAFETY: "YES"
59+
run: |
60+
python3 -m coverage run -m pytest -s --log-cli-level=DEBUG
61+
echo "Done test. Start combining coverage report"
62+
python3 -m coverage combine
63+
echo "Done combine coverage report. Showing it out"
64+
python3 -m coverage report
65+
66+
- name: Upload coverage report
67+
run: codecov

.github/workflows/release_pypi.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "*.*.*"
7+
8+
jobs:
9+
# This workflow contains a single job called "build"
10+
build:
11+
runs-on: ubuntu-latest
12+
if: "!contains(github.event.head_commit.message, 'release_pypi skip')"
13+
14+
# Steps represent a sequence of tasks that will be executed as part of the job
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: 3.8
23+
24+
- name: Build wheel
25+
run: |
26+
python3 setup.py bdist_wheel
27+
python3 setup.py sdist
28+
29+
- name: Publish package
30+
uses: pypa/gh-action-pypi-publish@release/v1
31+
with:
32+
user: __token__
33+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ test/*
1010
**/.DS_Store
1111
htmlcov
1212
.coverage
13-
.coverage.*
13+
.coverage.*
14+
scripts

.travis.yml

Lines changed: 0 additions & 149 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
[![PyPI version](https://badge.fury.io/py/mlchain.svg)](https://badge.fury.io/py/mlchain)
1717
[![Downloads](https://pepy.tech/badge/mlchain)](https://pepy.tech/project/mlchain)
18-
[![Build Status](https://travis-ci.org/Techainer/mlchain-python.svg?branch=master)](https://travis-ci.org/Techainer/mlchain-python)
18+
[![CI](https://github.com/Techainer/mlchain-python/actions/workflows/ci.yml/badge.svg)](https://github.com/Techainer/mlchain-python/actions/workflows/ci.yml)
1919
[![codecov](https://codecov.io/gh/Techainer/mlchain-python/branch/master/graph/badge.svg)](https://codecov.io/gh/Techainer/mlchain-python)
2020
[![Documentation Status](https://readthedocs.org/projects/mlchain/badge/?version=latest)](https://mlchain.readthedocs.io/en/latest/?badge=latest)
2121
[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/Techainer/mlchain-python/blob/master/LICENSE)

docs/3_Concepts/1_Server.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ gunicorn: # config gunicorn wrapper
8080
max_requests: 0 # The maximum number of requests a worker will process before restarting.
8181
threads: 1 # number of threads
8282
worker_class: 'gthread'
83-
umask: '0'# A bit mask for the file mode on files written by Gunicorn.
8483
```
8584
8685
Let's go through each option and see what each one does:
@@ -122,8 +121,6 @@ Wrapper for server.
122121
- <b> max_requests:</b> The maximum number of requests a worker will process before restarting.
123122
- <b> threads:</b> The number of worker threads for handling requests.
124123
- <b> worker_class:</b> The type of workers to use.
125-
- <b> umask:</b> A bit mask for the file mode on files written by Gunicorn.
126-
127124

128125
When you are done configurating, run
129126

docs/4_Tutorials/2_Keras.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ name: Fashion-MNIST classifier # name of service
275275
entry_file: main.py # python file contains object ServeModel
276276
host: localhost # host service
277277
port: 5000 # port service
278-
server: flask # option flask or quart or grpc
279-
wrapper: None # option None or gunicorn or hypercorn
278+
server: flask # option flask or starlette or grpc
279+
wrapper: None # option None or gunicorn
280280
cors: true
281281
dump_request: None # None or path folder log request
282282
version: '1.0.0'
@@ -289,11 +289,6 @@ gunicorn: # config apm-server if uses gunicorn wrapper
289289
max_requests: 0
290290
threads: 10
291291
worker_class: 'gthread'
292-
umask: '0'
293-
hypercorn: # config apm-server if uses hypercorn wrapper
294-
keep_alive_timeout: 60
295-
worker_class: 'asyncio'
296-
umask: 0
297292

298293
mode:
299294
default: dev # running mode

docs/Model Deployment/mlconfig.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ gunicorn: # config apm-server if uses gunicorn wrapper
3030
max_requests: 0
3131
threads: 1
3232
worker_class: 'gthread'
33-
umask: '0'
3433
```
3534
3635
You can also override the arguments in `mlchain run` command to quickly test out a change. For example:

docs/Model Deployment/tutorial.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ gunicorn: # config apm-server if uses gunicorn wrapper
177177
max_requests: 0
178178
threads: 1
179179
worker_class: 'gthread'
180-
umask: '0'
181180
```
182181

183182
[(Optional) Learn more about mlconfig file](../Model Deployment/mlconfig.md)

docs/commands/init.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ name: mlchain-server # name of service
2828
entry_file: server.py # python file contains object ServeModel
2929
host: localhost # host service
3030
port: 2222 # port service
31-
server: flask # option flask or quart or grpc
31+
server: flask # option flask or starlette or grpc
3232
trace: False # option True or False
3333
queue: None # option None or rabbit or redis
34-
wrapper: None # option None or gunicorn or hypercorn
34+
wrapper: None # option None or gunicorn
3535
log: False # rate samples log
3636
monitor_sampling_rate: 1.0
3737
cors: true
@@ -49,11 +49,6 @@ gunicorn: # config apm-server if uses gunicorn wrapper
4949
max_requests: 0
5050
threads: 1
5151
worker_class: 'gthread'
52-
umask: '0'
53-
hypercorn: # config apm-server if uses hypercorn wrapper
54-
keep_alive_timeout: 60
55-
worker_class: 'asyncio'
56-
umask: 0
5752

5853
elastic_apm: # config apm-server if uses trace
5954
server_url: 'http://localhost:8200' # if None read from environ ELASTIC_APM_SERVER_URL

0 commit comments

Comments
 (0)