beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (BEAM-2264) Re-use credential instead of generating a new one one each GCS call
Date Mon, 19 Mar 2018 05:15:00 GMT

     [ https://issues.apache.org/jira/browse/BEAM-2264?focusedWorklogId=81726&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-81726
]

ASF GitHub Bot logged work on BEAM-2264:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Mar/18 05:14
            Start Date: 19/Mar/18 05:14
    Worklog Time Spent: 10m 
      Work Description: ehrencrona opened a new pull request #4891: [BEAM-2264] Credentials
were not being reused between GCS calls
URL: https://github.com/apache/beam/pull/4891
 
 
   The `threading.local()` used for storing the `storage_client` in `GcsIO` was being recreated
for every `GcsIO` instance. The consequence was that the client need to re-authorize for every
request. Fixing this improves performance reading GCS datasets by roughly 15% for me.
   
   `threading.local()` should only be fetched once for all instances.
   
   This Stackoverflow answer describes the mistake in how `threading.local()` was used:
   https://stackoverflow.com/questions/1408171/thread-local-storage-in-python#answer-13240093
   
   ------------------------
   
   Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [X] Make sure there is a [JIRA issue](https://issues.apache.org/jira/projects/BEAM/issues/)
filed for the change (usually before you start working on it).  Trivial changes like typos
do not require a JIRA issue.  Your pull request should address just this issue, without pulling
in other changes.
    - [X] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`,
where you replace `BEAM-XXX` with the appropriate JIRA issue.
    - [X] Write a pull request description that is detailed enough to understand:
      - [X] What the pull request does
      - [X] Why it does it
      - [X] How it does it
      - [X] Why this approach
    - [X] Each commit in the pull request should have a meaningful subject line and body.
    - [ ] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will
be performed on your pull request automatically.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License
Agreement](https://www.apache.org/licenses/icla.pdf).
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 81726)
            Time Spent: 10m
    Remaining Estimate: 0h

> Re-use credential instead of generating a new one one each GCS call
> -------------------------------------------------------------------
>
>                 Key: BEAM-2264
>                 URL: https://issues.apache.org/jira/browse/BEAM-2264
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-py-core
>            Reporter: Luke Cwik
>            Assignee: Ahmet Altay
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> We should cache the credential used within a Pipeline and re-use it instead of generating
a new one on each GCS call. When executing (against 2.0.0 RC2):
> {code}
> python -m apache_beam.examples.wordcount --input "gs://dataflow-samples/shakespeare/*"
--output local_counts
> {code}
> Note that we seemingly generate a new access token each time instead of when a refresh
is required.
> {code}
>   super(GcsIO, cls).__new__(cls, storage_client))
> INFO:root:Starting the size estimation of the input
> INFO:oauth2client.transport:Attempting refresh to obtain initial access_token
> INFO:oauth2client.client:Refreshing access_token
> INFO:root:Finished the size estimation of the input at 1 files. Estimation took 0.286200046539
seconds
> INFO:root:Running pipeline with DirectRunner.
> INFO:root:Starting the size estimation of the input
> INFO:oauth2client.transport:Attempting refresh to obtain initial access_token
> INFO:oauth2client.client:Refreshing access_token
> INFO:root:Finished the size estimation of the input at 43 files. Estimation took 0.205624818802
seconds
> INFO:oauth2client.transport:Attempting refresh to obtain initial access_token
> INFO:oauth2client.client:Refreshing access_token
> INFO:oauth2client.transport:Attempting refresh to obtain initial access_token
> INFO:oauth2client.client:Refreshing access_token
> INFO:oauth2client.transport:Attempting refresh to obtain initial access_token
> INFO:oauth2client.client:Refreshing access_token
> INFO:oauth2client.transport:Attempting refresh to obtain initial access_token
> INFO:oauth2client.client:Refreshing access_token
> INFO:oauth2client.transport:Attempting refresh to obtain initial access_token
> ... many more times ...
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message