File size: 1,568 Bytes
b8277c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
const concurrently = require('concurrently');
const path = require('path');

// Set UTF-8 encoding for Windows console
process.env.PYTHONIOENCODING = 'utf-8';

console.log('Starting services...');

// Define paths relative to the backend root
const backendRoot = path.resolve(__dirname, '../../');
const excelServicePath = path.join(backendRoot, 'excel_module', 'api', 'excel_service.py');
const mlServicePath = path.join(backendRoot, 'ml_module', 'api', 'main.py');
const serverPath = path.join(backendRoot, 'core', 'server.js');
const signinServicePath = path.join(backendRoot, 'signin', 'main.py');
const text2sqlServicePath = path.join(backendRoot, 'self_service_module', 'api', 'text2sql_router.py');

concurrently([
    {
        command: `python "${text2sqlServicePath}"`,
        name: 'TEXT2SQL_API',
        prefixColor: 'cyan',
        env: { PYTHONIOENCODING: 'utf-8' }
    },
    {
        command: `python "${excelServicePath}"`,
        name: 'EXCEL_API',
        prefixColor: 'magenta',
        env: { PYTHONIOENCODING: 'utf-8' }
    },
    {
        command: `python "${mlServicePath}"`,
        name: 'ML_API',
        prefixColor: 'blue',
        env: { PYTHONIOENCODING: 'utf-8' }
    },
    {
        command: `python "${signinServicePath}"`,
        name: 'SIGNIN_API',
        prefixColor: 'yellow',
        env: { PYTHONIOENCODING: 'utf-8' }
    },
    {
        command: `node "${serverPath}"`,
        name: 'SERVER',
        prefixColor: 'green'
    }
], {
    prefix: 'name',
    killOthers: ['failure', 'success'],
    restartTries: 3,
});