SciPaperLoader Diagnostic and Emergency Tools

This directory contains various scripts for diagnosing issues, debugging, and handling emergency situations with the SciPaperLoader application.

Available Tools

Scraper Management

  • emergency_stop.py: Force stops all scraper activities, revokes running tasks, and reverts papers from "Pending" state
  • quick_fix.py: A simplified emergency stop that also stops Flask processes to ensure code changes are applied
  • test_reversion.py: Tests the paper reversion functionality when stopping the scraper

Monitoring and Diagnostics

  • check_state.py: Checks the current state of the scraper in the database
  • diagnose_scraper.py: Comprehensive diagnostic tool that examines tasks, logs, and scraper state
  • inspect_tasks.py: Displays currently running and scheduled APScheduler tasks

Usage

Interactive Diagnostic Menu

For a user-friendly interface to all diagnostic tools, run:

cd /path/to/SciPaperLoader
python tools/run_diagnostics.py

This will launch the diagnostic menu where you can select which tool to run.

Emergency Stop

When the scraper needs to be immediately stopped, regardless of its state:

cd /path/to/SciPaperLoader
python tools/diagnostics/emergency_stop.py

Diagnosing Issues

To investigate problems with the scraper or task queue:

cd /path/to/SciPaperLoader
python tools/diagnostics/diagnose_scraper.py

Quick Fix for Worker Issues

If tasks continue to run despite stopping the scraper:

cd /path/to/SciPaperLoader
python tools/diagnostics/quick_fix.py

Notes

  • Always run these scripts from the project root directory
  • Some scripts may require a running Flask application with APScheduler
  • After using emergency tools, the application may need to be restarted completely