Skip to content

Commit

Permalink
Return remote filesystem error at top level
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Aug 14, 2023
1 parent 3cae876 commit f7f1f33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions pydatalab/pydatalab/remote_filesystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def get_directory_structure(
directory["name"],
cache_last_updated,
)
status = "updated"

else:
last_updated = cached_dir_structure["last_updated"]
Expand All @@ -126,16 +127,19 @@ def get_directory_structure(
directory["name"],
last_updated,
)
status = "cached"

except Exception as exc:
dir_structure = [{"type": "error", "name": directory["name"], "details": str(exc)}]
last_updated = datetime.datetime.now()
status = "error"

return {
"name": directory["name"],
"type": "toplevel",
"contents": dir_structure,
"last_updated": last_updated,
"status": status,
}


Expand Down
4 changes: 2 additions & 2 deletions pydatalab/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ def check_remotes(_, base_url: str | None = None):
breakpoint()

for d in directory_structures:
if d["type"] == "error":
log.error(f"ꙮ {d['name']!r}: {d['details']!r}")
if d["status"] == "error":
log.error(f"ꙮ {d['name']!r}: {d['contents'][0]['details']!r}")
elif d["type"] == "toplevel":
log.info(f"✓ {d['name']!r}: {d['last_updated']!r}")

Expand Down

0 comments on commit f7f1f33

Please sign in to comment.