Navigation Menu

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

[MAINTENANCE] Small refactor of ExecutionEngine.resolve_metrics() for better code readability (and miscellaneous additional clean up) #6587

Conversation

alexsherstinsky
Copy link
Contributor

Please annotate your PR title to describe what the PR does, then give a brief bulleted description of your PR below. PR titles should begin with [BUGFIX], [FEATURE], [DOCS], [MAINTENANCE], or [CONTRIB]. If a new feature introduces breaking changes for the Great Expectations API or configuration files, please also add [BREAKING]. You can read about the tags in our contributor checklist.

Changes proposed in this pull request:

  • JIRA: GREAT-1347/GREAT-181/GREAT-1445

After submitting your PR, CI checks will run and @cla-bot will check for your CLA signature.

For a PR with nontrivial changes, we review with both design-centric and code-centric lenses.

In a design review, we aim to ensure that the PR is consistent with our relationship to the open source community, with our software architecture and abstractions, and with our users' needs and expectations. That review often starts well before a PR, for example in GitHub issues or Slack, so please link to relevant conversations in notes below to help reviewers understand and approve your PR more quickly (e.g. closes #123).

Previous Design Review notes:

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 15, 2022

Deploy Preview for niobium-lead-7998 ready!

Name Link
🔨 Latest commit 37814b7
🔍 Latest deploy log https://app.netlify.com/sites/niobium-lead-7998/deploys/639b52ae4a5a2b000a18b0d9
😎 Deploy Preview https://deploy-preview-6587--niobium-lead-7998.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@alexsherstinsky alexsherstinsky changed the title [MAINTENANCE] Small refactor of ExecutionEngine.resolve_metrics() for better code readability [MAINTENANCE] Small refactor of ExecutionEngine.resolve_metrics() for better code readability (and miscellaneous additional clean up) Dec 15, 2022
@ghost
Copy link

ghost commented Dec 15, 2022

👇 Click on the image for a new way to code review
  • Make big changes easier — review code in small groups of related files

  • Know where to start — see the whole change at a glance

  • Take a code tour — explore the change with an interactive tour

  • Make comments and review — all fully sync’ed with github

    Try it now!

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

@alexsherstinsky alexsherstinsky marked this pull request as ready for review December 15, 2022 10:08
@alexsherstinsky alexsherstinsky requested a review from a team December 15, 2022 10:08
@alexsherstinsky alexsherstinsky enabled auto-merge (squash) December 15, 2022 10:10
@Kilo59 Kilo59 self-requested a review December 15, 2022 14:05
@@ -98,7 +98,7 @@ def active_batch_id(self) -> Optional[str]:
the list of "Batch" objects, each of whose BatchData has already been loaded (and cached). Since BatchData IDs
are from the same name space as Batch IDs, this helps avoid unnecessary loading of data from different backends.
"""
active_batch_data_id: Optional[str] = self._active_batch_data_id
active_batch_data_id: Optional[str] = self.active_batch_data_id
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this a bug? What is the difference between these two attributes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@NathanFarmer Using full property takes advantage of the checks that property method performs -- this is more robust.

metric_fn_bundle_configurations,
)

if metrics is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably want to keep with the pattern used elsewhere: if not metrics

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@NathanFarmer In this case we are actually focusing on "None" (as opposed to "having nothing in it" -- i.e., being "Falsy"). So this is a stronger statement. Happy to discuss. Thanks!

…erstinsky/batch_metric_store/batch_manager/metrics/execution_engine/cleanup_and_resolve_metrics_code_simplification-2022_12_15-280
@@ -444,11 +444,13 @@ def _get_reader_fn(self, reader_method=None, path=None):
f'Unable to find reader_method "{reader_method}" in pandas.'
)

def resolve_metric_bundle( # type: ignore[empty-body]
def resolve_metric_bundle(
self, metric_fn_bundle
Copy link
Member

Choose a reason for hiding this comment

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

@alexsherstinsky can you add an annotation (other than Any) for metric_fn_bundle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Kilo59 No -- this has already been discussed before -- it can be Callable, any of a great many of SqlAlchemy functions, and any of a great many Spark functions. I do not see an easy possibility here. Happy to discuss. Thanks.

Copy link
Member

Choose a reason for hiding this comment

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

Callable is better than no annotation.

@alexsherstinsky alexsherstinsky merged commit 2d38384 into develop Dec 15, 2022
@alexsherstinsky alexsherstinsky deleted the maintenance/GREAT-1347/GREAT-181/GREAT-1445/alexsherstinsky/batch_metric_store/batch_manager/metrics/execution_engine/cleanup_and_resolve_metrics_code_simplification-2022_12_15-280 branch December 15, 2022 17:52
Shinnnyshinshin pushed a commit that referenced this pull request Dec 16, 2022
* develop:
  [FEATURE] Ensure `result_format` accessed is through Checkpoint, and warns users if `Expectation` or `Validator`-level (#6562)
  [BUGFIX] Remove rendered header from Cloud-rendering tests (#6597)
  [MAINTENANCE] Refactor `BaseDataContext` and `DataContext` into factory functions (#6531)
  [MAINTENANCE] Utilize a `StrEnum` for `ConfigPeer` modes (#6596)
  [BUGFIX] Use v3.3.6 or higher of google-cloud-bigquery (with shapely bugfix) (#6590)
  [MAINTENANCE] Add docs snippet checker to `dev` CI (#6594)
  [MAINTENANCE] Leverage `RendererConfiguration` in existing prescriptive templates (3 of 3) (#6530)
  [BUGFIX] Support non-string `datetime` evaluation parameters (#6571)
  [RELEASE] 0.15.41 (#6593)
  [FEATURE] ZEP - PG `BatchSorter` loading + dumping (#6580)
  [MAINTENANCE] Leverage `RendererConfiguration` in existing prescriptive templates (2 of 3) (#6488)
  [MAINTENANCE] Remove `ExplorerDataContext` (#6592)
  [MAINTENANCE] Small refactor of ExecutionEngine.resolve_metrics() for better code readability (and miscellaneous additional clean up) (#6587)
  [MAINTENANCE] `mypy` config update (#6589)
  [BUGFIX] convert_to_json_serializable does not accept numpy datetime (#6553)
  [BUGFIX] Return unique list of batch_definitions (#6579)
  [MAINTENANCE] typo in method name (#6585)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants