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

[5/n] Adds integration test for disabling snapshots #1404

Conversation

likawind
Copy link
Contributor

@likawind likawind commented Jun 3, 2023

Describe your changes and why you are making these changes

This PR adds integration tests for disabling snapshots. To properly examine the exec states of flows, we also added exec state tracking for all artifact types.

Also included a fix for ENG-3103 to fix datetime parsing

Related issue number (if any)

ENG-3000 ENG-3103

Tests

  • Integration tests on this PR should succeed, implying new feature working and no regressions.
  • Manual UI testing covered in previous PR [4/n] Add UI changes to render deleted artifacts #1401
  • Tested on a cleaner build to verify requirements.txt are updated (install only using pip install . and install_local script, without install from a pypi package).

Checklist before requesting a review

  • I have created a descriptive PR title. The PR title should complete the sentence "This PR...".
  • I have performed a self-review of my code.
  • I have included a small demo of the changes. For the UI, this would be a screenshot or a Loom video.
  • If this is a new feature, I have added unit tests and integration tests.
  • I have run the integration tests locally and they are passing.
  • I have run the linter script locally (See python3 scripts/run_linters.py -h for usage).
  • All features on the UI continue to work correctly.
  • Added one of the following CI labels:
    • run_integration_test: Runs integration tests
    • skip_integration_test: Skips integration tests (Should be used when changes are ONLY documentation/UI)

@likawind likawind added the run_integration_test Triggers integration tests label Jun 3, 2023
…to eng-3000-allow-users-to-opt-out-of-data-snapshots-5
…to eng-3000-allow-users-to-opt-out-of-data-snapshots-5
…to eng-3000-allow-users-to-opt-out-of-data-snapshots-5
if self._execution_status != ExecutionStatus.SUCCEEDED:
if (
not self._execution_state
or self._execution_state.status != ExecutionStatus.SUCCEEDED
Copy link
Contributor

Choose a reason for hiding this comment

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

Um shouldn't this return None if the artifact was deleted? The error message talks about "computed successfully!" which is true when status is Deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good catch! It's interesting that we are not handling other state though. Following the same argument I think we should. I will just address the DELETE state in this PR though

Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean by handling other state? None of the other states computed the artifact successfully.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean for fetched workflow runs, it's reasonable to call .get() even if the artifact is with fail / cancel / pending state with less blocking behavior like throwing this error

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I think we just wanted to disambiguate a failed artifact vs an operator that returned None.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, in that way I will add a few lines to print warning message if the artifact is deleted

@@ -669,10 +668,10 @@ def get_artifact_result_data(
if "data" in parsed_response:
return_value = deserialize(serialization_type, artifact_type, parsed_response["data"])

if execution_status != ExecutionStatus.SUCCEEDED:
if not execution_state or execution_state.status != ExecutionStatus.SUCCEEDED:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question here about handling of DELETED status. Can we get away with just returning return_value in that case (if it's None?)

Copy link
Contributor

Choose a reason for hiding this comment

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

@likawind was this addressed? I'm not sure it's clear to me what happens when you call this on a deleted artifact. It would be great if that was in the function's docstring too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh oh this line just prints a warning and doesn't affects the execution flow

Copy link
Contributor

Choose a reason for hiding this comment

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

oh I missed that lol. Can you note that DELETED -> None in the docstring though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah updated the warning message and docstring

@likawind
Copy link
Contributor Author

likawind commented Jun 6, 2023

@kenxu95 thanks for the feedbacks! updated

Copy link
Contributor

@kenxu95 kenxu95 left a comment

Choose a reason for hiding this comment

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

It's good, I just had one blocking comment about get_artifact_result_data()

sdk/aqueduct/artifacts/generic_artifact.py Show resolved Hide resolved
@@ -128,6 +129,9 @@ def head(self, n: int = 5, parameters: Optional[Dict[str, Any]] = None) -> pd.Da
A dataframe containing the table contents of this artifact.
"""
df = self.get(parameters=parameters)
if df is None:
return None
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: slightly more python for `return df.head(n) if df else None?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh actually I do this intentionally as I believe if df will be False if df is empty. But we can shrink that to one line though

@@ -669,10 +668,10 @@ def get_artifact_result_data(
if "data" in parsed_response:
return_value = deserialize(serialization_type, artifact_type, parsed_response["data"])

if execution_status != ExecutionStatus.SUCCEEDED:
if not execution_state or execution_state.status != ExecutionStatus.SUCCEEDED:
Copy link
Contributor

Choose a reason for hiding this comment

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

@likawind was this addressed? I'm not sure it's clear to me what happens when you call this on a deleted artifact. It would be great if that was in the function's docstring too

@@ -669,10 +668,10 @@ def get_artifact_result_data(
if "data" in parsed_response:
return_value = deserialize(serialization_type, artifact_type, parsed_response["data"])

if execution_status != ExecutionStatus.SUCCEEDED:
if not execution_state or execution_state.status != ExecutionStatus.SUCCEEDED:
Copy link
Contributor

Choose a reason for hiding this comment

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

oh I missed that lol. Can you note that DELETED -> None in the docstring though.

Copy link
Contributor

@cw75 cw75 left a comment

Choose a reason for hiding this comment

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

LGTM!

@likawind likawind merged commit d503533 into eng-3000-allow-users-to-opt-out-of-data-snapshots-4 Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run_integration_test Triggers integration tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants