Files
aitbc/services/gpu_marketplace_launcher.py
aitbc 40ddf89b9c
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Waiting to run
Documentation Validation / validate-docs (push) Waiting to run
CLI Tests / test-cli (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
docs: update CLI command syntax across workflow documentation
- Updated marketplace commands: `marketplace --action` → `market` subcommands
- Updated wallet commands: direct flags → `wallet` subcommands
- Updated AI commands: `ai-submit`, `ai-status` → `ai submit`, `ai status`
- Updated blockchain commands: `chain` → `blockchain info`
- Standardized command structure across all workflow files
- Affected files: MULTI_NODE_MASTER_INDEX.md, TEST_MASTER_INDEX.md, multi-node-blockchain-marketplace
2026-04-08 12:10:21 +02:00

79 lines
2.6 KiB
Python
Executable File

#!/usr/bin/env python3
"""
GPU Marketplace Launcher for AITBC Production
"""
import os
import sys
import subprocess
import logging
from pathlib import Path
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
def main():
"""Main GPU marketplace launcher function"""
logger.info("Starting AITBC GPU Marketplace Launcher")
try:
# Set environment variables
os.environ.setdefault('PYTHONPATH', '/opt/aitbc/services')
# Try to run the GPU marketplace service
logger.info("Launching GPU marketplace service")
# Check if the main marketplace service exists
marketplace_path = '/opt/aitbc/services/marketplace.py'
if os.path.exists(marketplace_path):
logger.info("Found marketplace service, launching...")
subprocess.run([
'/opt/aitbc/venv/bin/python',
marketplace_path
], check=True)
else:
logger.error(f"Marketplace service not found at {marketplace_path}")
# Fallback to simple service
fallback_service()
except subprocess.CalledProcessError as e:
logger.error(f"GPU marketplace service failed with exit code {e.returncode}: {e}")
logger.info("Starting fallback GPU marketplace service")
fallback_service()
except (FileNotFoundError, PermissionError) as e:
logger.error(f"Cannot launch GPU marketplace service: {type(e).__name__}: {e}")
logger.info("Starting fallback GPU marketplace service")
fallback_service()
except Exception as e:
logger.error(f"Unexpected error launching GPU marketplace: {type(e).__name__}: {e}")
logger.info("Starting fallback GPU marketplace service")
fallback_service()
def fallback_service():
"""Fallback GPU marketplace service"""
logger.info("Starting fallback GPU marketplace service")
try:
# Simple GPU marketplace heartbeat
import time
while True:
logger.info("GPU Marketplace service heartbeat - active")
time.sleep(30)
except KeyboardInterrupt:
logger.info("GPU Marketplace service stopped by user")
except (OSError, IOError) as e:
logger.error(f"System error in fallback service: {type(e).__name__}: {e}")
time.sleep(5)
except Exception as e:
logger.error(f"Unexpected error in fallback service: {type(e).__name__}: {e}")
time.sleep(5)
if __name__ == "__main__":
main()