@@ -1051,39 +1051,13 @@ def start_nodes_process(self):
1051
1051
1052
1052
# Include additional config to the participants
1053
1053
for idx , node in enumerate (self .config .participants ):
1054
- node ["tracking_args" ]["log_dir" ] = os .path .join (
1055
- self .root_path , ".." , "nebula" , "controller" , ".." , ".." , "app" , "logs"
1056
- )
1057
- node ["tracking_args" ]["config_dir" ] = os .path .join (
1058
- self .root_path , ".." , "nebula" , "controller" , ".." , ".." , "app" , "config" , self .scenario_name
1059
- )
1054
+ node ["tracking_args" ]["log_dir" ] = os .path .join (self .root_path , "app" , "logs" )
1055
+ node ["tracking_args" ]["config_dir" ] = os .path .join (self .root_path , "app" , "config" , self .scenario_name )
1060
1056
node ["scenario_args" ]["controller" ] = self .controller
1061
1057
node ["scenario_args" ]["deployment" ] = self .scenario .deployment
1062
- node ["security_args" ]["certfile" ] = os .path .join (
1063
- self .root_path ,
1064
- ".." ,
1065
- "nebula" ,
1066
- "controller" ,
1067
- ".." ,
1068
- ".." ,
1069
- "app" ,
1070
- "certs" ,
1071
- f"participant_{ node ['device_args' ]['idx' ]} _cert.pem" ,
1072
- )
1073
- node ["security_args" ]["keyfile" ] = os .path .join (
1074
- self .root_path ,
1075
- ".." ,
1076
- "nebula" ,
1077
- "controller" ,
1078
- ".." ,
1079
- ".." ,
1080
- "app" ,
1081
- "certs" ,
1082
- f"participant_{ node ['device_args' ]['idx' ]} _key.pem" ,
1083
- )
1084
- node ["security_args" ]["cafile" ] = os .path .join (
1085
- self .root_path , ".." , "nebula" , "controller" , ".." , ".." , "app" , "certs" , "ca_cert.pem"
1086
- )
1058
+ node ["security_args" ]["certfile" ] = os .path .join (self .root_path , "app" , "certs" , f"participant_{ node ['device_args' ]['idx' ]} _cert.pem" )
1059
+ node ["security_args" ]["keyfile" ] = os .path .join (self .root_path , "app" , "certs" , f"participant_{ node ['device_args' ]['idx' ]} _key.pem" )
1060
+ node ["security_args" ]["cafile" ] = os .path .join (self .root_path , "app" , "certs" , "ca_cert.pem" )
1087
1061
1088
1062
# Write the config file in config directory
1089
1063
with open (f"{ self .config_dir } /participant_{ node ['device_args' ]['idx' ]} .json" , "w" ) as f :
@@ -1109,19 +1083,19 @@ def start_nodes_process(self):
1109
1083
commands += "Start-Sleep -Seconds 2\n "
1110
1084
1111
1085
commands += f'Write-Host "Running node { node ["device_args" ]["idx" ]} ..."\n '
1112
- commands += f'$OUT_FILE = "{ self .processes_root_path } \\ app\\ logs\\ { self .scenario_name } \\ participant_{ node ["device_args" ]["idx" ]} .out"\n '
1113
- commands += f'$ERROR_FILE = "{ self .processes_root_path } \\ app\\ logs\\ { self .scenario_name } \\ participant_{ node ["device_args" ]["idx" ]} .err"\n '
1086
+ commands += f'$OUT_FILE = "{ self .root_path } \\ app\\ logs\\ { self .scenario_name } \\ participant_{ node ["device_args" ]["idx" ]} .out"\n '
1087
+ commands += f'$ERROR_FILE = "{ self .root_path } \\ app\\ logs\\ { self .scenario_name } \\ participant_{ node ["device_args" ]["idx" ]} .err"\n '
1114
1088
1115
1089
# Use Start-Process for executing Python in background and capture PID
1116
- commands += f"""$process = Start-Process -FilePath "python" -ArgumentList "{ self .processes_root_path } \\ nebula\\ core\\ node.py { self .processes_root_path } \\ app\\ config\\ { self .scenario_name } \\ participant_{ node ["device_args" ]["idx" ]} .json" -PassThru -NoNewWindow -RedirectStandardOutput $OUT_FILE -RedirectStandardError $ERROR_FILE
1090
+ commands += f"""$process = Start-Process -FilePath "python" -ArgumentList "{ self .root_path } \\ nebula\\ core\\ node.py { self .root_path } \\ app\\ config\\ { self .scenario_name } \\ participant_{ node ["device_args" ]["idx" ]} .json" -PassThru -NoNewWindow -RedirectStandardOutput $OUT_FILE -RedirectStandardError $ERROR_FILE
1117
1091
Add-Content -Path $PID_FILE -Value $process.Id
1118
1092
"""
1119
1093
1120
1094
commands += 'Write-Host "All nodes started. PIDs stored in $PID_FILE"\n '
1121
1095
1122
- with open (f"/nebula/app/config/ { self .scenario_name } /current_scenario_commands.ps1" , "w" ) as f :
1096
+ with open (f"{ self .config_dir } /current_scenario_commands.ps1" , "w" ) as f :
1123
1097
f .write (commands )
1124
- os .chmod (f"/nebula/app/config/ { self .scenario_name } /current_scenario_commands.ps1" , 0o755 )
1098
+ os .chmod (f"{ self .config_dir } /current_scenario_commands.ps1" , 0o755 )
1125
1099
else :
1126
1100
commands = '#!/bin/bash\n \n PID_FILE="$(dirname "$0")/current_scenario_pids.txt"\n \n > $PID_FILE\n \n '
1127
1101
sorted_participants = sorted (
@@ -1135,22 +1109,15 @@ def start_nodes_process(self):
1135
1109
else :
1136
1110
commands += "sleep 2\n "
1137
1111
commands += f'echo "Running node { node ["device_args" ]["idx" ]} ..."\n '
1138
- # commands += f"OUT_FILE={self.processes_root_path }/app/logs/{self.scenario_name}/participant_{node['device_args']['idx']}.out\n"
1139
- commands += f"python nebula/core/node.py app/config/{ self .scenario_name } /participant_{ node ['device_args' ]['idx' ]} .json &\n "
1112
+ commands += f"OUT_FILE={ self .root_path } /app/logs/{ self .scenario_name } /participant_{ node ['device_args' ]['idx' ]} .out\n "
1113
+ commands += f"python { self . root_path } / nebula/core/node.py { self . root_path } / app/config/{ self .scenario_name } /participant_{ node ['device_args' ]['idx' ]} .json &\n "
1140
1114
commands += "echo $! >> $PID_FILE\n \n "
1141
1115
1142
1116
commands += 'echo "All nodes started. PIDs stored in $PID_FILE"\n '
1143
1117
1144
- logging .info (f"[FER] root_path { self .root_path } processes_root_path { self .processes_root_path } " )
1145
- logging .info (f"OUT_FILE=app/logs/{ self .scenario_name } /participant_{ node ['device_args' ]['idx' ]} .out\n " )
1146
-
1147
- with open (
1148
- f"{ self .processes_root_path } /app/config/{ self .scenario_name } /current_scenario_commands.sh" , "w"
1149
- ) as f :
1118
+ with open (f"{ self .config_dir } /current_scenario_commands.sh" , "w" ) as f :
1150
1119
f .write (commands )
1151
- os .chmod (
1152
- f"{ self .processes_root_path } /app/config/{ self .scenario_name } /current_scenario_commands.sh" , 0o755
1153
- )
1120
+ os .chmod (f"{ self .config_dir } /current_scenario_commands.sh" , 0o755 )
1154
1121
1155
1122
except Exception as e :
1156
1123
raise Exception (f"Error starting nodes as processes: { e } " )
0 commit comments