Skip to content

Fix/tiling shm#7

Draft
kisside wants to merge 5 commits into
masterfrom
fix/tiling-shm
Draft

Fix/tiling shm#7
kisside wants to merge 5 commits into
masterfrom
fix/tiling-shm

Conversation

@kisside

@kisside kisside commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4f225998-84a8-49ca-8b04-36fe6d21fa35

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tiling-shm

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@gemini-code-assist

Copy link
Copy Markdown

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 focuses on optimizing the tiling preprocessing pipeline by refining resource allocation and introducing materialization steps to improve stability and performance. Additionally, it updates project dependencies to align with newer versions of key libraries, ensuring better compatibility and functionality across the data processing workflow.

Highlights

  • Performance Optimization: Adjusted CPU and memory allocations for tiling operations to improve efficiency and prevent resource starvation.
  • Pipeline Robustness: Introduced explicit materialization points in the tiling pipeline to manage streaming backpressure and ensure consistent data processing.
  • Dependency Updates: Updated several core dependencies, including rationai-mlkit and ratiopath, and added new packages to support updated MLflow and data processing requirements.
  • Resource Configuration: Increased CPU and memory limits, and added shared memory (shm) configuration for the tiling script to handle larger workloads.
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.

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.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request optimizes the tiling pipeline by introducing materialize() calls to manage memory and backpressure, updating resource allocations, and implementing conditional logic for epithelium overlap computation. It also updates core library dependencies and increases job resource requirements. Feedback was provided regarding the use of the logging module instead of print for better log management and utilizing Ray's add_column method for more efficient constant column addition.

Comment thread preprocessing/tiling.py
Comment on lines +257 to +264
print("[INFO] Computing overlap: epithelium_overlap from epithelium_mask_path")
tiles = add_tile_overlap(
tiles, full_roi, "epithelium_mask_path", "epithelium_overlap", "0"
)
else:
print(
"[INFO] Skipping epithelium overlap: dataset.mlflow_uris.epithelium_masks is not set"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For better logging practices and consistency, it's recommended to use the logging module instead of print for informational messages. This allows for more flexible log level management and redirection.

You would need to add import logging at the top of the file. Then you can change the print statements to logging.info(...).

Comment thread preprocessing/tiling.py
Comment on lines +266 to +271
tiles = tiles.map_batches(
add_missing_epithelium_overlap,
batch_format="pandas",
num_cpus=0.1,
memory=256 * 1024**2,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using map_batches just to add a column with a constant value is less efficient and idiomatic than using add_column. Ray Data's add_column is optimized for this use case and is more readable.

You can replace this map_batches call and the add_missing_epithelium_overlap function (lines 29-31) with a single line:

tiles = tiles.add_column("epithelium_overlap", lambda df: np.nan)

This change would make the code more concise and performant.

        tiles = tiles.add_column("epithelium_overlap", lambda df: np.nan)

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.

1 participant