-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.py
More file actions
73 lines (63 loc) · 2.17 KB
/
main.py
File metadata and controls
73 lines (63 loc) · 2.17 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# main.py
"""Main entry point for the solver node."""
import click
import logging
from solverNode import SolverNode
from typing import Optional
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger('Main')
BANNER = """
____ _ _ _
| _ \\ ___ _ __ _ __ ___ | \\ | | ___ __| | ___
| |_) / _ \\ '_ \\| '_ \\ / _ \\ | \\| |/ _ \\ / _` |/ _ \\
| _ < __/ |_) | |_) | (_) | | |\\ | (_) | (_| | __/
|_| \\_\\___| .__/| .__/ \\___/ |_| \\_|\\___/ \\__,_|\\___|
|_| |_|
"""
@click.group()
def cli():
"""Solver Node CLI - A tool for processing Requests for Data (RFDs)"""
pass
@cli.command()
@click.option('--test', is_flag=True, help='Test mode: Process a sample RFD file with real data generation')
@click.option('--mock', is_flag=True, help='Mock mode: Simulate the entire pipeline with mock data and services')
@click.option('--rfd-file', default='sample_rfd.json', help='Path to sample RFD JSON file (used in test mode)')
def start(test: bool, mock: bool, rfd_file: str):
"""Start the solver node
Test mode (--test):
- Processes a sample RFD file
- Uses real data generation (HuggingFace if available)
- Skips blockchain interactions
- Good for testing data generation logic
Mock mode (--mock):
- Simulates the entire pipeline
- Uses mock data generation
- Uses mock blockchain responses
- Good for development and debugging
"""
print(BANNER)
# Initialize solver node
try:
node = SolverNode(
test_mode=test,
mock_mode=mock
)
except Exception as e:
logger.error(f"Failed to initialize solver node: {str(e)}")
return
# Run the node
try:
if test or mock:
node._run_test_mode()
else:
node._run_production_mode()
except KeyboardInterrupt:
logger.info("Solver node stopped by user")
except Exception as e:
logger.error(f"Solver node failed: {str(e)}")
if __name__ == '__main__':
cli()