@@ -18,11 +18,11 @@ try:
|
|||||||
import cudaq
|
import cudaq
|
||||||
from cudaq import spin
|
from cudaq import spin
|
||||||
CUDAQ_AVAILABLE = True
|
CUDAQ_AVAILABLE = True
|
||||||
logger.info("CUDA Quantum successfully imported")
|
print("INFO - CUDA Quantum successfully imported", flush=True)
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
CUDAQ_AVAILABLE = False
|
CUDAQ_AVAILABLE = False
|
||||||
logger.warning(f"CUDA Quantum not available: {e}")
|
print(f"WARNING - CUDA Quantum not available: {e}", flush=True)
|
||||||
logger.warning("Running in mock mode - install CUDA Quantum for full functionality: pip install cudaq")
|
print("WARNING - Running in mock mode - install CUDA Quantum for full functionality: pip install cudaq", flush=True)
|
||||||
|
|
||||||
|
|
||||||
class QuantumKernelManager:
|
class QuantumKernelManager:
|
||||||
|
|||||||
@@ -81,9 +81,16 @@ export class PythonBridge extends EventEmitter {
|
|||||||
const output = data.toString();
|
const output = data.toString();
|
||||||
this.logger.debug('Python stdout:', output);
|
this.logger.debug('Python stdout:', output);
|
||||||
|
|
||||||
if (!initialized && (output.includes('CUDA Quantum Python Bridge') || output.includes('Ready'))) {
|
// Check for initialization messages
|
||||||
initialized = true;
|
if (!initialized) {
|
||||||
resolve();
|
if (output.includes('CUDA Quantum Python Bridge') || output.includes('Ready')) {
|
||||||
|
initialized = true;
|
||||||
|
resolve();
|
||||||
|
} else if (output.includes('INFO - CUDA Quantum successfully imported')) {
|
||||||
|
this.logger.info('CUDA Quantum initialized successfully');
|
||||||
|
} else if (output.includes('WARNING - CUDA Quantum not available')) {
|
||||||
|
this.logger.warn('CUDA Quantum not available, running in mock mode');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle JSON responses
|
// Handle JSON responses
|
||||||
@@ -93,17 +100,14 @@ export class PythonBridge extends EventEmitter {
|
|||||||
this.pythonProcess.stderr?.on('data', (data: Buffer) => {
|
this.pythonProcess.stderr?.on('data', (data: Buffer) => {
|
||||||
const error = data.toString();
|
const error = data.toString();
|
||||||
|
|
||||||
// Check if it's just a warning about CUDA Quantum not being available
|
// Log stderr messages but don't treat them as fatal errors during initialization
|
||||||
if (error.includes('WARNING') && error.includes('CUDA Quantum not available')) {
|
// Most Python logging goes to stderr even for non-errors
|
||||||
this.logger.warn('Python warning:', error);
|
if (error.includes('WARNING') || error.includes('INFO') || error.includes('DEBUG')) {
|
||||||
// Don't treat this as a fatal error - continue with initialization
|
this.logger.debug('Python log message:', error);
|
||||||
if (!initialized) {
|
} else if (error.trim()) {
|
||||||
initialized = true;
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.logger.error('Python stderr:', error);
|
this.logger.error('Python stderr:', error);
|
||||||
if (!initialized) {
|
// Only reject during initialization if it's a real error (not a log message)
|
||||||
|
if (!initialized && !error.includes('INFO') && !error.includes('WARNING') && !error.includes('DEBUG')) {
|
||||||
reject(new Error(`Python process error: ${error}`));
|
reject(new Error(`Python process error: ${error}`));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Referencia en una nueva incidencia
Block a user