Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/3117 dbt deps timeout #3275

Merged
merged 10 commits into from
May 6, 2021

Conversation

TeddyCr
Copy link
Contributor

@TeddyCr TeddyCr commented Apr 18, 2021

resolves #

Description

resolves #3117 (dbt deps hanging for hours)

In this PR we added a timeout parameter to the requests.get() method to prevent requests from hanging for hours.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

@cla-bot cla-bot bot added the cla:yes label Apr 18, 2021
@TeddyCr
Copy link
Contributor Author

TeddyCr commented Apr 26, 2021

Hey folks 👋 just wanted to check to see if there was anything I needed to update on this to have it reviewed/approved? Thank you.

Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TeddyCr This looks solid! Thanks so much for contributing, and sorry for the delay on my end. I left a few comments prompted by the failing Windows CI test.

Once that test is passing, could you add a changelog entry (v0.20.0 - "Under the hood") and add yourself to the list of contributors?

Comment on lines 32 to 34
raise requests.exceptions.Timeout(
'Request timeout, server has not issued a response for 60 seconds'
) from exc_timeout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this raise its own Timeout-specific error message after hanging for 60 seconds, or simply kick back to retry in the line below?

except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as exc:

I think either could be a good answer!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My initial thought was to have 2 distinct error handling, but since, it appears that, the azure pipeline does not raise a Timeouterror, it might be safer to handle both in a generic error handling block as you wrote above.

class testRegistryGetRequestTimeout(unittest.TestCase):
def test_registry_request_timeout(self):
# using non routable IP to test timeout logic in the _get function
self.assertRaises(Timeout, _get, '', 'http://10.255.255.1')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to above, it looks like the failing Windows test is skipping the Timeout error, retrying 5 times, and finally raising dbt.exceptions.RegistryException: Unable to connect to registry hub.

Let's do one of:

  • Figure out why Windows is skipping the Timeout exception and jumping into retries
  • Amend the code above to raise a consistent retry-based exception
  • Edit this test to check for either Timeout or RegistryException

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the above update to the timeout error handling I went ahead and made a generic error catching test.

Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @TeddyCr!

@jtcohen6 jtcohen6 merged commit 66c5082 into dbt-labs:develop May 6, 2021
@jtcohen6 jtcohen6 mentioned this pull request May 6, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants