Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker.errors.NotFound when encountering exceptions #586

Closed
klieret opened this issue Jun 18, 2024 · 2 comments
Closed

docker.errors.NotFound when encountering exceptions #586

klieret opened this issue Jun 18, 2024 · 2 comments

Comments

@klieret
Copy link
Member

klieret commented Jun 18, 2024

Currently encountered when a command in the container files or similar

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/api/client.py", line 275, in _raise_for_status
     response.raise_for_status()
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
     raise HTTPError(http_error_msg, response=self)
 requests.exceptions.HTTPError: 404 Client Error: Not Found for url:
 http+docker://localhost/v1.45/containers/f2aa44e94a8f1e23796298c2f8dbdd16bab93d3674fb792009649ca481135ef7?v=False&link=False&force=True

 The above exception was the direct cause of the following exception:

 Traceback (most recent call last):
   File "/home/klieret/SWE-agent/sweagent/environment/swe_env.py", line 520, in close
     self.container_obj.remove(force=True)
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/models/containers.py", line 367, in remove
     return self.client.api.remove_container(self.id, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/utils/decorators.py", line 19, in wrapped
     return f(self, resource_id, *args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/api/container.py", line 1037, in remove_container
     self._raise_for_status(res)
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/api/client.py", line 277, in _raise_for_status
     raise create_api_error_from_http_exception(e) from e
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/errors.py", line 39, in create_api_error_from_http_exception
     raise cls(e, response=response, explanation=explanation) from e
 docker.errors.NotFound: 404 Client Error for http+docker://localhost/v1.45/containers/f2aa44e94a8f1e23796298c2f8dbdd16bab93d3674fb792009649ca481135ef7?v=False&link=False&force=True:
 Not Found ("No such container: f2aa44e94a8f1e23796298c2f8dbdd16bab93d3674fb792009649ca481135ef7")
@klieret
Copy link
Member Author

klieret commented Jun 18, 2024

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
INFO     Beginning environment shutdown...
WARNING  Failed to remove container
Traceback (most recent call last):
 File "/home/klieret/SWE-agent/run.py", line 377, in main
   self.run(index)
 File "/home/klieret/SWE-agent/run.py", line 341, in run
   observation, info = self.env.reset(index)
                       ^^^^^^^^^^^^^^^^^^^^^
 File "/home/klieret/SWE-agent/sweagent/environment/swe_env.py", line 372, in reset
   self.install_env()
 File "/home/klieret/SWE-agent/sweagent/environment/swe_env.py", line 988, in install_env
   self.communicate_with_handling(
 File "/home/klieret/SWE-agent/sweagent/environment/swe_env.py", line 747, in communicate_with_handling
   raise RuntimeError(msg)
RuntimeError: Install command failed to execute successfully: Obtaining file:///pvlib__pvlib-python


(...)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/api/client.py", line 275, in _raise_for_status
   response.raise_for_status()
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
   raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url:
http+docker://localhost/v1.45/containers/f2aa44e94a8f1e23796298c2f8dbdd16bab93d3674fb792009649ca481135ef7?v=False&link=False&force=True

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
 File "/home/klieret/SWE-agent/sweagent/environment/swe_env.py", line 520, in close
   self.container_obj.remove(force=True)
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/models/containers.py", line 367, in remove
   return self.client.api.remove_container(self.id, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/utils/decorators.py", line 19, in wrapped
   return f(self, resource_id, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/api/container.py", line 1037, in remove_container
   self._raise_for_status(res)
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/api/client.py", line 277, in _raise_for_status
   raise create_api_error_from_http_exception(e) from e
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/opt/miniconda3/envs/bitbop/lib/python3.12/site-packages/docker/errors.py", line 39, in create_api_error_from_http_exception
   raise cls(e, response=response, explanation=explanation) from e
docker.errors.NotFound: 404 Client Error for http+docker://localhost/v1.45/containers/f2aa44e94a8f1e23796298c2f8dbdd16bab93d3674fb792009649ca481135ef7?v=False&link=False&force=True:
Not Found ("No such container: f2aa44e94a8f1e23796298c2f8dbdd16bab93d3674fb792009649ca481135ef7")

@klieret klieret changed the title Issues with removing or stopping containers when encountering exceptions docker.errors.NotFound when encountering exceptions Jun 18, 2024
@klieret
Copy link
Member Author

klieret commented Jun 18, 2024

Ah, this is because we already exit the running process before, so it's most likely closed

klieret added a commit that referenced this issue Jun 18, 2024
klieret added a commit that referenced this issue Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant