Spaces:
Sleeping
Sleeping
File size: 2,401 Bytes
5271c2e 7fcaffe d48eef6 7fcaffe 5271c2e 7fcaffe 5271c2e 7fcaffe 5271c2e 7fcaffe 5271c2e 7fcaffe 3994c21 7fcaffe 5271c2e 7fcaffe 5271c2e |
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
import sys
import os
from .args import get_pipeline_args
def run_scraping_pipeline(args):
"""Execute the scraping pipeline with given arguments."""
print("=== Running Scraping Pipeline ===")
from .scrape.main import main as scrape_main
# Pass arguments to scrape.main
original_argv = sys.argv
sys.argv = ['scrape_main', '--mode', args.scrape_mode, '--num-events', str(args.num_events)]
try:
scrape_main()
finally:
sys.argv = original_argv
def run_analysis_pipeline():
"""Execute the ELO analysis pipeline."""
print("\n=== Running ELO Analysis ===")
from .analysis.elo import main as elo_main
elo_main()
def run_prediction_pipeline(args):
"""Execute the prediction pipeline with given arguments."""
print("\n=== Running Prediction Pipeline ===")
from .predict.main import main as predict_main
# Pass model management arguments to predict.main
original_argv = sys.argv
predict_args = ['predict_main']
if args.no_use_existing_models:
predict_args.append('--no-use-existing-models')
elif args.use_existing_models:
predict_args.append('--use-existing-models')
if args.force_retrain:
predict_args.append('--force-retrain')
sys.argv = predict_args
try:
predict_main()
finally:
sys.argv = original_argv
def run_model_update(args):
"""Execute the model update pipeline."""
print("\n=== Running Model Update Pipeline ===")
try:
from .predict.main import MODELS_TO_RUN
from .predict.pipeline import PredictionPipeline
except ImportError:
print("Fatal: Could not import prediction modules.")
print("Please ensure your project structure and python path are correct.")
return
pipeline = PredictionPipeline(models=MODELS_TO_RUN)
pipeline.update_models_if_new_data()
def main():
"""Main entry point for the UFC data pipeline."""
args = get_pipeline_args()
# Execute requested pipeline(s)
if args.pipeline in ['scrape', 'all']:
run_scraping_pipeline(args)
if args.pipeline in ['analysis', 'all']:
run_analysis_pipeline()
if args.pipeline == 'update':
run_model_update(args)
if args.pipeline in ['predict', 'all']:
run_prediction_pipeline(args)
if __name__ == '__main__':
main()
|