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

Detect Databricks as Jupyter environment #2424

Merged
merged 3 commits into from
Sep 20, 2022
Merged

Conversation

noklam
Copy link
Contributor

@noklam noklam commented Jul 27, 2022

Type of changes

Detect Databricks as Jupyter environment, although it is kind of a weird breed of Jupyter Notebook. This should make JUPYTER_LINES and JUPYTER_COLUMNS configurations useful for Databricks

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

Please describe your changes here. If this fixes a bug, please link to the issue, if possible.
Added a condition to check for Databricks environment variable. Fix #2422

@codecov-commenter
Copy link

codecov-commenter commented Jul 27, 2022

Codecov Report

Merging #2424 (3a5f097) into master (19e518f) will decrease coverage by 0.03%.
The diff coverage is 98.34%.

❗ Current head 3a5f097 differs from pull request most recent head e054861. Consider uploading reports for the commit e054861 to get more accurate results

@@            Coverage Diff             @@
##           master    #2424      +/-   ##
==========================================
- Coverage   98.71%   98.67%   -0.04%     
==========================================
  Files          73       72       -1     
  Lines        7771     7767       -4     
==========================================
- Hits         7671     7664       -7     
- Misses        100      103       +3     
Flag Coverage Δ
unittests 98.67% <98.34%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
rich/default_styles.py 100.00% <ø> (ø)
rich/logging.py 100.00% <ø> (ø)
rich/progress.py 92.76% <ø> (ø)
rich/segment.py 98.72% <93.10%> (+<0.01%) ⬆️
rich/_inspect.py 100.00% <100.00%> (ø)
rich/box.py 100.00% <100.00%> (ø)
rich/cells.py 96.05% <100.00%> (-3.95%) ⬇️
rich/color.py 100.00% <100.00%> (ø)
rich/console.py 98.30% <100.00%> (+0.01%) ⬆️
rich/highlighter.py 100.00% <100.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ee992b...e054861. Read the comment docs.

@noklam noklam marked this pull request as ready for review July 27, 2022 15:23
@antonymilne
Copy link
Contributor

I don't know if it's any better, but https://stackoverflow.com/questions/51329152/how-to-detect-databricks-environment-programmatically suggests using a different environment variable, DATABRICKS_RUNTIME_VERSION.

Thank you for doing this though! Definitely feels like the right fix to me from a kedro perspective. I thought I'd done _is_jupyter in Databricks before to test exactly this out, but obviously I was wrong.

@noklam
Copy link
Contributor Author

noklam commented Jul 28, 2022

@AntonyMilneQB I can't find any documentation or guarantee about them, I tend to believe they are more or less the same. But I changed it anyway, let's stick with the StackOverflow answer.

@noklam
Copy link
Contributor Author

noklam commented Aug 3, 2022

@willmcgugan Sorry for tagging you directly, do you need more to get this approved?

@willmcgugan
Copy link
Collaborator

Bear with me. Will review PRs within a week or two.

@noklam
Copy link
Contributor Author

noklam commented Aug 3, 2022

Thank you!

Copy link
Collaborator

@willmcgugan willmcgugan left a comment

Choose a reason for hiding this comment

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

Really don't like this at all, but its no worse than previous code.

@noklam
Copy link
Contributor Author

noklam commented Sep 19, 2022

@willmcgugan Agree, unfortunately there aren't better way to detect a databricks environment. We have to include something similar because the Rich traceback hook interfere with Databricks notebook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Databricks is not identified as Jupyter
4 participants