upload: nonexistent paths are silently ignored

オープン
#1,974 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
cli, data

調査の方向性

Start with _partition_upload_assets() and under_paths() in dandi/upload.py, where a missing path matches nothing, then report_omitted_paths(). Check how path_is_subpath() handles a path that equals a prefix, and the commented-out click.Path(exists=True) in cmd_upload. Done means a missing path without --sync fails and names it (broken symlinks still accepted), and with --sync a path matching nothing on the server gets a warning. The --sync deletion question needs a maintainer decision first.

索引モデルが issue の本文から書いたものです。

説明

UX

dandi upload says nothing when a requested path does not exist locally. With a typo such as dandi upload sub-1/ (meant sub-01/), nothing reports the path. Reading upload(), the run then goes ahead with only dandiset.yaml.

Found while reviewing #1932, which makes find_dandi_files() raise FileNotFoundError for missing paths (#1094). That PR does not reach upload, because upload() never passes the requested paths to find_dandi_files(). It walks the whole Dandiset with dandiset.assets(allow_all=True), then filters with under_paths() in _partition_upload_assets() (dandi/upload.py). A missing path matches nothing:

>>> _partition_upload_assets(dandiset.assets(allow_all=True), [PurePosixPath("missing.nwb")], False)
([], [])

Nothing is selected and nothing is omitted, so report_omitted_paths() has nothing to warn about either. The click.Path(exists=True) on the paths argument of cmd_upload is commented out.

--sync rules out a blanket error

A missing path can be intentional with --sync. After rm -r sub-01, dandi upload --sync sub-01 offers to delete the remote assets under sub-01/. With --sync, a missing path currently gives:

Missing local path On the server Result
directory, e.g. sub-01 assets under sub-01/ offered for deletion (expected)
file, e.g. sub-01/a.nwb sub-01/a.nwb not deleted, because path_is_subpath() returns False when the path equals the prefix
typo, e.g. sub-1 nothing nothing happens, no message
Possible behavior
  • Without --sync: fail before doing anything and name the missing paths, as dandi validate already does with LinkAwarePath(lexists=True). Broken symlinks, i.e. unfetched DataLad/git-annex content, should still be accepted.
  • With --sync: accept a missing path only if it matches something on the server, and warn or error otherwise. Separately, decide whether --sync should delete a remote file when that file's own path was given and is gone locally.
主要言語
Python
スター
28
フォーク
37
平均マージ
3日 21時間
マージ済み PR(30日)
13

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dandi/dandi-cli のほかの issue

dandi/dandi-cli の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。