Commit a296ba9
scheduler feat: implementation of redis queue and new api search functions of mixture and fine mode (#462)
* debug an error function name
* feat: Add DynamicCache compatibility for different transformers versions
- Fix build_kv_cache method in hf.py to handle both old and new DynamicCache structures
- Support new 'layers' attribute with key_cache/value_cache or keys/values
- Maintain backward compatibility with direct key_cache/value_cache attributes
- Add comprehensive error handling and logging for unsupported structures
- Update move_dynamic_cache_htod function in kv.py for cross-version compatibility
- Handle layers-based structure in newer transformers versions
- Support alternative attribute names (keys/values vs key_cache/value_cache)
- Preserve original functionality for older transformers versions
- Add comprehensive tests for DynamicCache compatibility
- Test activation memory update with mock DynamicCache layers
- Verify layers attribute access across different transformers versions
- Fix scheduler logger mock to include memory_manager attribute
This resolves AttributeError issues when using different versions of the
transformers library and ensures robust handling of DynamicCache objects.
debug
* feat: implement APIAnalyzerForScheduler for memory operations
- Add APIAnalyzerForScheduler class with search/add operations
- Support requests and http.client with connection reuse
- Include comprehensive error handling and dynamic configuration
- Add English test suite with real-world conversation scenarios
* feat: Add search_ws API endpoint and enhance API analyzer functionality
- Add search_ws endpoint in server_router.py for scheduler-enabled search
- Fix missing imports: time module, SearchRequest class, and get_mos_product_instance function
- Implement search_ws method in api_analyzer.py with HTTP client support
- Add _search_ws_with_requests and _search_ws_with_http_client private methods
- Include search_ws usage example in demonstration code
- Enhance scheduler and dispatcher capabilities for improved memory management
- Expand test coverage to ensure functionality stability
This update primarily strengthens the memory scheduling system's search capabilities,
providing users with more flexible API interface options.
* fix: resolve test failures and warnings in test suite
- Fix Pydantic serialization warning in test_memos_chen_tang_hello_world
* Add warnings filter to suppress UserWarning from Pydantic serialization
- Fix KeyError: 'past_key_values' in test_build_kv_cache_and_generation
* Update mock configuration to properly return forward_output with past_key_values
* Add DynamicCache version compatibility handling in test mocks
* Support both old and new transformers versions with layers/key_cache attributes
* Improve assertion logic to check all model calls for required parameters
- Update base_scheduler.py to use centralized DEFAULT_MAX_INTERNAL_MESSAGE_QUEUE_SIZE constant
* Add import for DEFAULT_MAX_INTERNAL_MESSAGE_QUEUE_SIZE from general_schemas
* Replace hardcoded value 100 with configurable constant (1000)
All tests now pass successfully with proper version compatibility handling.
* feat: add a test_robustness execution to test thread pool execution
* feat: optimize scheduler configuration and API search functionality
- Add DEFAULT_TOP_K and DEFAULT_CONTEXT_WINDOW_SIZE global constants in general_schemas.py
- Update base_scheduler.py to use global default values instead of hardcoded numbers
- Fix SchedulerConfigFactory initialization issue by using keyword argument expansion
- Resolve UnboundLocalError variable conflict in search_memories_ws function
- Fix indentation and parameter issues in OptimizedScheduler search_for_api method
- Improve code standardization and maintainability
* feat: Add Redis auto-initialization with fallback strategies
- Add auto_initialize_redis() with config/env/local fallback
- Move Redis logic from dispatcher_monitor to redis_service
- Update base_scheduler to use auto initialization
- Add proper resource cleanup and error handling
* feat: add database connection management to ORM module
- Add MySQL engine loading from environment variables in BaseDBManager
- Add Redis connection loading from environment variables in BaseDBManager
- Enhance database configuration validation and error handling
- Complete database adapter infrastructure for ORM module
- Provide unified database connection management interface
This update provides comprehensive database connection management capabilities
for the mem_scheduler module, supporting dynamic MySQL and Redis configuration
loading from environment variables, establishing reliable data persistence
foundation for scheduling services and API services.
* remove part of test
* feat: add Redis-based ORM with multiprocess synchronization
- Add RedisDBManager and RedisLockableORM classes
- Implement atomic locking mechanism for concurrent access
- Add merge functionality for different object types
- Include comprehensive test suite and examples
- Fix Redis key type conflicts in lock operations
* fix: resolve scheduler module import and Redis integration issues
* revise naive memcube creation in server router
* remove long-time tests in test_scheduler
* remove redis test which needs .env
* refactor all codes about mixture search with scheduler
* fix: resolve Redis API synchronization issues and implement search API with reranker
- Fix running_entries to running_task_ids migration across codebase
- Update sync_search_data method to properly handle TaskRunningStatus
- Correct variable naming and logic in API synchronization flow
- Implement search API endpoint with reranker functionality
- Update test files to reflect new running_task_ids convention
- Ensure proper Redis state management for concurrent tasks
* remove a test for api module
* revise to pass the test suite
* address some bugs to make mix_search normally running
* modify codes according to evaluation logs
* feat: Optimize mixture search and enhance API client
* feat: Add conversation_turn tracking for session-based memory search
- Add conversation_turn field to APIMemoryHistoryEntryItem schema with default value 0
- Implement session counter in OptimizedScheduler to track turn count per session_id
- Update sync_search_data method to accept and store conversation_turn parameter
- Maintain session history with LRU eviction (max 5 sessions)
- Rename conversation_id to session_id for consistency with request object
- Enable direct access to session_id from search requests
This feature allows tracking conversation turns within the same session,
providing better context for memory retrieval and search history management.
* adress time bug in monitor
* revise simple tree
* add mode to evaluation client; rewrite print to logger.info in db files
* feat: 1. add redis queue for scheduler 2. finish the code related to mix search and fine search
* debug the working memory code
* addressed a range of bugs to make scheduler running correctly
* remove test_dispatch_parallel test
* print change to logger.info
---------
Co-authored-by: CaralHsi <[email protected]>1 parent 1f60c56 commit a296ba9
File tree
39 files changed
+2947
-1400
lines changed- examples/mem_scheduler
- src/memos
- api
- routers
- configs
- mem_os
- mem_scheduler
- analyzer
- general_modules
- memory_manage_modules
- monitors
- schemas
- utils
- webservice_modules
- memories/textual/tree_text_memory/retrieve
- templates
- tests/mem_scheduler
39 files changed
+2947
-1400
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
This file was deleted.
Lines changed: 0 additions & 87 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
73 | 108 | | |
74 | 109 | | |
75 | 110 | | |
76 | 111 | | |
77 | 112 | | |
78 | 113 | | |
79 | | - | |
| 114 | + | |
80 | 115 | | |
81 | 116 | | |
82 | 117 | | |
| |||
118 | 153 | | |
119 | 154 | | |
120 | 155 | | |
| 156 | + | |
121 | 157 | | |
122 | 158 | | |
123 | 159 | | |
| |||
131 | 167 | | |
132 | 168 | | |
133 | 169 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | 170 | | |
170 | 171 | | |
0 commit comments