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

s3fs file source plugin (and possibly others) unusable with AttributeError: 'FilesSourceOptions' object has no attribute 'extra_props' #17442

Closed
natefoo opened this issue Feb 8, 2024 · 3 comments

Comments

@natefoo
Copy link
Member

natefoo commented Feb 8, 2024

Describe the bug

galaxy.managers.remote_files WARNING 2024-02-08 11:38:24,307 [pN:main.1,p:741299,tN:MainThread] Problem listing file source path FileSourcePath(file_source=<galaxy.files.sources.s3fs.S3FsFilesSource object at 0x7f3757090210>, path='/')
Traceback (most recent call last):
  File "/home/nate/work/galaxy/lib/galaxy/managers/remote_files.py", line 84, in index
    index = file_source.list(
            ^^^^^^^^^^^^^^^^^
  File "/home/nate/work/galaxy/lib/galaxy/files/sources/__init__.py", line 296, in list
    return self._list(path, recursive, user_context, opts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nate/work/galaxy/lib/galaxy/files/sources/s3fs.py", line 54, in _list
    fs = self._open_fs(user_context=user_context, opts=opts)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nate/work/galaxy/lib/galaxy/files/sources/s3fs.py", line 84, in _open_fs
    extra_props = opts.extra_props or {} if opts else {}
                  ^^^^^^^^^^^^^^^^
AttributeError: 'FilesSourceOptions' object has no attribute 'extra_props'

Breaking commit from bisect is 6fb9349

Galaxy Version and/or server at which you observed the bug
Galaxy Version: 23.2.dev0
Commit: 6fb9349

To Reproduce
Steps to reproduce the behavior:

  1. Configure file source:
    - type: s3fs
      label: Genome Ark
      id: genomeark
      doc: Access to Genome Ark open data on AWS.
      bucket: genomeark
      anon: true
  2. Attempt to "Choose remote files" from this file source
@natefoo
Copy link
Member Author

natefoo commented Feb 8, 2024

This fix works for s3fs specifically, although I'm not sure how to test extra_props:

diff --git a/lib/galaxy/files/sources/s3fs.py b/lib/galaxy/files/sources/s3fs.py
index 6234391409..96d36d536a 100644
--- a/lib/galaxy/files/sources/s3fs.py
+++ b/lib/galaxy/files/sources/s3fs.py
@@ -81,7 +81,7 @@ class S3FsFilesSource(BaseFilesSource):
         return f"{self._bucket}{path}"

     def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
-        extra_props = opts.extra_props or {} if opts else {}
+        extra_props = getattr(opts, "extra_props", {}) or {}
         fs = s3fs.S3FileSystem(**{**self._props, **extra_props})
         return fs

@davelopez
Copy link
Contributor

Breaking commit from bisect is 6fb9349

Sorry... and wild... I would not expect adding a prop to break this, but it might certainly be related to what Marius mentioned here #17445 (comment)

@natefoo
Copy link
Member Author

natefoo commented Feb 20, 2024

Fixed in #17445, thank you @nuwang!

@natefoo natefoo closed this as completed Feb 20, 2024
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

No branches or pull requests

2 participants