Skip to content

Commit d304ccc

Browse files
ckadnerrafvasqkrishnakumar27dependabot[bot]shanmukha1996
authored
Update v0.2.0 branch (#365)
* Add dev doc links to CONTRIBUTING.md (#312) Resolves a task from #304 Signed-off-by: Rafael Vasquez <[email protected]> * Fixes the references to latest kfctl release (#311) Resolves a task from #304 Signed-off-by: Rafael Vasquez <[email protected]> * Do not verify links in project dependencies (#320) Resolves #319 Signed-off-by: Christian Kadner <[email protected]> * Add navigation and description table of docs (#314) * Create readme for docs * Add description table to readme * Add links to table * update relative links * Change documentation to document Signed-off-by: Rafael Vasquez <[email protected]> * Add script to update the docs table (#317) Signed-off-by: Rafael Vasquez <[email protected]> * Modified the way sed version is set (#315) Instead of checking the operating system or shell emulator, test which version of `sed` is actually installed in the local environment. Resolves #301 Signed-off-by: Krishna Kumar <[email protected]> * Bump waitress from 2.0.0 to 2.1.1 in /api/server (#321) Bumps [waitress](https://github.com/Pylons/waitress) from 2.0.0 to 2.1.1. - [Release notes](https://github.com/Pylons/waitress/releases) - [Changelog](https://github.com/Pylons/waitress/blob/master/CHANGES.txt) - [Commits](Pylons/waitress@v2.0.0...v2.1.1) --- updated-dependencies: - dependency-name: waitress dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump jupyter-server from 1.13.4 to 1.15.4 in /api/server (#324) Bumps [jupyter-server](https://github.com/jupyter/jupyter_server) from 1.13.4 to 1.15.4. - [Release notes](https://github.com/jupyter/jupyter_server/releases) - [Changelog](https://github.com/jupyter-server/jupyter_server/blob/main/CHANGELOG.md) - [Commits](jupyter-server/jupyter_server@v1.13.4...v1.15.4) --- updated-dependencies: - dependency-name: jupyter-server dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump minimist from 1.2.5 to 1.2.6 in /dashboard/origin-mlx (#326) Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump notebook from 6.4.8 to 6.4.10 in /api/server (#327) Bumps [notebook](http://jupyter.org) from 6.4.8 to 6.4.10. --- updated-dependencies: - dependency-name: notebook dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update API developer docs (#325) * Add codegen workflow diagram * Describe codegen workflow * Describe API server package modules Closes #325 Signed-off-by: Pavan Pss <[email protected]> Co-authored-by: Christian Kadner <[email protected]> * Update UI developer docs (#323) Closes #323 Signed-off-by: RRM123 <[email protected]> * Correct description for make update_doc_table (#329) Signed-off-by: ezinneanne <[email protected]> * Update Kubernetes high version in deployment docs (#318) (#332) * Add Troubleshooting section * Limit K8s version for KIND cluster using `--image` flag Resolves #318 Signed-off-by: Kiran-Patel <[email protected]> Signed-off-by: Kiran Patel [email protected] Signed-off-by: Christian Kadner <[email protected]> Co-authored-by: Kiran-Patel <[email protected]> Co-authored-by: Christian Kadner <[email protected]> * fix errors in mlx-ui startup (#338) * Run mlx-ui as non-root user (#339) Closes #337 Signed-off-by: Christian Kadner <[email protected]> * Update MLX setup instructions for KF 1.5 (#346) * Update MLX setup instructions for KF 1.5 Signed-off-by: Christian Kadner <[email protected]> * fix selected assets show up in different menus (#342) Signed-off-by: Jiaxuan-Yang <[email protected]> * Consolidate readme (#356) Signed-off-by: Rafael Vasquez <[email protected]> Signed-off-by: Rafael Vasquez <[email protected]> Co-authored-by: Rafael Vasquez <[email protected]> * Document MLX Models Workshop (#352) Signed-off-by: Christian Kadner <[email protected]> * Add GitHub action to verify doc links (#357) Signed-off-by: Rafael Vasquez <[email protected]> Signed-off-by: Rafael Vasquez <[email protected]> Signed-off-by: Christian Kadner <[email protected]> Signed-off-by: Krishna Kumar <[email protected]> Signed-off-by: RRM123 <[email protected]> Signed-off-by: ezinneanne <[email protected]> Signed-off-by: Jiaxuan-Yang <[email protected]> Signed-off-by: Rafael Vasquez <[email protected]> Co-authored-by: Rafael Vasquez <[email protected]> Co-authored-by: Krishna Kumar Ramachandran <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Pavan Pss <[email protected]> Co-authored-by: RRM123 <[email protected]> Co-authored-by: Ezinne Anne Emilia <[email protected]> Co-authored-by: Kiran Patel <[email protected]> Co-authored-by: Kiran-Patel <[email protected]> Co-authored-by: jbusche <[email protected]> Co-authored-by: Joanna <[email protected]> Co-authored-by: Rafael Vasquez <[email protected]>
1 parent e9f95ee commit d304ccc

36 files changed

+6633
-3392
lines changed

.github/workflows/verify-links.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2021 The MLX Contributors
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Verify Links
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
tags:
13+
- v*
14+
15+
pull_request:
16+
17+
jobs:
18+
check-links:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
python-version: [3.7]
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: Install dependencies
33+
run: pip install requests
34+
35+
- name: Link check
36+
run: |
37+
./tools/python/verify_doc_links.py
38+

CONTRIBUTING.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ maintainers of each component affected.
3232

3333
For a list of the maintainers, see the [MAINTAINERS.md](MAINTAINERS.md) page.
3434

35+
## Getting Started
36+
37+
**MLX Dashboard Web UI**
38+
- Information regarding configuration, deployment, and development setup can be found [here](https://github.com/machine-learning-exchange/mlx/blob/main/dashboard/origin-mlx/README.md).
39+
40+
**MLX API**
41+
- Quickstart and development setup documentation can be found [here](https://github.com/machine-learning-exchange/mlx/tree/main/api).
42+
3543
## Legal
3644

3745
Each source file must include a license header for the Apache
@@ -72,14 +80,6 @@ git commit -s
7280
## Communication
7381
Please feel free to connect with us on our [Slack channel](https://lfaifoundation.slack.com/archives/C0264LKNH63).
7482

75-
## Setup
76-
**FIXME** Please add any special setup instructions for your project to help the developer
77-
become productive quickly.
78-
79-
## Testing
80-
**FIXME** Please provide information that helps the developer test any changes they make
81-
before submitting.
82-
8383
## Coding style guidelines
8484
**FIXME** Optional, but recommended: please share any specific style guidelines you might
8585
have for your project.

Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ check_doc_links: ## Check markdown files for invalid links
2626
@python3 tools/python/verify_doc_links.py
2727
@echo "$@: OK"
2828

29+
.PHONY: update_doc_table
30+
update_doc_table: ## Regenerate the /docs/README.md file
31+
@python3 tools/python/update_doc_table.py
32+
@echo "$@: OK"
33+
2934
.PHONY: check_license
3035
check_license: ## Make sure source files have license header
3136
@git grep -L "SPDX-License-Identifier: Apache-2.0" -- *.py *.yml *.yaml *.sh *.html *.js *.css *.ts *.tsx ':!*.bundle.js' | \

README.md

+15-16
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ Allows upload, registration, execution, and deployment of:
1313
- Datasets
1414
- Notebooks
1515

16-
For more details about the project please follow this [announcement blog post](https://lfaidata.foundation/blog/2021/09/28/machine-learning-exchange-mlx/).
17-
18-
19-
<img src="docs/images/mlx.png" height="90%" width="90%">
20-
2116
Additionally it provides:
2217

2318
- Automated sample pipeline code generation to execute registered models, datasets and notebooks
@@ -28,6 +23,12 @@ Additionally it provides:
2823
- Serving engine by [KFServing](https://github.com/kubeflow/kfserving)
2924
- Model Metadata schemas
3025

26+
For more details about the project check out this [announcement blog post](https://lfaidata.foundation/blog/2021/09/28/machine-learning-exchange-mlx/).
27+
28+
29+
<img src="docs/images/mlx.png" height="90%" width="90%">
30+
31+
3132
## 1. Deployment
3233
<img src="docs/images/mlx-architecture-4.png" height="40%" width="40%">
3334

@@ -48,30 +49,28 @@ For a full deployment, we use [Kubeflow Kfctl](https://github.com/kubeflow/kfctl
4849
* #### [MLX on an existing Kubeflow Cluster](./docs/install-mlx-on-kubeflow.md)
4950

5051

51-
## 2. Access the MLX UI
52+
## 2. Access the MLX UI and import Assets to the Catalog
5253

5354
By default, the MLX UI is available at http://<cluster_node_ip>:30380/mlx/
5455

55-
If you deployed on a **Kubernetes** cluster, run the following and look for the External-IP column to find the public IP of a node.
56+
If you deployed on a **Kubernetes** cluster or using **OpenShift**, run the following and look for the External-IP column to find the public IP of a node.
5657

5758
```bash
5859
kubectl get node -o wide
5960
```
6061

61-
If you deployed using **OpenShift**, you can use IstioIngresGateway Route. You can find it in the OpenShift Console or using the CLI.
62+
For information on how to import data and AI assets using MLX's catalog importer, use this [guide](/docs/import-assets.md).
6263

63-
```bash
64-
oc get route -n istio-system
65-
```
64+
## 3. Use MLX
6665

67-
## 3. Import Data and AI Assets in MLX Catalog
66+
For information on how to use MLX and create assets check out this [guide](/docs/usage-steps.md).
6867

69-
[Import data and AI assets using MLX's catalog importer](/docs/import-assets.md)
68+
## 4. How to Contribute
69+
70+
For information about adding new features, bug fixing, communication
71+
or UI and API setup, refer to this [document](CONTRIBUTING.md).
7072

71-
## 4. Use MLX
7273

73-
[MLX Usage Instructions](/docs/usage-steps.md)
74-
7574
## 5. Troubleshooting
7675

7776
[MLX Troubleshooting Instructions](/docs/troubleshooting.md)

api/README.md

+60-16
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,59 @@
1-
# Machine Learning Exchange API - Python Client and Python-Flask Server
1+
# MLX API - Python Client and Python-Flask Server
22

3-
An extension to the Kubeflow Pipeline API for Components and Models
3+
The MLX API is an extension to the Kubeflow Pipeline API with additional API
4+
endpoints for Dataset, Models, Notebooks and Pipeline Components.
5+
We use [OpenAPI v2 (fka Swagger)](https://swagger.io/specification/v2/) for the
6+
[API specification](swagger/swagger.yaml).
47

5-
---
68

7-
# Quickstart
9+
# Deploy to Kubernetes
810

9-
## Deploy to Kubernetes
11+
If you already have a Kubeflow Pipelines deployment on a Kubernetes cluster, you
12+
can use the following steps to deploy the MLX API on top of it. However, for a full
13+
deployment of MLX we recommend following on of these [guides](../README.md#1-deployment)
1014

11-
kubectl apply -f ./server/mlx-api.yml
15+
1) Run kubectl command to apply the manifest
1216

13-
## Find API Server Host and Port
17+
`kubectl apply -f ./server/mlx-api.yml`
1418

15-
export API_HOST=$(kubectl get nodes -o jsonpath='{.items[].status.addresses[?(@.type=="ExternalIP")].address}')
16-
export API_PORT=$(kubectl get service mlx-api -n kubeflow -o jsonpath='{.spec.ports[0].nodePort}')
19+
2) Find API Server Host and Port
1720

18-
## Open the Swagger UI in a Web Browser
21+
`export API_HOST=$(kubectl get nodes -o jsonpath='{.items[].status.addresses[?(@.type=="ExternalIP")].address}')`
22+
`export API_PORT=$(kubectl get service mlx-api -n kubeflow -o jsonpath='{.spec.ports[0].nodePort}')`
1923

20-
open "http://${API_HOST}:${API_PORT}/apis/v1alpha1/ui/"
24+
3) Open the Swagger UI in a Web Browser
25+
26+
`open "http://${API_HOST}:${API_PORT}/apis/v1alpha1/ui/" `
2127

28+
2229
---
2330

24-
# Development Setup
31+
# API Development
32+
33+
## Code Generation Overview
34+
35+
![API Codegeneration Workflow](codegen_workflow.png)
36+
37+
- Changes/additions to the API are done in the API [spec](swagger/swagger.yaml)
38+
- The [`generate_code.sh`](generate_code.sh) script validates the API [spec](swagger/swagger.yaml)
39+
and generates [`client`](client) and [`server`](server) Python packages.
40+
The [examples](examples) package is hand-written based on the usage examples
41+
inside the `client` package
42+
- Instead of a static HTML documentation for the API endpoints, a Swagger UI web
43+
interface will be generated on the fly when the Python server is started
44+
- The API endpoints and the JSON data model is documented under [`client/docs`](client/docs)
45+
in Markdown format which works well when browsing through the GitHub repo
46+
- After the code generation, we need to copy any new API method stubs (if any new)
47+
from the [`server/swagger_server/controllers`](server/swagger_server/controllers) folder
48+
to the [`server/swagger_server/controllers_impl`](server/swagger_server/controllers_impl)
49+
folder and implement the actual business logic
50+
- If existing API method signatures got updated, we need to update the existing
51+
`controller_impl` methods respectively
52+
2553

26-
## Swagger Codegen 2.4
54+
## Development Setup
55+
56+
### Swagger Codegen 2.4
2757

2858
To generate our API we are using [`swagger-codegen`](https://github.com/swagger-api/swagger-codegen/tree/v2.4.8#prerequisites)
2959
version [`2.4`](https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.8/swagger-codegen-cli-2.4.8.jar)
@@ -48,20 +78,29 @@ will automatically download the _"correct"_ version of the `swagger-codegen-cli.
4878
# brew install swagger-codegen@2
4979
# brew link --force swagger-codegen@2
5080

51-
## Create a Python Virtual Environment for Development
81+
### Create a Python Virtual Environment for Development
5282

5383
python3 -m venv .venv
5484
source .venv/bin/activate
5585

56-
## Install the Python Package Dependencies
86+
### Install the Python Package Dependencies
5787

5888
# cd <mlx_root_dir>
5989
# cd api
6090

6191
pip install -r ./requirements.txt
6292

93+
94+
6395
## (Re-)Generate Swagger Client and Server Code
6496

97+
If there are changes to the [API spec](swagger/swagger.yaml) then we need to re-
98+
generate the API client and server code. Do not run the script `codegen.sh`
99+
on its own, since Swagger generates a lot of unwanted and some breaking changes.
100+
Instead use the [generate_code.sh](generate_code.sh) script which runs the Swagger
101+
codegen and tries to undo some of the code and documentation changes that are not
102+
desired.
103+
65104
./generate_code.sh
66105

67106
## Build the Docker Image
@@ -86,7 +125,8 @@ or:
86125
kubectl delete -f ./server/mlx-api.yml
87126
kubectl apply -f ./server/mlx-api.yml
88127

89-
## Testing API Code Changes with Docker Compose
128+
129+
## Testing API Code Changes Locally with Docker Compose
90130

91131
You can test most code changes without a Kubernetes cluster. A K8s cluster is only
92132
required to `run` the generated sample pipeline code. Running the Quickstart with
@@ -189,3 +229,7 @@ Docker Compose stack with the `-v` option (`docker compose --project-name no_api
189229
-d @catalog_upload.json \
190230
http://localhost:8080/apis/v1alpha1/catalog
191231

232+
# Troubleshooting
233+
234+
Report any issues with at https://github.com/machine-learning-exchange/mlx/issues
235+

api/codegen.sh

+6-11
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,13 @@ swagger-codegen generate -i swagger/swagger.yaml -l python-flask -o server 2>&1
4444
# set interactive mode to enable defining a gsed alias
4545
shopt -s expand_aliases
4646

47-
# we use sed to make in-file text replacements, but sed works differently on macOS and Linux
48-
if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux
49-
alias gsed="sed -i"
50-
elif [[ "$OSTYPE" == "darwin"* ]]; then # macOS
51-
alias gsed="sed -i ''"
52-
elif [[ "$OSTYPE" == "cygwin" ]]; then # POSIX compatible emulation for Windows
53-
alias gsed="sed -i"
54-
elif [[ "$OSTYPE" == "msys"* ]]; then # Git Bash (Windows)
55-
alias gsed="sed -i"
47+
# we use sed to make in-file text replacements, but sed works differently depending on the version
48+
if ! sed -i '1s/^/test/' $(mktemp) 2> /dev/null; then
49+
# macOS (BSD) version of sed
50+
alias gsed="sed -i ''"
5651
else
57-
echo "FAILED. OS not compatible with script '${BASH_SOURCE[0]}'"
58-
exit 1
52+
# POSIX compliant version of sed
53+
alias gsed="sed -i"
5954
fi
6055
export gsed
6156

api/codegen_workflow.png

30.6 KB
Loading

api/server/README.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
1-
# Swagger generated server
1+
# MLX API Server
22

33
## Overview
4-
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen)
4+
5+
The MLX API server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen)
56
project. By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote
67
server, you can easily generate a server stub. This is an example of building a Swagger-enabled
78
Flask server.
89

910
This example uses the [Connexion](https://github.com/zalando/connexion) library on top of Flask.
1011

12+
## MLX API Server Modules
13+
14+
| Python package/script | Purpose |
15+
| ------------- | ------------- |
16+
| `code_templates` | Code templates are used to generate sample Kubeflow pipeline DSL scripts for each asset type |
17+
| `controllers` | Controllers are the code stubs (“interfaces”) for the API endpoints generated by Swagger |
18+
| `controllers_impl` | Controller implementation of the generated API code stubs (“interfaces”), originally copied from respective controller and then filled in with the actual business logic. API calls get forwarded from the `controllers` to the `controllers_impl` by injection of some code magic in `util.py` (see `codegen.sh`) |
19+
| `data_access` | Contains 2 clients - MySQL (relational database) and Minio (object storage) for data access |
20+
| `gateways` | Connects the API server to various services on the Kubernetes cluster like KFServing, Kubeflow Pipelines, and the Kubernetes API |
21+
| `models` | Swagger generated API classes used to transfer data between API client and API server |
22+
| `encoder.py` | Implementation of JSON encoder (generated by Swagger) |
23+
| `util.py` | Collection of helper functions, most notably to “glue” the API `controllers` code stubs to the `controllers_impl` API implementations |
24+
1125
## Requirements
26+
1227
Python 3.6.1+
1328

1429
## Usage
@@ -33,6 +48,7 @@ http://localhost:8080/apis/v1alpha1/swagger.json
3348
```
3449

3550
To launch the integration tests, use tox:
51+
3652
```
3753
sudo pip install tox
3854
tox

api/server/requirements.txt

+5-12
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ ansiwrap==0.8.4
1414
# via papermill
1515
anyio==3.5.0
1616
# via jupyter-server
17-
appnope==0.1.2
18-
# via
19-
# ipykernel
20-
# ipython
2117
argon2-cffi==21.3.0
2218
# via
2319
# jupyter-server
@@ -188,10 +184,7 @@ ipython==8.0.1
188184
# ipykernel
189185
# jupyterlab
190186
ipython-genutils==0.2.0
191-
# via
192-
# jupyter-server
193-
# nbformat
194-
# notebook
187+
# via notebook
195188
isodate==0.6.1
196189
# via openapi-schema-validator
197190
isort==5.10.1
@@ -244,7 +237,7 @@ jupyter-lsp==1.5.1
244237
# via jupyterlab-lsp
245238
jupyter-resource-usage==0.6.1
246239
# via elyra-server
247-
jupyter-server==1.13.4
240+
jupyter-server==1.15.4
248241
# via
249242
# elyra-server
250243
# jupyter-lsp
@@ -327,7 +320,7 @@ nbdime==3.1.1
327320
# via
328321
# elyra-server
329322
# jupyterlab-git
330-
nbformat==5.1.3
323+
nbformat==5.2.0
331324
# via
332325
# elyra-server
333326
# jupyter-server
@@ -345,7 +338,7 @@ nest-asyncio==1.5.4
345338
# notebook
346339
networkx==2.6.3
347340
# via elyra-server
348-
notebook==6.4.8
341+
notebook==6.4.10
349342
# via nbclassic
350343
numpy==1.22.1
351344
# via
@@ -612,7 +605,7 @@ urllib3==1.26.8
612605
# kubernetes
613606
# minio
614607
# requests
615-
waitress==2.0.0
608+
waitress==2.1.1
616609
# via -r requirements.in
617610
watchdog==2.1.6
618611
# via elyra-server

0 commit comments

Comments
 (0)