Skip to content

RetryErrors obscure actual errors - Language API #3900

Closed
@mr-ubik

Description

@mr-ubik

Similar to #3083
I am having the exact issue but with the google-cloud-language package. I am streaming tweets (working with Apache Beam) to the Language Sentiment Analysis API but some of them seem to break it.

class SentimentAnalyzerDoFn(beam.DoFn):
    def process(self, element):
        """Takes a parsed tweet as input and add to it its sentiment score and values"""
        from google.cloud import language
        client = language.LanguageServiceClient()
        document = language.types.Document(
            content=element['tweet'].encode('utf-8'),
            type='PLAIN_TEXT')
        response = client.analyze_sentiment(
            document=document,
            encoding_type='UTF8')
        sentiment = response.document_sentiment
        element['sentiment_score'] = sentiment.score
        element['sentiment_magnitude'] = sentiment.magnitude
        yield element

The error I am getting is this:

RetryError: Exception occurred in retry method that was not classified as transient [while running 'SentimentAnalasys']

Is there a way to investigate it?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: languageIssues related to the Cloud Natural Language API API.status: duplicateDuplicate.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions