- Add multi-threaded keyword scheduler for periodic news collection - Create Keyword Manager API for CRUD operations and monitoring - Implement automatic pipeline triggering (RSS → Google → AI → Translation) - Add thread status monitoring and dynamic keyword management - Support priority-based execution and configurable intervals - Add comprehensive scheduler documentation guide - Default keywords: AI, 테크놀로지, 경제, 블록체인 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
54 lines
1.4 KiB
Python
54 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Simple pipeline test - direct queue injection
|
|
"""
|
|
import asyncio
|
|
import json
|
|
import redis.asyncio as redis
|
|
from datetime import datetime
|
|
import uuid
|
|
|
|
async def test():
|
|
# Redis 연결
|
|
r = await redis.from_url("redis://redis:6379", decode_responses=True)
|
|
|
|
# 작업 생성
|
|
job = {
|
|
"job_id": str(uuid.uuid4()),
|
|
"keyword_id": str(uuid.uuid4()),
|
|
"keyword": "전기차",
|
|
"stage": "rss_collection",
|
|
"stages_completed": [],
|
|
"data": {
|
|
"rss_feeds": [
|
|
"https://news.google.com/rss/search?q=전기차&hl=ko&gl=KR&ceid=KR:ko"
|
|
],
|
|
"categories": ["technology", "automotive"]
|
|
},
|
|
"priority": 1,
|
|
"retry_count": 0,
|
|
"max_retries": 3,
|
|
"created_at": datetime.now().isoformat(),
|
|
"updated_at": datetime.now().isoformat()
|
|
}
|
|
|
|
# QueueMessage 형식으로 래핑
|
|
message = {
|
|
"message_id": str(uuid.uuid4()),
|
|
"queue_name": "rss_collection",
|
|
"job": job,
|
|
"timestamp": datetime.now().isoformat()
|
|
}
|
|
|
|
# 큐에 추가
|
|
await r.lpush("queue:rss_collection", json.dumps(message))
|
|
print(f"✅ Job {job['job_id']} added to queue:rss_collection")
|
|
|
|
# 큐 상태 확인
|
|
length = await r.llen("queue:rss_collection")
|
|
print(f"📊 Queue length: {length}")
|
|
|
|
await r.aclose()
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test()) |