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]
Fix: Catch container not found and retry after wait
Kilian Lieretbe04aa968bbe
diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.pyindex b1f7ae85..1159ddcd 100644--- a/sweagent/environment/swe_env.py+++ b/sweagent/environment/swe_env.py@@ -449,7 +449,12 @@ class SWEEnv(gym.Env):raise RuntimeError("Docker is not running. Please start Docker and try again.") from e- self.container_obj = client.containers.get(self.container_name)+ try:+ self.container_obj = client.containers.get(self.container_name)+ except docker.errors.NotFound:+ logger.debug("Couldn't find container. Let's wait and retry.")+ time.sleep(3)+ self.container_obj = client.containers.get(self.container_name)self.logger.info("🌱 Environment Initialized")def _init_scripts(self):