impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Knupp (Code Review)" <ger...@cloudera.org>
Subject [Impala-ASF-CR] IMPALA-6070: Parallel compute table stats.py
Date Mon, 23 Oct 2017 17:50:55 GMT
David Knupp has posted comments on this change. ( http://gerrit.cloudera.org:8080/8354 )

Change subject: IMPALA-6070: Parallel compute_table_stats.py
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/8354/2/tests/util/compute_table_stats.py
File tests/util/compute_table_stats.py:

http://gerrit.cloudera.org:8080/#/c/8354/2/tests/util/compute_table_stats.py@116
PS2, Line 116:   def client_factory():
Would it be possible to decorate client_factory as a @contextmanager, something like:

  from contextlib import contextmanager
  
  @contextmanager 
  def client_factory():
    impala_client = ImpalaBeeswaxClient(options.impalad,
        use_kerberos=options.use_kerberos, use_ssl=options.use_ssl)
    impala_client.connect()
    yield impala_client
    impala_client.close_connection()

...such that usage becomes:

  with client_factory() as impala_client:
    # etc...

Then you could then do away with the try/finally for closing the connection.



-- 
To view, visit http://gerrit.cloudera.org:8080/8354
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifb080f2552b9dbe304ecadd6e52429214094237d
Gerrit-Change-Number: 8354
Gerrit-PatchSet: 2
Gerrit-Owner: Philip Zeyliger <philip@cloudera.com>
Gerrit-Reviewer: Alex Behm <alex.behm@cloudera.com>
Gerrit-Reviewer: David Knupp <dknupp@cloudera.com>
Gerrit-Reviewer: Michael Brown <mikeb@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <philip@cloudera.com>
Gerrit-Comment-Date: Mon, 23 Oct 2017 17:50:55 +0000
Gerrit-HasComments: Yes

Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message