Skip to content

Update README.md#10

Merged
antfin-oss merged 1 commit into
mainfrom
jxwuyi-patch-1
Mar 30, 2025
Merged

Update README.md#10
antfin-oss merged 1 commit into
mainfrom
jxwuyi-patch-1

Conversation

@jxwuyi

@jxwuyi jxwuyi commented Mar 30, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

@jxwuyi jxwuyi requested review from antfin-oss and garrett4wade and removed request for antfin-oss and garrett4wade March 30, 2025 16:09
@antfin-oss antfin-oss merged commit 9c54166 into main Mar 30, 2025
@antfin-oss antfin-oss deleted the jxwuyi-patch-1 branch March 30, 2025 23:55
antoinegg1 pushed a commit that referenced this pull request Jul 7, 2025
mjbmjb pushed a commit to mjbmjb/AReaL that referenced this pull request Sep 22, 2025
zhshgmail pushed a commit to zhshgmail/AReaL that referenced this pull request Oct 29, 2025
This commit addresses design issues #1-#4 by reorganizing interfaces:

## Changes

**1. Moved to api module (proper location for interfaces):**
- `QueueAPI` → `areal/api/queue_api.py`
- `CacheAPI` → `areal/api/cache_api.py`
- `EventType`, `EventContext`, `EventHandler` → `areal/api/event_api.py`
- `QueueFilter` → `Filter` in `areal/api/filter_api.py`

**2. Created separate queue/cache event handler protocols:**
- `QueueEventHandler` + `QueueEventContext` in `areal/api/queue_event_handler.py`
- `CacheEventHandler` + `CacheEventContext` in `areal/api/cache_event_handler.py`

**3. Simplified event_system.py:**
- Now only contains `EventRegistry` class
- Imports interfaces from api module
- No longer defines protocols

**4. Renamed QueueFilter → Filter:**
- Generic name since it applies to both queue and cache
- Located in api module as proper interface
- StalenessFilter now implements Filter protocol

## Why Protocol as superclass? (Answer to #4)

Protocol enables **structural subtyping** (duck typing with types):

```python
from typing import Protocol

class QueueAPI(Protocol):
    def put(self, item): ...

# No need to inherit!
class MyQueue:
    def put(self, item):
        pass

# Type checker accepts this ✓
def foo(q: QueueAPI):
    q.put(1)

foo(MyQueue())  # Works! Structural typing
```

vs ABC (requires inheritance):
```python
from abc import ABC

class QueueAPI(ABC):
    ...

class MyQueue:  # Must inherit from QueueAPI
    ...
```

**Protocol = Interface without inheritance requirement**

## Remaining Work

Still TODO (per user feedback):
- Redesign ProximalRecomputer with propagator pattern (#3)
- Fix AsyncTaskRunner to require QueueAPI/CacheAPI (#5)
- Remove executor._filter_context (#6)
- Add CacheFilter or apply Filter to all operations (areal-project#7, areal-project#8)
- Fix RemoteInfEngine to not expose queue/cache (areal-project#9)
- Merge event_factory into workflow_factory (areal-project#10)
- Add vLLM recompute support (areal-project#11)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
zhshgmail pushed a commit to zhshgmail/AReaL that referenced this pull request Oct 29, 2025
…guration

Addresses Issue areal-project#10 from user feedback: Consolidate to single factory with
all component creation and wiring logic.

Changes:
1. Moved all logic from event_factory.py to workflow_factory.py
2. Deleted event_factory.py (no longer needed)
3. Updated core/__init__.py to import from workflow_factory only
4. Both create_workflow_executor and create_workflow_executor_with_events
   now live in workflow_factory.py

This follows the Spring @configuration pattern where there is ONE centralized
place for component assembly. workflow_factory.py is now the ONLY factory that:
- Creates Queue and Cache instances (LocalQueue, LocalCache)
- Registers filters (StalenessFilter)
- Creates event handlers (QueueProximalRecomputer, CacheProximalRecomputer)
- Creates EventPropagator and registers it
- Wires everything together based on feature flags

Benefits:
- Single source of truth for configuration
- Clearer architecture
- Easier to understand component wiring
- No confusion about where components are created

All 12 PPO tests continue to pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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