ome / omero-py

Python project containing Ice remoting code for OMERO
https://www.openmicroscopy.org/omero
GNU General Public License v2.0
22 stars 32 forks source link

Get file size for download from the RawFileStore instead of the DB #181

Closed kkoz closed 4 years ago

kkoz commented 4 years ago

Similar to https://github.com/ome/omero-py/pull/180 This PR is to fix the issue where attempting to download a file with a null size in originalfile table results in the following:

  File "OMERO/bin/omero", line 130, in <module>
    rv = omero.cli.argv()
  File "OMERO/lib/python/omero/cli.py", line 1620, in argv
    cli.invoke(args[1:])
  File "OMERO/lib/python/omero/cli.py", line 1095, in invoke
    stop = self.onecmd(line, previous_args)
  File "OMERO/lib/python/omero/cli.py", line 1172, in onecmd
    self.execute(line, previous_args)
  File "OMERO/lib/python/omero/cli.py", line 1254, in execute
    args.func(args)
  File "OMERO/lib/python/omero/plugins/download.py", line 66, in __call__
    client.download(orig_file, target_file)
  File "OMERO/lib/python/omero/clients.py", line 863, in download
    if block_size > ofile.size.val:

If, however, we retrieve the size from the RawFileStore instead of the DB record, we can get a size for the file even if the DB field is null.

joshmoore commented 4 years ago

Thanks, @kkoz. You might want to also copy over the ClientError handling from #180.

jburel commented 4 years ago

Wrote a test (I will open a PR against openmicroscopy) Without this PR:

E           AttributeError: 'NoneType' object has no attribute 'val'

With this PR the test is green

jburel commented 4 years ago

Client side handling has been copied over Merging