Simulation of the following mechanisms:
- Event-triggered training, once there are enough data added, automatically start the training job
- Once the trianing is done, the newest model will be deployed to the resting host
- After deployment, traffic is directed to the host with newest model and the old one is now resting
Run docker-compose up --build -d
Run pip3 install -r requirements.txt
Run python3 test/test.py [local_model_path]
to sending post request to the host and print the response.
The local_model_path is an optional argument. If used, the program will also print inference result of given model.
- Run
locust -f test/stress.py -H http://localhost:8080/
- Go to http://localhost:8089/ and you will see the GUI of locust load stress test
- Input your desired number of users and spawn frequency and start the test
Run python3 addData.py [number_of_data]
to add data (data is defined in config.py) to csv file.
The number_of_data is a required argument, it should be either 1 or 2 representing how many data should be added.
If number of new data exceed BATCHSIZE (defined in config.py), this code will automatically retrain and deploy.
In config.py, I have set a variable BATCHSIZE
equals to 2, which means when adding two or more data to the csv, the system will retrain the model. It could be set to any positive integer.
- Docker 20.10.7, docker-compose 1.29.2
- Python 3.8.5
- zsh 5.8
- Model is for predicting house price in Boston. Check this competition on Kaggle.
- For simplicity, basic linear regression model is used.
- Currently this project has no frontend, use test.py to check result instead.