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
[FEATURE] Add YAML config option to disable progress bars #3794
Conversation
✔️ 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 |
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 ✨ Thank you! ✨ |
…tions into feature/devrel-766/option-to-disable-progress-bars
…great-expectations/great_expectations into feature/devrel-766/option-to-disable-progress-bars
…tions into feature/devrel-766/option-to-disable-progress-bars
…tions into feature/devrel-766/option-to-disable-progress-bars
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 |
There was a problem hiding this comment.
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?
if self._data_context: | ||
disable = not self._data_context.progress_bars.is_enabled( | ||
"metric_calculations" | ||
) | ||
else: | ||
disable = len(graph.edges) < 3 | ||
|
There was a problem hiding this comment.
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
tests/data_context/test_config.py
Outdated
from great_expectations.data_context import BaseDataContext | ||
from great_expectations.data_context.types.base import ( | ||
ConcurrencyConfig, | ||
DataContextConfig, | ||
InMemoryStoreBackendDefaults, | ||
ProgressBarConfig, | ||
) | ||
|
There was a problem hiding this comment.
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
…tions into feature/devrel-766/option-to-disable-progress-bars
There was a problem hiding this 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.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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 | ||
|
There was a problem hiding this comment.
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:
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") | |
There was a problem hiding this comment.
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 🙇🏽
if progress_bars.get("globally") is False: | ||
disable = True | ||
elif progress_bars.get("metric_calculations") is False: | ||
disable = True | ||
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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 |
…tions into feature/devrel-766/option-to-disable-progress-bars
…tions into feature/devrel-766/option-to-disable-progress-bars
…github.com:great-expectations/great_expectations into feature/devrel-766/option-to-disable-progress-bars
…tions into feature/devrel-766/option-to-disable-progress-bars
There was a problem hiding this 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") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
7e6be55
to
a4352f3
Compare
Changes proposed in this pull request:
Definition of Done
Please delete options that are not relevant.
Thank you for submitting!