Method
acquire
(self, owner: str = "", msg: str = "")
Source from the content-addressed store, hash-verified
| 28 | |
| 29 | @contextmanager |
| 30 | def acquire(self, owner: str = "", msg: str = "") -> Generator[None, None, FAISS]: |
| 31 | owner = owner or f"thread {threading.get_native_id()}" |
| 32 | try: |
| 33 | self._lock.acquire() |
| 34 | if self._pool is not None: |
| 35 | self._pool._cache.move_to_end(self.key) |
| 36 | logger.info(f"{owner} 开始操作:{self.key}。{msg}") |
| 37 | yield self._obj |
| 38 | finally: |
| 39 | logger.info(f"{owner} 结束操作:{self.key}。{msg}") |
| 40 | self._lock.release() |
| 41 | |
| 42 | def start_loading(self): |
| 43 | self._loaded.clear() |
Callers
nothing calls this directly
Tested by
no test coverage detected