Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload Multiple Files and Directories #372

Merged
merged 13 commits into from
Oct 2, 2023
Merged

Conversation

garrettmflynn
Copy link
Member

Follow-up to #350 that extends #371 to upload files or folders using the standalone Upload page.

Similar to NeurodataWithoutBorders/nwbinspector#40, DANDI cannot handle nested symlinked files (error below).

@CodyCBakerPhD I realized that I mischaracterized the capabilities of Electron earlier. You can select multiple directories using the native pop-up—at least for Mac—though this capability isn't available when running on browsers. Do we need to turn multi-directory support off for this DANDI upload page?

DANDI Symlink Error

[2023-09-15 09:43:29,464] ERROR in app: Exception on /neuroconv/upload [POST]
Traceback (most recent call last):
  File "/Users/garrettflynn/Documents/Github/nwb-guide/pyflask/apis/neuroconv.py", line 158, in post
    return upload_multiple_filesystem_objects_to_dandi( **neuroconv_api.payload)
  File "/Users/garrettflynn/Documents/Github/nwb-guide/pyflask/manageNeuroconv/manage_neuroconv.py", line 338, in upload_multiple_filesystem_objects_to_dandi
    result = upload_folder_to_dandi(**innerKwargs)
  File "/Users/garrettflynn/Documents/Github/nwb-guide/pyflask/manageNeuroconv/manage_neuroconv.py", line 353, in upload_folder_to_dandi
    return automatic_dandi_upload(
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/neuroconv/tools/data_transfers.py", line 322, in automatic_dandi_upload
    dandi_organize(paths=str(nwb_folder_path), dandiset_path=str(dandiset_path))
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/dandi/organize.py", line 851, in organize
    files_mode = detect_link_type(link_test_file, dandiset_path)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/dandi/organize.py", line 687, in detect_link_type
    os.symlink(srcfile, destfile)
TypeError: symlink: src should be string, bytes or os.PathLike, not NoneType

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask_restx/api.py", line 404, in wrapper
    resp = resource(*args, **kwargs)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask/views.py", line 109, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask_restx/resource.py", line 46, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/Users/garrettflynn/Documents/Github/nwb-guide/pyflask/apis/neuroconv.py", line 162, in post
    neuroconv_api.abort(500, str(e))
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask_restx/namespace.py", line 153, in abort
    abort(*args, **kwargs)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask_restx/errors.py", line 28, in abort
    flask.abort(code)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask/helpers.py", line 277, in abort
    current_app.aborter(code, *args, **kwargs)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/werkzeug/exceptions.py", line 861, in __call__
    raise self.mapping[code](*args, **kwargs)
werkzeug.exceptions.InternalServerError: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

@garrettmflynn garrettmflynn self-assigned this Sep 15, 2023
@garrettmflynn garrettmflynn changed the title Upload Files and Directories Upload Multiple Files and Directories Sep 15, 2023
@garrettmflynn
Copy link
Member Author

This works too now!

@garrettmflynn garrettmflynn marked this pull request as ready for review September 28, 2023 22:10
Base automatically changed from inspector-files-or-folders to main October 2, 2023 08:13
@CodyCBakerPhD
Copy link
Collaborator

Works great!

@CodyCBakerPhD CodyCBakerPhD merged commit 308ac3c into main Oct 2, 2023
7 checks passed
@CodyCBakerPhD CodyCBakerPhD deleted the dandi-files-or-folders branch October 2, 2023 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants