Skip to content

Model service documentation#3

Open
Jurgee wants to merge 18 commits intomainfrom
docs/model-service
Open

Model service documentation#3
Jurgee wants to merge 18 commits intomainfrom
docs/model-service

Conversation

@Jurgee
Copy link
Collaborator

@Jurgee Jurgee commented Mar 13, 2026

This PR adds and polishes MkDocs documentation for the model-service. Changes:

  • Add/iterate MkDocs documentation (docs/): quick start, architecture overview, deployment guide, configuration reference, adding models, troubleshooting.
  • Align README with the current Ray Serve + KubeRay RayService setup
  • Add docs dependency group in pyproject.toml ([dependency-groups].docs: mkdocs, mkdocs-material, pymdown-extensions).
  • Add GitLab CI job for docs build: .gitlab-ci.ymldocs:build runs mkdocs build --strict.
  • Update mkdocs.yml as needed for the docs site.

Summary by CodeRabbit

Release Notes

  • Documentation

    • Added comprehensive architecture documentation covering system design, request lifecycle, batching, and queueing mechanisms.
    • Added quick-start guide for deploying models on Kubernetes with KubeRay.
    • Added configuration reference and deployment guide for production workflows.
    • Added troubleshooting guide with common issues and remediation steps.
    • Added guide for integrating custom ML models.
    • Restructured README with clearer getting-started instructions and project overview.
  • Chores

    • Updated CI/CD pipeline to include documentation build stage.
    • Added documentation dependencies to project configuration.
    • Configured MkDocs site for centralized documentation.

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 710e41cc-2738-4b1b-975c-a0aa08470c2c

📥 Commits

Reviewing files that changed from the base of the PR and between 6beb06f and 111fac1.

📒 Files selected for processing (14)
  • .gitlab-ci.yml
  • README.md
  • docs/architecture/batching.md
  • docs/architecture/overview.md
  • docs/architecture/queues-and-backpressure.md
  • docs/architecture/request-lifecycle.md
  • docs/get-started/quick-start.md
  • docs/guides/adding-models.md
  • docs/guides/configuration-reference.md
  • docs/guides/deployment-guide.md
  • docs/guides/troubleshooting.md
  • docs/index.md
  • mkdocs.yml
  • pyproject.toml

📝 Walkthrough

Walkthrough

This pull request introduces a comprehensive documentation system for a Ray Serve-based model service on Kubernetes, including architecture guides, deployment workflows, and getting-started resources. The CI/CD pipeline is extended to process documentation builds via MkDocs.

Changes

Cohort / File(s) Summary
CI/CD Pipeline
.gitlab-ci.yml
Added MkDocs.gitlab-ci.yml template to the include list and introduced a new "deploy" stage in the pipeline.
Project README
README.md
Restructured with focus on documentation, quick-start guide (Kubernetes), deployment steps, prerequisites, usage examples, and repository structure. Added concrete commands and references to model deployment patterns.
Documentation - Architecture
docs/architecture/overview.md, docs/architecture/batching.md, docs/architecture/queues-and-backpressure.md, docs/architecture/request-lifecycle.md
Added comprehensive guides covering system architecture, batching mechanisms in Ray Serve, queueing models and backpressure handling, and end-to-end request lifecycle through the stack.
Documentation - Getting Started
docs/get-started/quick-start.md
Added step-by-step quick-start guide for deploying Model Service on Kubernetes with KubeRay, including prerequisites, cloning, deployment, monitoring, and troubleshooting connection issues.
Documentation - Guides
docs/guides/adding-models.md, docs/guides/configuration-reference.md, docs/guides/deployment-guide.md, docs/guides/troubleshooting.md
Added guides for integrating custom models, comprehensive RayService configuration reference with YAML examples, production deployment workflow with multi-model support and rollback procedures, and troubleshooting checklist with common failure modes and remediation steps.
Documentation - Root & Configuration
docs/index.md, mkdocs.yml
Added main documentation index describing Model Service purpose, features, and use cases; configured MkDocs with Material theme, navigation structure, and markdown extensions for documentation rendering.
Project Dependencies
pyproject.toml
Added docs dependency group with mkdocs, mkdocs-material, and pymdown-extensions packages.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Documentation hops along with grace,
Architecture guides in every space,
Quick starts and guides for models to thrive,
Ray Serve wisdom now comes alive!
With MkDocs in place, clarity's won,
The documentation journey has begun! 📚✨

📝 Coding Plan
  • Generate coding plan for human review comments

Note

🎁 Summarized by CodeRabbit Free

The PR author is not assigned a seat. To perform a comprehensive line-by-line review, please assign a seat to the pull request author through the subscription management page by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use TruffleHog to scan for secrets in your code with verification capabilities.

Add a TruffleHog config file (e.g. trufflehog-config.yml, trufflehog.yml) to your project to customize detectors and scanning behavior. The tool runs only when a config file is present.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Model Service's discoverability and usability by introducing a comprehensive, structured documentation portal. The new documentation, built with MkDocs, covers essential aspects from quick deployment to detailed architectural insights and troubleshooting, making it easier for users to understand, deploy, and manage machine learning models. Accompanying these changes are updates to the main README, CI/CD pipelines for documentation validation, and proper dependency management for the documentation tools.

Highlights

  • Comprehensive Documentation: Introduced a new MkDocs-based documentation site covering quick start, architecture, deployment, configuration, adding models, and troubleshooting for the model service.
  • README Update: Rewrote the README.md to align with the current Ray Serve + KubeRay setup and provide a high-level overview and links to the new documentation.
  • CI/CD Integration: Added a GitLab CI job to build and validate the MkDocs documentation, ensuring its integrity.
  • Dependency Management: Introduced a dedicated docs dependency group in pyproject.toml for documentation-related tools.
  • MkDocs Configuration: Configured mkdocs.yml to define the documentation site structure, theme, and navigation.
Changelog
  • .gitlab-ci.yml
    • Included the MkDocs.gitlab-ci.yml template.
    • Added a deploy stage to the CI pipeline.
  • README.md
    • Rewrote the entire content to provide a modern, focused overview of the Model Service.
    • Added sections for documentation links, quick start instructions for Kubernetes, testing the reference model, and repository structure.
    • Removed generic GitLab-generated boilerplate.
  • docs/architecture/batching.md
    • Added a new document explaining Ray Serve's batching mechanism, including its API, internal workings, and tuning.
  • docs/architecture/overview.md
    • Added a new document providing a high-level architectural overview of the Model Service, covering system components, scaling, and fault tolerance.
  • docs/architecture/queues-and-backpressure.md
    • Added a new document detailing Ray Serve's queueing and backpressure mechanisms, explaining proxy-side and replica-side queues.
  • docs/architecture/request-lifecycle.md
    • Added a new document tracing the detailed request lifecycle through the Model Service stack, from client to model execution.
  • docs/get-started/quick-start.md
    • Added a new quick start guide for deploying a sample model on Kubernetes.
  • docs/guides/adding-models.md
    • Added a new guide on how to implement, configure, and deploy new machine learning models.
  • docs/guides/configuration-reference.md
    • Added a new reference document explaining key configuration parameters for RayService, applications, and deployments.
  • docs/guides/deployment-guide.md
    • Added a new comprehensive guide for deploying models to production, including resource planning and best practices.
  • docs/guides/troubleshooting.md
    • Added a new troubleshooting guide addressing common deployment and runtime issues.
  • docs/index.md
    • Added the main landing page for the Model Service documentation, outlining its purpose, features, and content structure.
  • mkdocs.yml
    • Added the MkDocs configuration file, defining the site name, description, repository, theme, navigation structure, and Markdown extensions.
  • pyproject.toml
    • Added a docs dependency group including mkdocs, mkdocs-material, and pymdown-extensions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Jurgee Jurgee marked this pull request as ready for review March 13, 2026 19:48
@Jurgee Jurgee requested review from a team, JakubPekar, Copilot and ejdam87 March 13, 2026 19:48
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces a comprehensive documentation site for the Model Service, covering its architecture, deployment guides, model integration, configuration, and troubleshooting, while also integrating the documentation build process into the CI pipeline. Review comments suggest improving clarity in the README.md regarding kubectl namespace placeholders, completing a placeholder URL in the configuration reference, addressing a potential LaTeX rendering issue in the configuration-reference.md by suggesting a pymdownx.arithmatex extension, resolving a missing JSON curl example in deployment-guide.md, and adding a final newline character to mkdocs.yml for consistency.


## Collaborate with your team
```bash
kubectl apply -f ray-service.yaml -n [namespace]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The [namespace] placeholder is used in several kubectl commands in this README (e.g., lines 37, 38, and 44). For clarity, especially for new users, it would be beneficial to add a note explaining that this needs to be replaced with their target Kubernetes namespace, and provide an example like rationai-notebooks-ns. This is handled well in the docs/get-started/quick-start.md file.

import_path: models.binary_classifier:app
route_prefix: /prostate-classifier
runtime_env:
working_dir: https://.../model-service-master.zip

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The working_dir URL contains a placeholder .... For better usability and consistency with other documentation files (like adding-models.md), it would be better to provide the full, valid URL.

Suggested change
working_dir: https://.../model-service-master.zip
working_dir: https://gitlab.ics.muni.cz/rationai/infrastructure/model-service/-/archive/master/model-service-master.zip

**What it is:** The desired average number of **ongoing (in-flight)** requests per replica. This is the **primary scaling driver**.

**Formula:**
$$ \text{Desired Replicas} = \left\lceil \frac{\text{Total Ongoing Requests}}{\text{target}\_{\text{ongoing}}\_\text{requests}} \right\rceil $$

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This LaTeX formula may not render as a mathematical equation in the generated documentation. To enable math rendering, consider adding the pymdownx.arithmatex extension to your mkdocs.yml configuration. This will allow MkDocs to process and display math formulas correctly using MathJax.

svc/rayservice-my-model-serve-svc 8000:8000
```

