Skip to content

Commit

Permalink
Fix timeout error
Browse files Browse the repository at this point in the history
Dramelac committed Dec 21, 2023
1 parent 900ff12 commit 3ab4065
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions exegol/utils/DockerUtils.py
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ def listContainers(cls) -> List[ExegolContainer]:
logger.critical(err.explanation)
# Not reachable, critical logging will exit
return # type: ignore
except TimeoutError:
except ReadTimeout:
logger.critical("Received a timeout error, Docker is busy... Unable to list containers, retry later.")
return # type: ignore
for container in docker_containers:
@@ -220,7 +220,7 @@ def __loadDockerVolume(cls, volume_path: str, volume_name: str) -> Volume:
logger.debug(e.explanation)
else:
raise NotFound('Volume must be reloaded')
except TimeoutError:
except ReadTimeout:
logger.error(f"Received a timeout error, Docker is busy... Volume {volume_name} cannot be automatically removed. Please, retry later the following command:{os.linesep}"
f" [orange3]docker volume rm {volume_name}[/orange3]")
except NotFound:
@@ -237,13 +237,13 @@ def __loadDockerVolume(cls, volume_path: str, volume_name: str) -> Volume:
logger.debug(err)
logger.critical(err.explanation)
return None # type: ignore
except TimeoutError:
except ReadTimeout:
logger.critical(f"Received a timeout error, Docker is busy... Volume {volume_name} cannot be created.")
return # type: ignore
except APIError as err:
logger.critical(f"Unexpected error by Docker SDK : {err}")
return None # type: ignore
except TimeoutError:
except ReadTimeout:
logger.critical("Received a timeout error, Docker is busy... Unable to enumerate volume, retry later.")
return None # type: ignore
return volume
@@ -324,7 +324,7 @@ def getInstalledImage(cls, tag: str) -> ExegolImage:
else:
logger.critical(f"Error on image loading: {err}")
return # type: ignore
except TimeoutError:
except ReadTimeout:
logger.critical("Received a timeout error, Docker is busy... Unable to list images, retry later.")
return # type: ignore
return ExegolImage(docker_image=docker_local_image).autoLoad()
@@ -352,7 +352,7 @@ def __listLocalImages(cls, tag: Optional[str] = None) -> List[Image]:
logger.critical(err.explanation)
# Not reachable, critical logging will exit
return # type: ignore
except TimeoutError:
except ReadTimeout:
logger.critical("Received a timeout error, Docker is busy... Unable to list local images, retry later.")
return # type: ignore
# Filter out image non-related to the right repository
@@ -390,7 +390,7 @@ def __findLocalRecoveryImages(cls, include_untag: bool = False) -> List[Image]:
except APIError as err:
logger.debug(f"Error occurred in recovery mode: {err}")
return []
except TimeoutError:
except ReadTimeout:
logger.critical("Received a timeout error, Docker is busy... Unable to enumerate lost images, retry later.")
return # type: ignore
result = []
@@ -454,7 +454,7 @@ def __findImageMatch(cls, remote_image: ExegolImage):
docker_image = cls.__client.images.get(f"{ConstantConfig.IMAGE_NAME}@{remote_id}")
except ImageNotFound:
raise ObjectNotFound
except TimeoutError:
except ReadTimeout:
logger.critical("Received a timeout error, Docker is busy... Unable to find a specific image, retry later.")
return # type: ignore
remote_image.resetDockerImage()
@@ -495,7 +495,7 @@ def downloadImage(cls, image: ExegolImage, install_mode: bool = False) -> bool:
else:
logger.debug(f"Error: {err}")
logger.critical(f"An error occurred while downloading this image: {err.explanation}")
except TimeoutError:
except ReadTimeout:
logger.critical(f"Received a timeout error, Docker is busy... Unable to download {name} image, retry later.")
return False

@@ -518,7 +518,7 @@ def downloadVersionTag(cls, image: ExegolImage) -> Union[ExegolImage, str]:
else:
logger.debug(f"Error: {err}")
return f"en unknown error occurred while downloading this image : {err.explanation}"
except TimeoutError:
except ReadTimeout:
logger.critical(f"Received a timeout error, Docker is busy... Unable to download an image tag, retry later the following command:{os.linesep}"
f" [orange3]docker pull --platform linux/{image.getArch()} {ConstantConfig.IMAGE_NAME}:{image.getLatestVersionName()}[/orange3].")
return # type: ignore
@@ -598,6 +598,6 @@ def buildImage(cls, tag: str, build_profile: Optional[str] = None, build_dockerf
logger.debug(f"Error: {err}")
else:
logger.critical(f"An error occurred while building this image : {err}")
except TimeoutError:
except ReadTimeout:
logger.critical("Received a timeout error, Docker is busy... Unable to build the local image, retry later.")
return # type: ignore

0 comments on commit 3ab4065

Please sign in to comment.