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

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

Merged
merged 2 commits into from
Feb 14, 2020

Conversation

kkoz
Copy link
Contributor

@kkoz kkoz commented Feb 11, 2020

Similar to #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
Copy link
Member

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

@jburel
Copy link
Member

jburel commented Feb 14, 2020

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
Copy link
Member

jburel commented Feb 14, 2020

Client side handling has been copied over
Merging

@jburel jburel merged commit 448dbb1 into ome:master Feb 14, 2020
@joshmoore joshmoore added this to the 5.6.2 milestone Mar 17, 2020
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.

3 participants