Skip to content

Commit

Permalink
[service] Tweak logging messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCummins committed Apr 22, 2022
1 parent 30681e4 commit de31359
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions compiler_gym/service/connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,7 @@ def release(self, service: CompilerGymServiceConnection) -> None:
return

if service not in self.allocated:
logger.debug(
"Ignoring attempt to release connection "
"that does not belong to pool"
)
logger.debug("Discarding service that does not belong to pool")
return

self.allocated.remove(service)
Expand All @@ -143,11 +140,11 @@ def release(self, service: CompilerGymServiceConnection) -> None:
if hasattr(service.connection, "process"):
# A dead service cannot be reused, discard it.
if service.closed or service.connection.process.poll() is not None:
logger.debug("Ignoring attempt to release dead connection")
logger.debug("Discarding service with dead process")
return
# A service that has been shutdown cannot be reused, discard it.
if not service.connection:
logger.debug("Ignoring attempt to service without connection")
logger.debug("Discarding service that has no connection")
return

self.pool[key].append(service)
Expand Down Expand Up @@ -209,7 +206,7 @@ def get() -> "ServiceConnectionPool":
return _SERVICE_CONNECTION_POOL

def __repr__(self) -> str:
return f"ServiceConnectionPool(size={self.size})"
return f"{type(self).__name__}(size={self.size})"


_SERVICE_CONNECTION_POOL = ServiceConnectionPool()

0 comments on commit de31359

Please sign in to comment.