Skip to content

chore: ensure colab sample notebooks are tested #351

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

Merged
merged 14 commits into from
Jan 30, 2024
Merged

Conversation

tswast
Copy link
Collaborator

@tswast tswast commented Jan 26, 2024

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes internal issue 321013333
🦕

@tswast tswast requested review from a team as code owners January 26, 2024 17:13
@tswast tswast requested a review from GarrettWu January 26, 2024 17:13
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Jan 26, 2024
@tswast tswast requested review from ashleyxuu and removed request for GarrettWu January 26, 2024 17:13
@product-auto-label product-auto-label bot added api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. samples Issues that are directly related to samples. labels Jan 26, 2024
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@tswast
Copy link
Collaborator Author

tswast commented Jan 26, 2024

Tested locally, and the session is now passing:

$ nox -r -s notebook-3.9
nox > Running session notebook-3.9
nox > Re-using existing virtual environment at .nox/notebook-3-9.
nox > python -m pip install -e '.[all]'
nox > python -m pip install pytest pytest-xdist pytest-retry nbmake google-cloud-aiplatform matplotlib seaborn
nox > python /usr/local/google/home/swast/src/bigframes/scripts/notebooks_fill_params.py notebooks/regression/easy_linear_regression.ipynb notebooks/regression/sklearn_linear_regression.ipynb notebooks/dataframes/dataframe.ipynb notebooks/generative_ai/bq_dataframes_llm_kmeans.ipynb notebooks/generative_ai/large_language_models.ipynb notebooks/generative_ai/bq_dataframes_llm_code_generation.ipynb notebooks/visualization/bq_dataframes_covid_line_graphs.ipynb notebooks/remote_functions/remote_function.ipynb notebooks/getting_started/getting_started_bq_dataframes.ipynb
nox > py.test --nbmake --nbmake-timeout=900 -nauto notebooks/regression/easy_linear_regression.ipynb notebooks/regression/sklearn_linear_regression.ipynb notebooks/dataframes/dataframe.ipynb notebooks/generative_ai/bq_dataframes_llm_kmeans.ipynb notebooks/generative_ai/large_language_models.ipynb notebooks/generative_ai/bq_dataframes_llm_code_generation.ipynb notebooks/visualization/bq_dataframes_covid_line_graphs.ipynb notebooks/remote_functions/remote_function.ipynb notebooks/getting_started/getting_started_bq_dataframes.ipynb
============================================================ test session starts ============================================================
platform linux -- Python 3.9.16, pytest-7.4.4, pluggy-1.4.0
rootdir: /usr/local/google/home/swast/src/bigframes
configfile: pytest.ini
plugins: retry-1.6.1, xdist-3.5.0, mock-3.12.0, nbmake-1.4.6
12 workers [9 items]      
.........                                                                                                                             [100%]
======================================================= 9 passed in 751.43s (0:12:31) =======================================================
nox > python /usr/local/google/home/swast/src/bigframes/scripts/notebooks_restore_from_backup.py notebooks/regression/easy_linear_regression.ipynb notebooks/regression/sklearn_linear_regression.ipynb notebooks/dataframes/dataframe.ipynb notebooks/generative_ai/bq_dataframes_llm_kmeans.ipynb notebooks/generative_ai/large_language_models.ipynb notebooks/generative_ai/bq_dataframes_llm_code_generation.ipynb notebooks/visualization/bq_dataframes_covid_line_graphs.ipynb notebooks/remote_functions/remote_function.ipynb notebooks/getting_started/getting_started_bq_dataframes.ipynb
nox > py.test --nbmake --nbmake-timeout=900 notebooks/location/regionalized.ipynb
nox > py.test --nbmake --nbmake-timeout=900 notebooks/location/regionalized.ipynb
nox > py.test --nbmake --nbmake-timeout=900 notebooks/location/regionalized.ipynb
nox > py.test --nbmake --nbmake-timeout=900 notebooks/location/regionalized.ipynb
nox > py.test --nbmake --nbmake-timeout=900 notebooks/location/regionalized.ipynb
nox > py.test --nbmake --nbmake-timeout=900 notebooks/location/regionalized.ipynb
============================================================ test session starts ============================================================
platform linux -- Python 3.9.16, pytest-7.4.4, pluggy-1.4.0
rootdir: /usr/local/google/home/swast/src/bigframes
configfile: pytest.ini
plugins: retry-1.6.1, xdist-3.5.0, mock-3.12.0, nbmake-1.4.6
collected 1 item                                                                                                                            