The example model in this repository (`models/binary_classifier.py`) uses FastAPI ingress and expects a **compressed binary request body** (LZ4), not JSON. The JSON `curl` example below is valid for JSON-based models but does not apply to `BinaryClassifier`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This sentence mentions a 'JSON curl example below', but no such example is present. This can be confusing for the reader. Please either add the mentioned curl example or remove this sentence.

alternate_style: true
- tables
- toc:
permalink: true No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This file is missing a final newline character. It's a common convention and good practice to end all text files with a single newline.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an MkDocs documentation site for the model-service and updates repository metadata/CI to build the docs alongside the existing Ray Serve + KubeRay RayService setup.

Changes:

  • Adds a new MkDocs site (mkdocs.yml) and a full set of docs pages under docs/ (quick start, guides, architecture).
  • Updates README.md to match the current Ray Serve + KubeRay deployment model and reference model payload format.
  • Adds a docs dependency group to pyproject.toml and updates .gitlab-ci.yml to include the docs build template.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
pyproject.toml Adds a docs dependency group for MkDocs tooling.
mkdocs.yml Introduces MkDocs Material configuration, nav, and Markdown extensions.
docs/index.md Adds the documentation landing page content and navigation pointers.
docs/get-started/quick-start.md Adds a Kubernetes quick start for deploying the RayService.
docs/guides/deployment-guide.md Adds a detailed production deployment guide and ops considerations.
docs/guides/configuration-reference.md Adds a reference for RayService / Serve knobs (autoscaling, backpressure, etc.).
docs/guides/adding-models.md Adds guidance and examples for implementing and integrating models.
docs/guides/troubleshooting.md Adds common failure modes and triage steps for RayService/Serve on K8s.
docs/architecture/overview.md Adds a high-level architecture overview of the stack and scaling model.
docs/architecture/request-lifecycle.md Documents end-to-end request flow and queueing points.
docs/architecture/queues-and-backpressure.md Explains queueing controls (max_queued_requests, max_ongoing_requests).
docs/architecture/batching.md Explains Ray Serve batching behavior and tuning considerations.
README.md Replaces the GitLab template README with repo-specific usage and payload details.
.gitlab-ci.yml Includes the MkDocs CI template and adds a deploy stage for docs build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +33 to +39
# Process data and return prediction
result = self.predict(data)
return {"prediction": result}

def predict(self, data: dict):
# Replace with your own inference logic
return data
Comment on lines +121 to +124
def reconfigure(self, config: Config):
self.threshold = config["threshold"]
self.batch_size = config["batch_size"]
print(f"Reconfigured: threshold={self.threshold}")
Comment on lines +145 to +149
@serve.batch(max_batch_size=32, batch_wait_timeout_s=0.1)
async def predict_batch(self, inputs: list[np.ndarray]):
batch = np.stack(inputs)
outputs = self.model(batch)
return outputs.tolist()
- `name`: logical app name (used in Ray dashboard/logs).
- `import_path`: Python entrypoint (`module.path:variable`).
- `route_prefix`: HTTP path under the Serve gateway.
- `runtime_env`: dynamic environment setup (see [Managing Dependencies](../guides/adding-models.md#6-managing-dependencies)).
Comment on lines +102 to +106
**Formula:**
$$ \text{Desired Replicas} = \left\lceil \frac{\text{Total Ongoing Requests}}{\text{target}\_{\text{ongoing}}\_\text{requests}} \right\rceil $$

**Note:** "Total Ongoing Requests" refers to the **concurrency** (number of requests currently being processed or waiting in the queue), _not_ the Requests Per Second (RPS).

svc/rayservice-my-model-serve-svc 8000:8000
```

The example model in this repository (`models/binary_classifier.py`) uses FastAPI ingress and expects a **compressed binary request body** (LZ4), not JSON. The JSON `curl` example below is valid for JSON-based models but does not apply to `BinaryClassifier`.
Comment on lines +76 to +79
"http://localhost:8000/prostate-classifier-1/",
data=payload,
headers={"Content-Type": "application/octet-stream"},
timeout=60,
Comment on lines +33 to +39
# Process data and return prediction
result = self.predict(data)
return {"prediction": result}

def predict(self, data: dict):
# Replace with your own inference logic
return data
@Jurgee Jurgee self-assigned this Mar 13, 2026
@matejpekar matejpekar removed the request for review from JakubPekar March 13, 2026 23:38
@matejpekar matejpekar requested review from Adames4 and matejpekar and removed request for ejdam87 March 13, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants