HUE-9474 [importer] Error with Python 3 when trying to upload file to S3 bucket

Review Request #15440 — Created Sept. 14, 2020 and submitted

ayush.goyal
hue
master
HUE-9474
hue
Amlesh1902, johan, ranade, romain, Sreenath, yingc
commit ee39891532240670fbecadd3f1a453782cea55a0
Author: ayush.goyal <ayush.goyal@cloudera.com>
Date:   Mon Sep 14 12:40:13 2020 +0530

    HUE-9474 [importer] Error with Python 3 when trying to upload file to S3 bucket

:100644 100644 5541d38491 8e89350860 M	desktop/libs/aws/src/aws/s3/upload.py


  • 5
  • 0
  • 0
  • 0
  • 5
Description From Last Updated
Still works with Python2? romain romain
As it is used in only one location, it could be fine to use the Python 3 name (as it ... romain romain
Could have used stream_io to avoid two ifs but this is also pretty explicit and good romain romain
if history: # If _historify failed, history will be None. If we get Atomic block exception, # something underneath interpreter.execute() ... romain romain
Document.objects.link( notebook_doc, owner=notebook_doc.owner, name=notebook_doc.name, description=notebook_doc.description, extra=notebook_type ) romain romain
romain
  1. 
      
  2. desktop/libs/aws/src/aws/s3/upload.py (Diff revision 1)
     
     

    Still works with Python2?

    1. okay, please suggest the common name which can be used here instead of these var string_io(python2) and bytes_io(python3).

  3. 
      
romain
  1. 
      
  2. desktop/libs/aws/src/aws/s3/upload.py (Diff revision 1)
     
     

    As it is used in only one location, it could be fine to use the Python 3 name (as it is the long term future) but maybe even better to still split it two to avoid any misleading confusion.

    How about ...as stream_io?

  3. 
      
ayush.goyal
romain
  1. 
      
  2. desktop/libs/aws/src/aws/s3/upload.py (Diff revision 2)
     
     

    Could have used stream_io to avoid two ifs but this is also pretty explicit and good

  3. 
      
ayush.goyal
ayush.goyal
romain
  1. +1, not wrong but usually it is +4 and leaving the parenthesis outside to visualize easily the scope, example below:

  2. desktop/libs/notebook/src/notebook/api.py (Diff revision 4)
     
     
     

    if history:
    # If _historify failed, history will be None. If we get Atomic block exception,
    # something underneath interpreter.execute() crashed and is not handled.

  3. desktop/libs/notebook/src/notebook/api.py (Diff revision 4)
     
     
     

    Document.objects.link(
    notebook_doc, owner=notebook_doc.owner, name=notebook_doc.name, description=notebook_doc.description, extra=notebook_type
    )

  4. 
      
ayush.goyal
ayush.goyal
Review request changed

Status: Closed (submitted)

Loading...