notebooks/location/regionalized.ipynb ============================================================ test session starts ============================================================
platform linux -- Python 3.9.16, pytest-7.4.4, pluggy-1.4.0
rootdir: /usr/local/google/home/swast/src/bigframes
configfile: pytest.ini
plugins: retry-1.6.1, xdist-3.5.0, mock-3.12.0, nbmake-1.4.6
collecting ... ============================================================ test session starts ============================================================
platform linux -- Python 3.9.16, pytest-7.4.4, pluggy-1.4.0
collected 1 item                                                                                                                            

notebooks/location/regionalized.ipynb ============================================================ test session starts ============================================================
platform linux -- Python 3.9.16, pytest-7.4.4, pluggy-1.4.0
rootdir: /usr/local/google/home/swast/src/bigframes
configfile: pytest.ini
plugins: retry-1.6.1, xdist-3.5.0, mock-3.12.0, nbmake-1.4.6
collecting ... rootdir: /usr/local/google/home/swast/src/bigframes
configfile: pytest.ini
plugins: retry-1.6.1, xdist-3.5.0, mock-3.12.0, nbmake-1.4.6
collecting ... ============================================================ test session starts ============================================================
platform linux -- Python 3.9.16, pytest-7.4.4, pluggy-1.4.0
collected 1 item                                                                                                                            

notebooks/location/regionalized.ipynb rootdir: /usr/local/google/home/swast/src/bigframes
configfile: pytest.ini
plugins: retry-1.6.1, xdist-3.5.0, mock-3.12.0, nbmake-1.4.6
collected 1 item                                                                                                                            

collected 1 item                                                                                                                            

notebooks/location/regionalized.ipynb ============================================================ test session starts ============================================================
platform linux -- Python 3.9.16, pytest-7.4.4, pluggy-1.4.0
rootdir: /usr/local/google/home/swast/src/bigframes
configfile: pytest.ini
plugins: retry-1.6.1, xdist-3.5.0, mock-3.12.0, nbmake-1.4.6
collected 1 item                                                                                                                            

notebooks/location/regionalized.ipynb .                                                                                               [100%]

======================================================= 1 passed in 122.27s (0:02:02) =======================================================
.                                                                                               [100%]

======================================================= 1 passed in 132.72s (0:02:12) =======================================================
.                                                                                               [100%]

======================================================= 1 passed in 135.59s (0:02:15) =======================================================
.                                                                                               [100%]

======================================================= 1 passed in 139.97s (0:02:19) =======================================================
.                                                                                               [100%]

======================================================= 1 passed in 147.41s (0:02:27) =======================================================
.                                                                                               [100%]

======================================================= 1 passed in 189.72s (0:03:09) =======================================================
nox > Session notebook-3.9 was successful.

@@ -719,16 +733,33 @@ def notebook(session):
pytest_command = [
"py.test",
"--nbmake",
"--nbmake-timeout=600",
"--nbmake-timeout=900", # 15 minutes
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why we increase the timeout limit specifically to 15 mins. Do we test the boundary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The default was too slow for the LLM sample when I tested locally.

"notebooks/getting_started/getting_started_bq_dataframes.ipynb",
"notebooks/getting_started/ml_fundamentals_bq_dataframes.ipynb",
"notebooks/generative_ai/bq_dataframes_llm_code_generation.ipynb",
"notebooks/generative_ai/bq_dataframes_llm_kmeans.ipynb",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need DATASET when running bf.read_gbq()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@ashleyxuu ashleyxuu Jan 26, 2024

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a read, which doesn't need to be parametrized. DATASET is used a a destination in the other samples.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks got it!

@tswast tswast requested a review from ashleyxuu January 29, 2024 16:21
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Jan 29, 2024
@tswast
Copy link
Collaborator Author

tswast commented Jan 29, 2024

Looks like bq_dataframes_llm_code_generation had a failure (https://fusion2.corp.google.com/invocations/516e88fd-c9b4-4960-82a4-22bddcab71e9/targets/bigframes%2Fpresubmit%2Fe2e/log). Trying a change that will hopefully help regarding the GCS bucket that sample creates.

@tswast
Copy link
Collaborator Author

tswast commented Jan 29, 2024

Still have a failing notebook test after dfee838 I'll maybe revert that commit and exclude that particular notebook for now.

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Jan 29, 2024
@product-auto-label product-auto-label bot removed the size: l Pull request size is large. label Jan 29, 2024
@tswast tswast added the automerge Merge the pull request once unit tests and other checks pass. label Jan 29, 2024
Copy link

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, one of your required reviews was not approved, or there is a do not merge label. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot.

@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Jan 30, 2024
@tswast tswast merged commit 5aad3a1 into main Jan 30, 2024
@tswast tswast deleted the b321013333-notebook-tests branch January 30, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. samples Issues that are directly related to samples. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants