fixes for the service layer. Updated readme.

This commit is contained in:
2026-06-13 21:29:25 -07:00
parent bfad71e96a
commit e9ff109f0a
3 changed files with 71 additions and 16 deletions
+13
View File
@@ -37,8 +37,21 @@ from server.app import run_server as start_server
logger.add("pipeline.log", rotation="5 MB", retention="7 days")
def clear_json_data() -> None:
"""Remove stale JSON files at the start of each pipeline cycle."""
if not os.path.isdir(DATA_DIR):
return
for fname in ("output.json", "scripts.json"):
fpath = os.path.join(DATA_DIR, fname)
if os.path.exists(fpath):
os.remove(fpath)
logger.info(f"Cleared {fpath}")
logger.info("Cleared JSON data at cycle start")
async def run_pipeline() -> bool:
"""Run all three pipeline stages sequentially. Returns True on success."""
clear_json_data()
logger.info("=" * 60)
logger.info("Stage 1: Scraping Guardian articles...")
try: