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] Misc cleanup of GX Cloud helpers #6352

Merged
merged 14 commits into from
Nov 15, 2022

Conversation

cdkini
Copy link
Member

@cdkini cdkini commented Nov 14, 2022

Changes proposed in this pull request:

  • CONTRACT and SUITE_VALIDATION_RESULT are legacy and have been slated for removal for some time.
  • Classes should utilize the GX prefix
  • get_context() tests should work when you have env vars set
    • Let's delete them using monkeypatch so this is the case

Definition of Done

  • 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 run any local integration tests and made sure that nothing is broken.

@netlify
Copy link

netlify bot commented Nov 14, 2022

Deploy Preview for niobium-lead-7998 ready!

Name Link
🔨 Latest commit 81dbce8
🔍 Latest deploy log https://app.netlify.com/sites/niobium-lead-7998/deploys/6373ad00e3e41f00084efd03
😎 Deploy Preview https://deploy-preview-6352--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.

@ghost
Copy link

ghost commented Nov 14, 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

@cdkini cdkini changed the title [MAINTENANCE] Remove Contract and SuiteValidationResult from GeCloudRESTResource enum [MAINTENANCE] Misc cleanup of GX Cloud helpers Nov 14, 2022
@cdkini cdkini self-assigned this Nov 14, 2022
Comment on lines 162 to 165
# Delete local env vars (if present)
for env_var in GXCloudEnvironmentVariable:
monkeypatch.delenv(env_var, raising=False)

Copy link
Member Author

Choose a reason for hiding this comment

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

Test fails if you have env vars set - let's ensure we clear out our environment for consistent behavior

Copy link
Member

Choose a reason for hiding this comment

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

This seems like something we might want to re-use in a fixture.
clean_cloud_env_vars / no_cloud_env 🤷

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 this was done shortly after!

Comment on lines +8 to +14
class GXCloudEnvironmentVariable(str, Enum):
BASE_URL = "GE_CLOUD_BASE_URL"
ORGANIZATION_ID = "GE_CLOUD_ORGANIZATION_ID"
ACCESS_TOKEN = "GE_CLOUD_ACCESS_TOKEN"


class GeCloudRESTResource(str, Enum):
class GXCloudRESTResource(str, Enum):
Copy link
Member Author

Choose a reason for hiding this comment

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

Most of the changes here are from these renames to GX

Comment on lines -115 to -120
# Chetan - 20220811 - CONTRACT is deprecated by GX Cloud and is to be removed upon migration of E2E tests
GeCloudRESTResource.CONTRACT: "checkpoint_config",
GeCloudRESTResource.DATASOURCE: "datasource_config",
GeCloudRESTResource.DATA_CONTEXT: "data_context_config",
GeCloudRESTResource.DATA_CONTEXT_VARIABLES: "data_context_variables",
GeCloudRESTResource.EXPECTATION_SUITE: "suite",
GeCloudRESTResource.EXPECTATION_VALIDATION_RESULT: "result",
GeCloudRESTResource.PROFILER: "profiler",
GeCloudRESTResource.RENDERED_DATA_DOC: "rendered_data_doc",
# Chetan - 20220812 - SUITE_VALIDATION_RESULT is deprecated by GX Cloud and is to be removed upon migration of E2E tests
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed CONTRACT and SUITE_VALIDATION_RESULT

Comment on lines -27 to -24
SUPPORT_EMAIL = "support@greatexpectations.io"

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to cloud_constants.py

@cdkini cdkini requested a review from a team November 14, 2022 21:54
@@ -1077,7 +1075,7 @@ def save_profiler(
key: Union[GeCloudIdentifier, ConfigurationIdentifier]
if self.ge_cloud_mode:
key = GeCloudIdentifier(
Copy link
Member

Choose a reason for hiding this comment

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

Can we change the name of GeCloudIdentifier, too?

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm as long as Cloud doesn't directly use this! I don't think they though but lemme peruse the Mercury code first

@@ -203,7 +203,7 @@ def from_object(cls, validation_result):
class GeCloudIdentifier(DataContextKey):
Copy link
Member

Choose a reason for hiding this comment

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

^^

@@ -1191,7 +1191,7 @@ def get_profiler(
key: Union[GeCloudIdentifier, ConfigurationIdentifier]
if ge_cloud_id:
key = GeCloudIdentifier(
resource_type=GeCloudRESTResource.PROFILER, ge_cloud_id=ge_cloud_id
resource_type=GXCloudRESTResource.PROFILER, ge_cloud_id=ge_cloud_id
Copy link
Member

Choose a reason for hiding this comment

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

update the method parameter too? from ge_cloud_id to gx_cloud_id?

Copy link
Member Author

Choose a reason for hiding this comment

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

sounds good to me!

@@ -282,10 +282,10 @@ def test_list_keys(
@pytest.mark.unit
def test_remove_key(
construct_ge_cloud_store_backend: Callable[
[GeCloudRESTResource], GeCloudStoreBackend
[GXCloudRESTResource], GeCloudStoreBackend
Copy link
Member

Choose a reason for hiding this comment

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

can we also rename the GeCloudStoreBackend?

Copy link
Member Author

Choose a reason for hiding this comment

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

that may break existing implementations due to our usage of instantiate_class_from_config - do we perhaps want to deprecate that name?

@cdkini cdkini enabled auto-merge (squash) November 15, 2022 14:41
@cdkini cdkini merged commit 9e16f81 into develop Nov 15, 2022
@cdkini cdkini deleted the m/_/clean_up_cloud_rest_resource_enum branch November 15, 2022 15:50
Shinnnyshinshin pushed a commit that referenced this pull request Nov 15, 2022
* develop:
  [MAINTENANCE] Update column_reflection_fallback to also use schema name for Trino (#6350)
  [MAINTENANCE] Misc cleanup of GX Cloud helpers (#6352)
  [MAINTENANCE] Pin `mypy` to `0.990` (#6361)
  Subject: Support to include ID/PK in validation result for each row t… (#5876)
  [MAINTENANCE] Fix computed metrics type hint in ExecutionEngine.resolve_metrics() method (#6347)
  [MAINTENANCE] Refactor `usage_stats_opt_out` method in DataContext (#5339)
  Zep PostgresDatasource returns a list of batches. (#6341)
  [DOCS] Add `yarn snippet-check` command (#6351)
  [MAINTENANCE] Refactor out `termcolor` dependency (#6348)
  [MAINTENANCE] Move Cloud-specific enums to `cloud_constants.py` (#6349)
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.

3 participants