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] Update default action list in Checkpoint based on user environment #8074

Merged
merged 11 commits into from
Jun 7, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -2118,6 +2118,8 @@ def _resolve_add_checkpoint_args( # noqa: PLR0913
"Must either pass in an existing checkpoint or individual constructor arguments (but not both)"
)

action_list = action_list or self._determine_default_action_list()
Copy link
Member Author

Choose a reason for hiding this comment

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

I'd love to push this down into the Checkpoint but that would require an isinstance(context, CloudDataContext). Thoughts? Feels a little bad here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps another selling point for CloudCheckpoint?


if not checkpoint:
assert (
name
Expand Down Expand Up @@ -2152,6 +2154,12 @@ def _resolve_add_checkpoint_args( # noqa: PLR0913

return checkpoint

@staticmethod
def _determine_default_action_list() -> Sequence[ActionDict]:
from great_expectations.checkpoint.checkpoint import Checkpoint

return Checkpoint.DEFAULT_ACTION_LIST

@public_api
@new_argument(
argument_name="id",
Expand Down
12 changes: 12 additions & 0 deletions great_expectations/data_context/data_context/cloud_data_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,18 @@ def add_checkpoint( # noqa: PLR0913
)
return self.checkpoint_store.add_or_update_checkpoint(checkpoint)

@staticmethod
def _determine_default_action_list() -> Sequence[ActionDict]:
default_actions = super()._determine_default_action_list()

cloud_actions: Sequence[ActionDict] = []
for action in default_actions:
# Data docs are not relevant to Cloud and should be excluded
if action["action"]["class_name"] != "UpdateDataDocsAction":
cloud_actions.append(action)

return cloud_actions

def list_checkpoints(self) -> Union[List[str], List[ConfigurationIdentifier]]:
return self.checkpoint_store.list_checkpoints(ge_cloud_mode=True)

Expand Down
4 changes: 1 addition & 3 deletions great_expectations/data_context/types/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2855,9 +2855,7 @@ def __init__( # noqa: PLR0913
self._expectation_suite_name = expectation_suite_name
self._expectation_suite_ge_cloud_id = expectation_suite_ge_cloud_id
self._batch_request = batch_request or {}
if action_list is None:
action_list = DataContextConfigDefaults.DEFAULT_ACTION_LIST.value # type: ignore[assignment]
self._action_list = action_list
self._action_list = action_list or []
self._evaluation_parameters = evaluation_parameters or {}
self._runtime_configuration = runtime_configuration or {}
self._validations = validations or []
Expand Down
Loading