# PQOS

`This branch uses the updated model from Oct 2024 (created from the 'deploy' branch)`

The PQOS expects 100 datapoints as input and returns 5 predicted values as a json file:  
{  
    "Predicitons": str_of_5_predictions,  
    "Response time": int (in Seconds)  
}

## Running the code using Docker
1. To create the Docker Image, run "Dockerfile" using this command: `docker build -f Dockerfile -t pqos-deploy-image .`
2. Create a container from the above image using this command: `docker run -p 5000:5000 --name pqos -e ENDPOINT=IP:PORT --rm pqos-deploy-image` where ENDPOINT is the ip address and the port (e.g. 192.168.0.1:5000) to which the results will be sent as a json file expecting the function "/upload_predictions"
3. The script for the PQOS will run automatically, and will await the receival of a dataset from a sender. (See additional notes below)
4. (For testing purposes without an endpoint) In another terminal, enter the command `python3 -m http.server {port_number}` to simulate an endpoint receiving the predictions. This will show a 501 server error given it does not have a backend implementation of an endpoint. 


* **Notes**:
- The `-p` flag is used to map the docker ports to the devices ports.
- The `-e` flag is used to enter command line variables.
- The execution can be stopped by opening another terminal and using this command `docker kill pqos`.
- The "Example files" directory contains a dummy dataset to send to the PQOS for testing purposes. In this case run the pqos_curl.py python script in that same directory. (The IP address to which the dataset should be sent is hardcoded there as it is for testing. The part to edit manually is marked there)
