Skip to content

Latest commit

 

History

History
203 lines (191 loc) · 5.85 KB

README.md

File metadata and controls

203 lines (191 loc) · 5.85 KB

MLAppDeploy

Machine Learning Application Deployment Tool by Kubernetes

Docker Image CI

Environment Installation

1. Install MLAppDeploy Environment

You need docker to use MLAD.

$ bash get-env

Install MLAD environments as master node.

$ bash get-env install

You can install MLAD environments as worker node with generated token.

# on master node
$ bash get-env join-token
Generated Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6I...

To add a worker to this cluster, run the following command in 30-mins :
$ bash get-env install --join-token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6I...

# on worker node
$ bash get-env install --join-token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6I...

⚠ Deploy Released API-Server by Helm Charts [View Page]

Frontend Installation

1. Install Virtual Environment

$ sudo apt install -y python3-virtualenv
$ python3 -m virtualenv -p python3 <EnvDir>

2. Enable Virtual Environment

$ source <EnvDir>/bin/activate # Enable
(EnvDir) $ deactivate          # Disable (Optional)

3. Install Python FrontEnd

(EnvDir) $ cd python
(EnvDir) $ python setup.py install

How to use MLAD Project

1. Initialize Configuration

(EnvDir) $ mlad config add
MLAppDeploy Service Address [http://localhost:8440]:
MLAppDeploy User Token:
Docker Registry Host [docker.io]:

1-1. Set User Token

Ask administrator for your user token and login with the token.

(EnvDir) $ mlad login
User Token: <user token>

If you want to initialize the token, you can logout.

(EnvDir) $ mlad logout

1-2. Connect External MinIO(S3 Compatible Storage) and Private Docker Registry (Optional)

If you want to connect to your S3 storage and registry, you can attach to external those by modify configurations.

(EnvDir) $ mlad config set s3.endpoint=s3.amazonaws.com # Change S3 endpoint
(EnvDir) $ mlad config get                              # Show current configuration

2. Generate Project File

(EnvDir) $ cd <YOUR PROJECT DIR>
(EnvDir) $ mlad project init
Project Name : <Enter Your Project Name>

3. Customize Project File

Customize project file(mlad-project.yml).

4. Build Project Image

(EnvDir) $ mlad build

5. Deploy Services on MLAppDeploy

(EnvDir) $ mlad up                # Deploy whole services in project.
(EnvDir) $ mlad up <services...>  # Deploy services in project partialy.

6. Down Service from MLAppDeploy

(EnvDir) $ mlad down                # Down whole services in project.
(EnvDir) $ mlad down --no-dump      # Do not save service logs before down.
(EnvDir) $ mlad down <services...>  # Down services in project partialy.

7. Show Logs

(EnvDir) $ mlad logs                # Show logs til now.
(EnvDir) $ mlad logs -f             # Show logs with follow.
(EnvDir) $ mlad logs -t             # Show logs with timestamp.
(EnvDir) $ mlad logs <service name> # show logs filtered by service name.

8. Show Running Service in Project

(EnvDir) $ cd <YOUR PROJECT DIR>
(EnvDir) $ mlad ps      # Show running services in project.
(EnvDir) $ mlad ps -a   # Show all services in project

9. Show All Deployed Project

(EnvDir) $ mlad ls

10. And so on.

You can show more information by below command.

(EnvDir) $ mlad --help

How to use MLAD Plugin

1. Initialize Configuration

Same as project.

2. Generate Plugin Project File

(EnvDir) $ cd <YOUR Plugin PROJECT DIR>
(EnvDir) $ mlad plugin init
Project Name : <Enter Your Project Name>

3. Customize Project File

Customize project file(mlad-plugin.yml).

4. Install Plugin

(EnvDir) $ TODO

Appendix

Node labeling and constraints

Add label to node.

(EnvDir) $ mlad node label [ID or HOSTNAME] add [KEY]=[VALUE]

Modify constraints at your project file.

...
services:
  ...
  service-name:
    ...
    deploy:
      ...
      constraints:
        ...
        labels.[KEY]: [VALUE]

Example

Labeling.

(EnvDir) $ mlad node ls
ID          HOSTNAME        ADDRESS       ROLE     STATE  AVAILABILITY  ENGINE    LABELS
abcdef0001  operator-node   192.168.65.1  Manager  Ready  Active        19.03.13
abcdef0002  learner-node    192.168.65.2  Worker   Ready  Active        19.03.13
abcdef0003  actor-node-01   192.168.65.3  Worker   Ready  Active        19.03.13
abcdef0004  actor-node-02   192.168.65.4  Worker   Ready  Active        19.03.13
abcdef0005  actor-node-03   192.168.65.5  Worker   Ready  Active        19.03.13
(EnvDir) $ mlad node label actor-node-01 add type=actor
Added.
(EnvDir) $ mlad node label actor-node-02 add type=actor
Added.
(EnvDir) $ mlad node label actor-node-03 add type=actor
Added.
(EnvDir) $ mlad node ls
ID          HOSTNAME        ADDRESS       ROLE     STATE  AVAILABILITY  ENGINE    LABELS
abcdef0001  operator-node   192.168.65.1  Manager  Ready  Active        19.03.13
abcdef0002  learner-node    192.168.65.2  Worker   Ready  Active        19.03.13
abcdef0003  actor-node-01   192.168.65.3  Worker   Ready  Active        19.03.13  type=actor
abcdef0004  actor-node-02   192.168.65.4  Worker   Ready  Active        19.03.13  type=actor
abcdef0005  actor-node-03   192.168.65.5  Worker   Ready  Active        19.03.13  type=actor

Modifying project file.

...
services:
  operator:
    ...
    ports: [6666]
    deploy:
      constraints:
        hostname: operator-node
  learner:
    ...
    ports: [6666]
    deploy:
      constraints:
        hostname: learner-node

  actor:
    ...
    ports: [6666]
    deploy:
      constraints:
        labels.type: actor
      replicas: 10