From cce9f4291082c06313a0a7f0e4b97122891c80c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saugat=20Pachhai=20=28=E0=A4=B8=E0=A5=8C=E0=A4=97=E0=A4=BE?= =?UTF-8?q?=E0=A4=A4=29?= Date: Mon, 22 Dec 2025 12:37:06 +0545 Subject: [PATCH] bulk_exists: check for access in fs.ls --- src/dvc_data/index/index.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/dvc_data/index/index.py b/src/dvc_data/index/index.py index b9fa3918..ddb9e9d1 100644 --- a/src/dvc_data/index/index.py +++ b/src/dvc_data/index/index.py @@ -247,14 +247,14 @@ def bulk_exists( jobs: Optional[int] = None, callback: "Callback" = DEFAULT_CALLBACK, ) -> dict["DataIndexEntry", bool]: - if not entries: - return {} - entries_with_hash = [e for e in entries if e.hash_info] entries_without_hash = [e for e in entries if not e.hash_info] results = dict.fromkeys(entries_without_hash, False) callback.relative_update(len(entries_without_hash)) + if not entries_with_hash: + return results + if self.index is None or not refresh: for entry in callback.wrap(entries_with_hash): assert entry.hash_info @@ -270,6 +270,12 @@ def bulk_exists( entry_map: dict[str, DataIndexEntry] = { self.get(entry)[1]: entry for entry in entries_with_hash } + + try: + self.fs.ls(self.odb.path) # check for fs access + except FileNotFoundError: + pass + info_results = self.fs.info( list(entry_map.keys()), batch_size=jobs,