Skip to content

Commit 540d6c7

Browse files
authored
Use real JuiceFS mountpoint for stats (#28)
1 parent 6f4e150 commit 540d6c7

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

benchmarks/small_files_storage.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,20 @@ def juicefs_stats(path: pathlib.Path) -> dict[str, Any]:
210210
)
211211
212212
213+
def juicefs_stats_mountpoint(target_dir: pathlib.Path, mount: dict[str, Any]) -> pathlib.Path | None:
214+
if not target_is_juicefs(mount):
215+
return None
216+
candidates = [
217+
pathlib.Path("/mnt/celesto-persistent-home"),
218+
pathlib.Path(str(mount.get("target") or "")),
219+
target_dir,
220+
]
221+
for candidate in candidates:
222+
if candidate.exists() and os.path.ismount(candidate):
223+
return candidate
224+
return None
225+
226+
213227
def start_juicefs_profile(path: pathlib.Path, *, enabled: bool) -> subprocess.Popen[str] | None:
214228
if not enabled:
215229
return None
@@ -326,7 +340,7 @@ def benchmark_target(
326340
327341
before_df = df_info(target_dir)
328342
before_mount = mount_info(target_dir)
329-
stats_path = pathlib.Path(before_mount.get("target") or target_dir) if target_is_juicefs(before_mount) else None
343+
stats_path = juicefs_stats_mountpoint(target_dir, before_mount)
330344
juicefs_stats_before = juicefs_stats(stats_path) if collect_juicefs_stats and stats_path else None
331345
profile_process = start_juicefs_profile(stats_path, enabled=juicefs_profile and stats_path is not None)
332346
profile_result = None

0 commit comments

Comments
 (0)