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

feat: add progress bar for magics #396

Merged
merged 5 commits into from
Dec 2, 2020

Conversation

HemangChothani
Copy link
Contributor

Fixes #389

@HemangChothani HemangChothani requested review from tswast and a team November 20, 2020 15:20
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 20, 2020
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Nov 20, 2020
@@ -182,6 +182,7 @@ def __init__(self):
self._default_query_job_config = bigquery.QueryJobConfig()
self._bigquery_client_options = client_options.ClientOptions()
self._bqstorage_client_options = client_options.ClientOptions()
self._progress_bar_type = None
Copy link
Contributor

Choose a reason for hiding this comment

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

I think tqdm would be fine default value here

Copy link
Contributor Author

@HemangChothani HemangChothani Dec 1, 2020

Choose a reason for hiding this comment

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

If i put tqdm as a default value anywhere in the code, test_jupyter_tutorial(ipython) snippet failed, you can see in the first commit. It's because tqdm is not installed.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's because there's a bug in the progress bar code.

       if progress_bar_type is None:
            return query_job.result()

This is too soon to check if a progress bar can be supported. We should check if progress_bar is None after

        progress_bar = get_progress_bar(
            progress_bar_type, "Query is running", default_total, "query"
        )

Something like

        """Return query result and display a progress bar while the query running, if tqdm is installed."""
        progress_bar = get_progress_bar(
            progress_bar_type, "Query is running", default_total, "query"
        )
        if progress_bar is None:
            return query_job.result()

        default_total = 1
        current_stage = None
        start_time = time.time()

@tswast tswast merged commit 04d0273 into googleapis:master Dec 2, 2020
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 API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

show progress bar in %%bigquery magics
2 participants