From dfa5eda4d019534c75cca42a1af53bba2e57fcd4 Mon Sep 17 00:00:00 2001 From: ferenc <161438972+wazkovics@users.noreply.github.com> Date: Mon, 7 Apr 2025 13:11:57 +0100 Subject: [PATCH] Fixed bird conf not starting Bird was showing defunct while using os.system , used a subprocess to run it instead --- starrynet/sn_orchestrater.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/starrynet/sn_orchestrater.py b/starrynet/sn_orchestrater.py index 62f8f2b..5aa3a57 100644 --- a/starrynet/sn_orchestrater.py +++ b/starrynet/sn_orchestrater.py @@ -3,6 +3,8 @@ import sys from time import sleep import numpy +import subprocess + """ Used in the remote machine for link updating, initializing links, damaging and recovering links and other functionalities。 author: Yangtao Deng (dengyt21@mails.tsinghua.edu.cn) and Zeqi Lai (zeqilai@tsinghua.edu.cn) @@ -385,8 +387,12 @@ def sn_copy_run_conf(container_idx, Path, current, total): str(container_idx) + ":/B" + str(current + 1) + ".conf") print("[" + str(current + 1) + "/" + str(total) + "]" + " docker cp bird.conf " + str(container_idx) + ":/bird.conf") - os.system("docker exec -it " + str(container_idx) + " bird -c B" + - str(current + 1) + ".conf") + #os.system("docker exec -it " + str(container_idx) + " bird -c B" + + # str(current + 1) + ".conf") + result = subprocess.run(["docker", "exec", str(container_idx), "bird", "-c", "B"+str(current+1)+".conf"], + capture_output=True, text=True) + with open("/tmp/bird.log", "a") as f: + f.write(str(container_idx)+": "+result.stdout+"\n") print("[" + str(current + 1) + "/" + str(total) + "] Bird routing process for container: " + str(container_idx) + " has started. ")