Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Wait longer if processes still running (#364)

Kilian Lieret629b866e3022
diff --git a/sweagent/environment/utils.py b/sweagent/environment/utils.py
index c2be2c17..197401b2 100644
--- a/sweagent/environment/utils.py
+++ b/sweagent/environment/utils.py
@@ -322,6 +322,13 @@ def _get_persistent_container(ctr_name: str, image_name: str, persistent: bool =
# Get the process IDs of the container
# There should be at least a head process and possibly one child bash process
bash_pids, other_pids = get_background_pids(container_obj)
+ total_time_slept = START_UP_DELAY
+ while len(bash_pids) > 1 or len(other_pids) > 0:
+ time.sleep(1)
+ total_time_slept += 1
+ bash_pids, other_pids = get_background_pids(container_obj)
+ if total_time_slept > 5*START_UP_DELAY:
+ break
bash_pid = 1
if len(bash_pids) == 1:
bash_pid = bash_pids[0][0]