fixes for the service layer. Updated readme.
This commit is contained in:
+13
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user