LMCache / LMCache/LMCache

[good-first-issue] storage: convert PD backend logging to %-format

Open Beginner friendly
#5,195 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue help wanted
Dominant language
Python
Stars
11.9k
Forks
1.9k
Avg merge
4d 4h
Merged PRs (30d)
141

Description

Follow-up for #5118 after #5125.

#5125 enabled Ruff `G004` repo-wide and added temporary `per-file-ignores` for the files/directories that still build logging messages with f-strings. This issue is one small slice of that cleanup queue.

Claiming: please comment `/claim` and wait for assignment so we avoid duplicate PRs.

## Scope

Convert only the logging f-strings in:

- `lmcache/v1/storage_backend/pd_backend.py` (6 G004 findings)
- `lmcache/v1/storage_backend/pd_backend_async.py` (3 G004 findings)

Counts above were measured on `dev` at `dd5dfca` with `ruff check --isolated --select G004`.

## Expected change

- Replace logging f-strings with lazy `%`-style logging arguments, for example `logger.info("loaded %s tokens", num_tokens)`.
- Preserve the rendered log text and behavior.
- Do not change non-logging f-strings or unrelated control flow.
- Remove the matching `G004` ignore entry/entries from `pyproject.toml` once the listed paths are clean.

Matching ignore entry/entries:

- `"lmcache/v1/storage_backend/pd_backend.py" = ["G004"]`
- `"lmcache/v1/storage_backend/pd_backend_async.py" = ["G004"]`

For a `**` directory ignore, delete the directory entry only when the whole listed directory is clean. If a merge conflict leaves other unmigrated files in that ignored directory, replace the broad `**` entry with explicit file-level entries for the leftovers.

## Verification

```bash
ruff check --isolated --select G004 lmcache/v1/storage_backend/pd_backend.py lmcache/v1/storage_backend/pd_backend_async.py
ruff check --select G004 lmcache/v1/storage_backend/pd_backend.py lmcache/v1/storage_backend/pd_backend_async.py pyproject.toml
pre-commit run --all-files
```

The first command should report zero findings after the cleanup. The second command verifies the repo config still passes after removing the ignore entry/entries.

Refs #5118
Refs #3372
Refs #5125

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the six G004 findings in lmcache/v1/storage_backend/pd_backend.py and the three findings in lmcache/v1/storage_backend/pd_backend_async.py, then inspect their matching G004 entries in pyproject.toml. Convert only logging f-strings to lazy %-style arguments while preserving rendered text. Run the two specified Ruff checks and pre-commit; done means zero G004 findings and passing checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.