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

[CT-2129] [Bug] dbt --version hangs when access to PyPi is not available #6992

Closed
2 tasks done
flyingTiemen opened this issue Feb 16, 2023 · 5 comments · Fixed by #7009
Closed
2 tasks done

[CT-2129] [Bug] dbt --version hangs when access to PyPi is not available #6992

flyingTiemen opened this issue Feb 16, 2023 · 5 comments · Fixed by #7009
Labels
bug Something isn't working cli good_first_issue Straightforward + self-contained changes, good for new contributors! paper_cut A small change that impacts lots of users in their day-to-day

Comments

@flyingTiemen
Copy link

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

When using dbt --version a check is done at PypI.org if a newer version is available.
In many compagnies access to the internet is restricted. In that case dbt --version does wait forever and never exits.

Expected Behavior

Make check at PyPi optional, or at least, timeout this check after some time in a proper way.

Steps To Reproduce

dbt --version without access to PyPi.org

Relevant log output

No response

Environment

- OS: any
- Python: any
- dbt: any

Which database adapter are you using with dbt?

No response

Additional Context

No response

@flyingTiemen flyingTiemen added bug Something isn't working triage labels Feb 16, 2023
@github-actions github-actions bot changed the title [Bug] dbt --version hangs when access to PyPi is not available [CT-2129] [Bug] dbt --version hangs when access to PyPi is not available Feb 16, 2023
@jtcohen6
Copy link
Contributor

jtcohen6 commented Feb 16, 2023

Thanks for opening @flyingTiemen!

Paraphrasing from a slack convo I had with @aranke @stu-k a few weeks ago:

  • Better: We should add an aggressive timeout to the "latest" check / PyPI API call
  • Best: We print dbt version info immediately, turn the PyPI check into an async/background process, and only return the "latest" info if/when it's ready
  • Maybe: Give users the option of disabling the "latest" check / PyPI API call entirely. This might be especially relevant in cases where folks want to run --version programmatically. (There are other things we'd need to do to enable like, above all returning version info as a JSON blob instead of colorful pretty-printed text.)

I think the quickest quality-of-life improvement here would be adding an aggressive timeout (e.g. 1s) to this line:

resp = requests.get(version_url)

 resp = requests.get(version_url, timeout=1)

Would you be interested in contributing that quick change?

@jtcohen6 jtcohen6 added cli paper_cut A small change that impacts lots of users in their day-to-day and removed triage labels Feb 16, 2023
@flyingTiemen
Copy link
Author

Tested the quick change, that works fine.

I'm new to contributing to a project on GitHub, I'm not sure if I can add. I'm also behind a firewall which makes access to GiHub a bit problematic (for cloning and commits etc).

@aranke
Copy link
Member

aranke commented Feb 16, 2023

Potentially a dupe of #6085

@jtcohen6 jtcohen6 added the good_first_issue Straightforward + self-contained changes, good for new contributors! label Feb 17, 2023
@jtcohen6
Copy link
Contributor

jtcohen6 commented Feb 17, 2023

I'm going to mark this as a good_first_issue, at least for the simplest "better" solution: add a retry timeout of 1 second :)

@aranke Should we keep #6085 open, and more narrowly scoped to the "best" solution proposed above — yielding information as it becomes available? (I think that's what your approach in #6083 was after)

@aranke
Copy link
Member

aranke commented Feb 17, 2023

Yup, sounds good @jtcohen6!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli good_first_issue Straightforward + self-contained changes, good for new contributors! paper_cut A small change that impacts lots of users in their day-to-day
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants