[
https://issues.apache.org/jira/browse/BEAM-2264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16885587#comment-16885587
]
Udi Meiri commented on BEAM-2264:
---------------------------------
I'm not sure. I added a test logging.error('wrapper!') entry to
_do_refresh_request() and it was only logged once, and only after the second
"Attempting refresh..." entry.
That may point to another user of oauth2client, or concurrent refreshes (i.e.
"wrapper!" message is from the first thread doing "Attempting refresh...").
The jsonPayload.thread field in Stackdriver logs is identical for all 3 entries
(136:140478770464512), but I have no idea if that corresponds to a Python
thread.
{code}
2019-07-15T17:32:45.078399658Z Loading main session from the staging area... I
2019-07-15T17:32:45.100733518Z Attempting refresh to obtain initial
access_token I
2019-07-15T17:32:45.102308750Z Status HTTP server running at localhost:40229 I
2019-07-15T17:32:46.167937994Z Executing workitem <BatchWorkItem steps=
3729982873935038282> I
2019-07-15T17:32:46.168387413Z Memory usage of worker
beamapp-ehudm-0715172721--07151027-edcl-harness-xxm0 is 114 MB I
2019-07-15T17:32:46.195270538Z Attempting refresh to obtain initial
access_token I
2019-07-15T17:32:46.195525169Z wrapper! E
{code}
> 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
> Priority: Minor
> Time Spent: 1h
> 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.14#76016)