How chaitanya1010/operationalize-a-machine-learning-microservice-api works
Main Components
• Flask Application (app.py): Represents the core microservice that accepts API requests and returns predictions.
• Pre-trained Machine Learning Model: Located under model_data (including the joblib file and housing.csv) which is loaded by the Flask app.
• Containerization Layer: Dockerfile and associated shell scripts (run_docker.sh, upload_docker.sh) needed to build and run the app in a container.
• Orchestration Layer: Kubernetes deployment scripts (run_kubernetes.sh) that enable deployment on a Kubernetes cluster.
• CI/CD Pipeline: The .circleci directory with the config.yml file and the status badge in the README indicate a continuous integration process using CircleCI.
• Auxiliary Components: Makefile for project management (setup, install, lint), and additional scripts (make_prediction.sh) that facilitate testing or demonstrations of the application.
Relationships and Interactions
• The Flask Application integrates with the pre-trained model (joblib) for predictions.
• The application is encapsulated within a Docker container, ensuring consistency across environments.
• The Docker container is then deployed to a Kubernetes cluster for orchestration, scaling, and high availability.
• The CI/CD system (CircleCI) executes tests (linting via Makefile commands) and probably builds Docker images as part of the delivery process.
• External clients or API calls interact with the Flask service running in the container, and the data flow from API request to model inference and finally to response is the central process.
Architectural Patterns and Technologies
• Microservice Architecture: Focus on a single service that performs a specific task (model inference) following a single-responsibility principle.
• Containerization and Orchestration: Use of Docker for containerization and Kubernetes for managing containers in production.
• CI/CD Integration: Continuous integration using CircleCI for code quality and deployment automation.
• Flask-based API: Lightweight web framework used to expose a RESTful API.
Elements
• Clear labels for components:
• "Flask App (app.py)"
• "Pre-trained Model & Data (model_data)"
• "Docker Container (built using Dockerfile, run_docker.sh, upload_docker.sh)"
• "Kubernetes Deployment (run_kubernetes.sh)"
• "CI/CD Pipeline (CircleCI: .circleci/config.yml)"
• "Makefile Tasks (setup, install, lint)" representing build and test automation.
• External API Request → Flask app → Model Prediction → API Response.
• Build steps via CircleCI → Docker image build → Kubernetes deployment process.
• Service components (Flask app, prediction engine)
• Infrastructure components (Docker, Kubernetes)
• DevOps and CI elements (Makefile, CircleCI)