56 lines
1.9 KiB
Python
56 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
스타크래프트 키워드로 파이프라인 테스트
|
|
"""
|
|
import asyncio
|
|
import sys
|
|
import os
|
|
sys.path.append(os.path.dirname(__file__))
|
|
|
|
from shared.queue_manager import QueueManager
|
|
from shared.models import PipelineJob
|
|
|
|
async def test_starcraft_pipeline():
|
|
"""스타크래프트 키워드로 파이프라인 테스트"""
|
|
|
|
# Queue manager 초기화
|
|
queue_manager = QueueManager(redis_url="redis://redis:6379")
|
|
await queue_manager.connect()
|
|
|
|
try:
|
|
# 스타크래프트 파이프라인 작업 생성
|
|
job = PipelineJob(
|
|
keyword_id="test_starcraft_001",
|
|
keyword="스타크래프트",
|
|
stage="rss_collection",
|
|
data={}
|
|
)
|
|
|
|
print(f"🚀 스타크래프트 파이프라인 작업 시작")
|
|
print(f" 작업 ID: {job.job_id}")
|
|
print(f" 키워드: {job.keyword}")
|
|
print(f" 키워드 ID: {job.keyword_id}")
|
|
|
|
# RSS 수집 큐에 작업 추가
|
|
await queue_manager.enqueue('rss_collection', job)
|
|
print(f"✅ 작업이 rss_collection 큐에 추가되었습니다")
|
|
|
|
# 큐 상태 확인
|
|
stats = await queue_manager.get_queue_stats()
|
|
print(f"\n📊 현재 큐 상태:")
|
|
for queue_name, stat in stats.items():
|
|
if queue_name not in ['completed', 'failed']:
|
|
pending = stat.get('pending', 0)
|
|
processing = stat.get('processing', 0)
|
|
if pending > 0 or processing > 0:
|
|
print(f" {queue_name}: 대기={pending}, 처리중={processing}")
|
|
|
|
print(f"\n⏳ 파이프라인 실행을 모니터링하세요:")
|
|
print(f" docker logs site11_pipeline_rss_collector --tail 20 -f")
|
|
print(f" python3 check_mongodb.py")
|
|
|
|
finally:
|
|
await queue_manager.disconnect()
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test_starcraft_pipeline()) |