-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
54 lines (43 loc) · 1.46 KB
/
run.py
File metadata and controls
54 lines (43 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
"""
Entry point for the Hackathon Intelligence Agent.
Run a one-time scrape, analysis, and report generation.
"""
import sys
import logging
from pathlib import Path
# Add the project root to sys.path
sys.path.insert(0, str(Path(__file__).parent))
from pipeline.main import run_pipeline
from pipeline.scheduler import run_once
from storage.db import init_db
from utils.logging_setup import setup_logging
def main():
"""Execute the full pipeline."""
setup_logging()
logger = logging.getLogger(__name__)
logger.info("Starting Hackathon Intelligence Agent")
logger.info("Initializing database")
init_db()
logger.info("Running pipeline")
try:
results = run_pipeline()
logger.info(
f"Pipeline completed. Processed {results.get('total_hackathons', 0)} hackathons, "
f"{results.get('new_hackathons', 0)} new, "
f"{results.get('analyzed', 0)} analyzed."
)
except Exception as e:
logger.exception("Pipeline failed with error")
sys.exit(1)
logger.info("Generating daily report")
try:
from reports.generator import generate_daily_report
report_path = generate_daily_report()
logger.info(f"Report saved to {report_path}")
except Exception as e:
logger.error(f"Report generation failed: {e}")
# Continue, not a fatal error
logger.info("Agent finished successfully")
if __name__ == "__main__":
main()