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
Merged

Conversation

@HemangChothani
Copy link
Contributor

@HemangChothani HemangChothani commented Nov 20, 2020

Fixes #389

@@ -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

@tswast tswast Nov 30, 2020

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

Loading

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.

Loading

Copy link
Contributor

@tswast tswast Dec 1, 2020

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()

Loading

tswast
tswast approved these changes Dec 2, 2020
@tswast tswast merged commit 04d0273 into googleapis:master Dec 2, 2020
10 checks passed
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants