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

[FEATURE] Add YAML config option to disable progress bars #3794

Merged
merged 43 commits into from Jan 4, 2022

Conversation

cdkini
Copy link
Member

@cdkini cdkini commented Dec 3, 2021

Changes proposed in this pull request:

Definition of Done

Please delete options that are not relevant.

  • My code follows the Great Expectations style guide
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added unit tests where applicable and made sure that new and existing tests are passing.
  • I have run any local integration tests and made sure that nothing is broken.

Thank you for submitting!

@netlify
Copy link

netlify bot commented Dec 3, 2021

✔️ Deploy Preview for niobium-lead-7998 ready!

🔨 Explore the source changes: a4352f3

🔍 Inspect the deploy log: https://app.netlify.com/sites/niobium-lead-7998/deploys/61d4ca1adc7b8c0008befb57

😎 Browse the preview: https://deploy-preview-3794--niobium-lead-7998.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2021

HOWDY! This is your friendly 🤖 CHANGELOG bot 🤖

Please don't forget to add a clear and succinct description of your change under the Develop header in docs_rtd/changelog.rst, if applicable. This will help us with the release process. See the Contribution checklist in the Great Expectations documentation for the type of labels to use!

Thank you!

@cdkini cdkini self-assigned this Dec 3, 2021
@cdkini cdkini changed the title [WIP][FEATURE] Add YAML config option to disable progress bars [FEATURE] Add YAML config option to disable progress bars Dec 14, 2021
@cdkini cdkini marked this pull request as ready for review December 14, 2021 23:11
Comment on lines 1096 to 1101
def is_enabled(self, key: str) -> bool:
if super().__getitem__("globally") is False:
return False
elif super().__getitem__(key) is False:
return False
return True
Copy link
Member Author

Choose a reason for hiding this comment

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

Am I getting this relationship correct? Global has the ability to shut down everything even if profilers or metric_calculations is enabled?

Comment on lines 697 to 703
if self._data_context:
disable = not self._data_context.progress_bars.is_enabled(
"metric_calculations"
)
else:
disable = len(graph.edges) < 3

Copy link
Member Author

Choose a reason for hiding this comment

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

This is slightly different because we're calculating a boolean and immediately passing it into the tdqm funciton. disable=disable is readable to me but let me know if this should be enable and disable=not enable

Comment on lines 1 to 8
from great_expectations.data_context import BaseDataContext
from great_expectations.data_context.types.base import (
ConcurrencyConfig,
DataContextConfig,
InMemoryStoreBackendDefaults,
ProgressBarConfig,
)

Copy link
Member Author

Choose a reason for hiding this comment

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

Couldn't find a good location for tests so I took the existing test_concurrency_config and made it more general

Copy link
Contributor

@talagluck talagluck left a comment

Choose a reason for hiding this comment

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

Looks good overall! A few suggestions for adjustments in functionality. It would also be good to add some documentation for this one.

Comment on lines +1085 to +1100
class ProgressBarsConfig(DictDot):
def __init__(
self,
globally: bool = True,
profilers: bool = True,
metric_calculations: bool = True,
):
self.globally = globally
self.profilers = profilers
self.metric_calculations = metric_calculations


class ProgressBarsConfigSchema(Schema):
globally = fields.Boolean(default=True)
profilers = fields.Boolean(default=True)
metric_calculations = fields.Boolean(default=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this automatically create this field when a new Great Expectations project is initialized? I want to make sure that we make this option available through the Data Context, but also that we don't add a mandatory field to the Data Context, so we don't run into an issue where every new Data Context created won't work with older version of Great Expectations, unless the user specifically wants this feature.

Now that I think about it, I think that the same issue might have happened a couple of times with concurrency, and I wonder if we should treat that in the same way.

Copy link
Member Author

Choose a reason for hiding this comment

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

when creating a new DataContext through v3 init, I don't see this field nor concurrency. Let's discuss this live to make sure I'm capturing everything

Comment on lines 133 to 138
progress_bars = context.progress_bars
if progress_bars.get("globally") is False:
self._enable_progress_bars = False
elif progress_bars.get("profilers") is False:
self._enable_progress_bars = False

Copy link
Contributor

Choose a reason for hiding this comment

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

I would expect that progress_bars.get("profilers") would override progress_bars.get("globally") irrespective of whether it is True or False. So something like:

Suggested change
progress_bars = context.progress_bars
if progress_bars.get("globally") is False:
self._enable_progress_bars = False
elif progress_bars.get("profilers") is False:
self._enable_progress_bars = False
progress_bars = context.progress_bars
self._enable_progress_bars = progress_bars.get("globally")
if progress_bars.get("profilers") is not None:
self._enable_progress_bars = progress_bars.get("profilers")

Copy link
Member Author

Choose a reason for hiding this comment

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

ah yes that's what we had discussed! I knew I was missing something 🙇🏽

Comment on lines 700 to 704
if progress_bars.get("globally") is False:
disable = True
elif progress_bars.get("metric_calculations") is False:
disable = True

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above in Profilers.

@@ -689,12 +693,21 @@ def resolve_validation_graph(
validation_graph=graph, metrics=metrics
)

# Check to see if the user has disabled progress bars
disable = len(graph.edges) < 3
Copy link
Contributor

Choose a reason for hiding this comment

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

How did you arrive at this?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was the previous condition as set by Alex! I didn't want to remove old behavior so in the case we've enabled the progress bars, that original conditional still applies

Comment on lines 698 to 703
if self._data_context:
progress_bars = self._data_context.progress_bars
if "globally" in progress_bars:
disable = not progress_bars["globally"]
if "metric_calculations" in progress_bars:
disable = not progress_bars["metric_calculations"]
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
if self._data_context:
progress_bars = self._data_context.progress_bars
if "globally" in progress_bars:
disable = not progress_bars["globally"]
if "metric_calculations" in progress_bars:
disable = not progress_bars["metric_calculations"]
if self._data_context:
progress_bars = self._data_context.progress_bars
if "globally" in progress_bars:
disable = not progress_bars["globally"]
if "metric_calculations" in progress_bars:
disable = not progress_bars["metric_calculations"]
Suggested change
if self._data_context:
progress_bars = self._data_context.progress_bars
if "globally" in progress_bars:
disable = not progress_bars["globally"]
if "metric_calculations" in progress_bars:
disable = not progress_bars["metric_calculations"]
if self._data_context:
progress_bars = self._data_context.progress_bars
if "globally" in progress_bars:
disable = not progress_bars["globally"]
if "metric_calculations" in progress_bars:
disable = not progress_bars["metric_calculations"]
if len(graph.edges) < 3:
disable = True

Copy link
Contributor

@talagluck talagluck left a comment

Choose a reason for hiding this comment

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

LGTM! Have you done manual testing to confirm that the progress_bars key doesn't write to a DataContext config if null, and that this won't populate a new DataContext by default? Assuming so, this is all set! Otherwise one other non-gating question. Nice work!

@@ -1187,3 +1189,48 @@ def test_expect_compound_columns_to_be_unique(
}

assert expected_expectations == expectations_from_suite


@mock.patch("great_expectations.profile.user_configurable_profiler.tqdm")
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting - is this checking to see if the library was called?

Copy link
Member Author

Choose a reason for hiding this comment

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

yup! the mock object has called and called_list attrs so we can use those to investigate the behavior without actually using the lib

@cdkini cdkini enabled auto-merge (squash) January 4, 2022 22:11
@cdkini cdkini force-pushed the feature/devrel-766/option-to-disable-progress-bars branch from 7e6be55 to a4352f3 Compare January 4, 2022 22:28
@cdkini cdkini merged commit 5168f73 into develop Jan 4, 2022
@cdkini cdkini deleted the feature/devrel-766/option-to-disable-progress-bars branch January 4, 2022 23:15
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.

None yet

3 participants