Skip to content

[Feat] [Py]: Add streaming synthetic requests generator#268

Merged
haochengxia merged 8 commits intodevelopfrom
hxia/syn_reqs
Jul 17, 2025
Merged

[Feat] [Py]: Add streaming synthetic requests generator#268
haochengxia merged 8 commits intodevelopfrom
hxia/syn_reqs

Conversation

@haochengxia
Copy link
Copy Markdown
Collaborator

@haochengxia haochengxia commented Jul 16, 2025

@haochengxia haochengxia force-pushed the hxia/syn_reqs branch 3 times, most recently from 007c507 to e6e6511 Compare July 16, 2025 03:37
@haochengxia haochengxia requested a review from Copilot July 16, 2025 03:37

This comment was marked as outdated.

@haochengxia haochengxia requested a review from Copilot July 17, 2025 16:05
@haochengxia haochengxia changed the title [FEAT]: Add streaming synthetic requests generator [Feat] [Py]: Add streaming synthetic requests generator Jul 17, 2025
Copy link
Copy Markdown
Contributor

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 introduces streaming synthetic request generators, updates tests for consistency and pytest integration, and merges test configuration into pyproject.toml. It also extends the C++ bindings and Python stubs to support new generator APIs and additional eviction policies, plus cleans up examples.

  • Add trace_generator.py with Zipf and uniform streaming generators and corresponding tests.
  • Refactor existing tests to remove prints, use pytest.skip/pytest.fail, and consolidate pytest settings into pyproject.toml.
  • Extend C++ bindings (pylibcachesim.cpp) and Python type stubs to export ReqOp, new cache constructors, and additional eviction policy initializers.

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
libCacheSim-python/tests/utils.py Removed explicit "r" mode in open, relying on default text mode
libCacheSim-python/tests/test_unified_interface.py Replaced prints and sys.exit with pytest.skip, removed debug logs
libCacheSim-python/tests/test_trace_generator.py New tests for create_zipf_requests and create_uniform_requests
libCacheSim-python/tests/test_python_hook_cache.py Refactored to use @dataclass test cases, removed manual prints
libCacheSim-python/tests/test_process_trace.py Swapped prints for assertions and pytest.skip, streamlined flow
libCacheSim-python/tests/test_eviction.py Dropped unused imports, replaced error prints with pytest.fail
libCacheSim-python/tests/pytest.ini Removed, settings moved to pyproject.toml
libCacheSim-python/pyproject.toml Merged pytest config, added numpy dependency, updated ruff rules
libCacheSim-python/src/pylibcachesim.cpp Added ReqOp enum, request ctor, new policy init functions, and props
libCacheSim-python/libcachesim/trace_generator.py New module implementing streaming request generators
libCacheSim-python/libcachesim/eviction.py Added classes for LFU, LFUDA, SLRU, Belady, QDLP, LeCaR, Cacheus, WTinyLFU
libCacheSim-python/libcachesim/const.py Removed duplicate import, file now only holds __future__ import
libCacheSim-python/libcachesim/init.pyi Updated stubs for ReqOp, generators, and new eviction policy classes
libCacheSim-python/libcachesim/init.py Updated exports to include new enums, policies, and generator APIs
libCacheSim-python/examples/zipf_trace_example.py New example demonstrating Zipf trace generation and cache usage
libCacheSim-python/examples/stream_request_example.py New example for streaming request generators
libCacheSim-python/examples/python_hook_cache_example.py Updated example to use suppress and adjusted cache size
libCacheSim-python/examples/README.md Documented examples but references a missing file
libCacheSim-python/README.md Updated to include new policies (LFUDA, WTinyLFU, QDLP, LeCaR, Cacheus)
Comments suppressed due to low confidence (4)

libCacheSim-python/examples/README.md:45

  • The examples README references demo_unified_interface.py, which isn't present in the examples directory. Update the filename or add the missing example.
### 2. Unified Interface Demo (`demo_unified_interface.py`)

libCacheSim-python/libcachesim/const.py:1

  • [nitpick] The const.py module is now empty except for the future import. Consider removing this file or repurposing it to avoid confusion.
from __future__ import annotations

libCacheSim-python/libcachesim/trace_generator.py:8

  • [nitpick] The random module is imported and seeded but never used. Consider removing the import and the unnecessary random.seed calls.
import random

libCacheSim-python/src/pylibcachesim.cpp:255

  • [nitpick] Using a lambda to call get_n_obj(&self) may pass a const cache_t* to a method expecting a non-const pointer. Consider binding the member function directly with .def_property_readonly("n_obj", &cache_t::get_n_obj).
          "n_obj", [](const cache_t& self) { return self.get_n_obj(&self); })

Copy link
Copy Markdown
Owner

@1a1a11a 1a1a11a left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread libCacheSim-python/examples/README.md Outdated
Comment thread libCacheSim-python/examples/README.md
Comment thread libCacheSim-python/README.md Outdated
@haochengxia haochengxia merged commit 2fbc051 into develop Jul 17, 2025
11 checks passed
@haochengxia haochengxia deleted the hxia/syn_reqs branch July 17, 2025 17:54
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.

3 participants