Dealing with Errors in GraphQL Mutation Queries and Retries

Original Slack Thread

Hi. I’m using Datahub Version 0.12.0. When I’m emitting consecutive graphql mutation queries, I am getting the ff error in between successful runs. I investigated and Datahub successfully emits every 5 seconds. So some of my queries are successful, some are not. I tried adding retries to the graph client config but I’m still getting the error. Should I add more retries? Is there another solution? Say, retry based on time? Thanks, will appreciate the help.

Error:
Error executing graphql query: [{'message': 'Unauthorized to perform this action. Please contact your DataHub administrator.', 'locations': [{'line': 3, 'column': 9}], 'path': ['updatePolicy'], 'extensions': {'code': 403, 'type': 'UNAUTHORIZED', 'classification': 'DataFetchingException'}}]
Config:

        DatahubClientConfig(
            server=settings.DATAHUB_METADATA_SERVER_URL,
            token=settings.DATAHUB_ACCESS_TOKEN,
            retry_max_times=5,
            retry_status_codes=[
                403,
                429,
                500,
                502,
                503,
                504,
            ],
        )
    )```

Hey there! :wave: Make sure your message includes the following information if relevant, so we can help more effectively!

  1. Which DataHub version are you using? (e.g. 0.12.0)
  2. Please post any relevant error logs on the thread!

Strange. Is it just a permission error that is appearing? Is the token used by the script associated with a user who has permission to execute all these mutations? If the user who created the token doesn’t have the permission, the script probably won’t either.

Hi <@U05AW4DVBAA>. Thanks for replying. Strange indeed. Yeah only permission errors are appearing. And the token used is an admin token and not associated with a user.

Hi. I’ve found a solution. I added a 7 second sleep in between emits. It’s slow but lower sleep causes errors :((