Skip to content

Commit f2e9fbf

Browse files
committed
edit some names and comments
1 parent 9b86782 commit f2e9fbf

File tree

6 files changed

+16
-22
lines changed

6 files changed

+16
-22
lines changed

backend/config/corsOptions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// config/corsOptions.js
21
const allowedOrigins = {
32
development: ['http://localhost:5173', 'http://172.25.1.141:5173'],
43
production: ['http://localhost:5173', 'http://172.25.1.141:5173']

backend/middleware/logging.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if (!fs.existsSync(logsDir)) {
1010
fs.mkdirSync(logsDir, { recursive: true });
1111
}
1212

13-
// 📜 Morgan for HTTP request logging
13+
// Morgan for HTTP request logging
1414
const accessLogStream = fs.createWriteStream(
1515
path.join(logsDir, 'access.log'),
1616
{ flags: 'a' }
@@ -20,7 +20,7 @@ const morganFormat = ':date - :method :url :status :response-time ms - :res[cont
2020
const consoleLogger = morgan(morganFormat);
2121
const fileLogger = morgan(morganFormat, { stream: accessLogStream });
2222

23-
// 🖊️ Winston for general-purpose logging
23+
// Winston for general-purpose logging
2424
const appLogger = createLogger({
2525
level: 'info',
2626
format: format.combine(

backend/routes/api.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@ const path = require('path');
44
const router = express.Router();
55

66
const { getConfigs, getRunConfigs, saveConfig, getAllResults, resetRunConfigs, saveAlgorithms, getAllAlgorithms, getFitnessData } = require('../utils/fileHandlers');
7-
const { runPythonScript } = require('../utils/pythonRunner');
87
const { getResults } = require('../utils/resultProcessor');
98
const { runExperiments } = require('../utils/runExperiments');
109
const asyncHandler = require('../middleware/asyncHandler');
11-
const { log } = require('console');
12-
// const { validate, schemas } = require('../middleware/validation');
13-
1410

1511

1612
// Get configurations

backend/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ app.get('/health', (req, res) => {
3535

3636
const hostname = process.env.HOST_NAME
3737

38-
// Error handling middleware (must be last)
38+
// Error handling middleware
3939
app.use(errorHandler);
4040

4141
// Start server

backend/utils/runExperiments.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const fs = require("fs");
33

44
const config = require("../config/config");
55
const { readJsonFile, writeJsonFile, deleteFilesInDir } = require("./fileHandlers");
6-
const { runPythonScript } = require("./pythonRunner");
6+
const { executeOrchestrator } = require("./runOrchestrator");
77
const { getResults } = require("./resultProcessor");
88
const { log } = require("console");
99

@@ -68,7 +68,7 @@ async function runExperiments() {
6868

6969
console.log(`📂 Found ${allConfigs.length} configs in run_configs.json`);
7070

71-
// 📦 Collect results for ALL configs
71+
// Collect results for ALL configs
7272
const allConfigsResults = [];
7373

7474
for (const [index, cfg] of allConfigs.entries()) {
@@ -84,7 +84,7 @@ async function runExperiments() {
8484
}
8585
}
8686

87-
// ✍️ Save all results to a single file
87+
// Save all results to a single file
8888
try {
8989
writeJsonFile(RESULTS_FILE, allConfigsResults);
9090
console.log(`\n✅ All results saved to ${RESULTS_FILE}`);
@@ -117,7 +117,7 @@ async function runExperimentsForGroupedConfig(currentConfig) {
117117
console.log(`\n🔁 Using config_type = ${configType}`);
118118

119119
try {
120-
await runPythonScript({
120+
await executeOrchestrator({
121121
job: 1,
122122
'config-type': configType,
123123
'cost-config-type': currentConfig.cost_config_type,
@@ -132,7 +132,7 @@ async function runExperimentsForGroupedConfig(currentConfig) {
132132
deleteFilesInDir(resultsDir, ".json");
133133

134134
try {
135-
await runPythonScript();
135+
await executeOrchestrator();
136136
const results = getResults("algorithms");
137137
allExperimentResults.push({
138138
config_type: configType, results
@@ -178,7 +178,7 @@ async function runExperimentsForGroupedConfig(currentConfig) {
178178

179179
try {
180180
writeJsonFile(LCA_PARAMS_PATH, lcaParameters);
181-
await runPythonScript({
181+
await executeOrchestrator({
182182
run: "lca",
183183
});
184184
const results = getResults("lca");
@@ -237,10 +237,10 @@ async function runExperimentsForSingleConfig(currentConfig) {
237237
for (const configType of configTypes) {
238238
console.log(`\n🔁 Using config_type = ${configType}`);
239239

240-
// 1️⃣ Pre-run: Create configuration by calling Python script
240+
// Pre-run: Create configuration by calling Python script
241241
console.log("📄 Preparing configuration...");
242242
try {
243-
await runPythonScript({
243+
await executeOrchestrator({
244244
job: 1, // job 1 = generate config
245245
'config-type': configType,
246246
'cost-config-type': currentConfig.cost_config_type,
@@ -274,7 +274,7 @@ async function runExperimentsForSingleConfig(currentConfig) {
274274
}
275275

276276
try {
277-
await runPythonScript(); // Execute the Python script
277+
await executeOrchestrator(); // Execute the Python script
278278
const results = getResults(); // Get results after Python script runs
279279
allExperimentResults.push({ L: l, S: s, config_type: configType, results });
280280
} catch (runError) {
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@ const path = require("path");
33
const { MAIN_DIR } = require("../config/config");
44
const { appLogger } = require("../middleware/logging");
55

6-
const runPythonScript = (args = {}) => {
6+
const executeOrchestrator = (args = {}) => {
77
return new Promise((resolve, reject) => {
8-
// 🛠️ Build CLI args string
8+
// Build CLI args string
99
const cliArgs = Object.entries(args)
1010
.filter(([_, value]) => value !== undefined && value !== null) // skip empty values
1111
.map(([key, value]) => `--${key} ${value}`)
1212
.join(" ");
1313

14-
// 🐍 Full command
1514
const command = `python3 ${path.join(MAIN_DIR, "run.py")} ${cliArgs}`;
1615

17-
appLogger.info(`Running: ${command}`); // Debugging
16+
appLogger.info(`Running: ${command}`);
1817

1918
exec(
2019
command,
@@ -37,5 +36,5 @@ const runPythonScript = (args = {}) => {
3736
};
3837

3938
module.exports = {
40-
runPythonScript,
39+
executeOrchestrator,
4140
};

0 commit comments

Comments
 (0)