Initial commit - cleaned repository
This commit is contained in:
54
services/pipeline/simple_test.py
Normal file
54
services/pipeline/simple_test.py
Normal file
@ -0,0 +1,54 @@
|
||||
#!/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())
|
||||
Reference in New Issue
Block a user