Skip to content

Conversation

@kevinmessiaen
Copy link
Member

@kevinmessiaen kevinmessiaen commented Feb 26, 2024

Description

Added an upload method to the TestResult in order to allow saving them to the Hub.

The method have the following params:

  • label: Option[str], defailt None the label of the execution. If None the execution date will be the label

Example code to execute:

import os

import giskard

os.environ['OPENAI_API_KEY']='sk-...'

client = giskard.GiskardClient(url='http://localhost:9000', key='gsk-...')
suite_id = 1
suite = giskard.Suite.download(client, 'project_key', suite_id)
result = suite.run()
result.upload(client)

Cleanup of test result information sent to up

Removed unused inforamtion:

actualSlicesSize: List[int] # Unused
referenceSlicesSize: List[int] # Unused
partialUnexpectedIndexList: List[int] # Unused
unexpectedIndexList: List[int] # Unused
missingCount: int # Unused
missingPercent: float # Unused, computable
unexpectedCount: int # Unused
unexpectedPercent: float # Unused, computable
unexpectedPercentTotal: float # Unused
unexpectedPercentNonmissing: float # Unused, computable

Related Issue

Type of Change

  • 📚 Examples / docs / tutorials / dependencies update
  • 🔧 Bug fix (non-breaking change which fixes an issue)
  • 🥂 Improvement (non-breaking change which improves an existing feature)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🔐 Security fix

@linear
Copy link

linear bot commented Feb 26, 2024

@kevinmessiaen kevinmessiaen marked this pull request as draft February 26, 2024 08:25
@kevinmessiaen kevinmessiaen marked this pull request as ready for review February 26, 2024 10:43


class TestSuiteExecutionResult(str, Enum):
IN_PROGRESS = ("IN_PROGRESS",)
Copy link
Member

Choose a reason for hiding this comment

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

Why ( "", ), and "ERROR" ? are the parenthesis needed ?

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad I added unnecessary commas and the pre-commit reformatted like that

metadata: Dict[str, List[str]]


class SaveSuiteTestExecutionDTO(ConfiguredBaseModel):
Copy link
Member

Choose a reason for hiding this comment

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

That's a lot of data. Everything is needed ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Everything is saved into the Hub.

I agree that we don't use nor need all those information into the Hub. We might probably want to cleanup everything. (Both from Hub and programatic execution)

def _test_result_to_dto(result: SuiteResult):
datasets = {dataset.id: dataset for dataset in result.params.values() if isinstance(dataset, Dataset)}

return SaveSuiteTestExecutionDTO(
Copy link
Member

Choose a reason for hiding this comment

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

How do we have so many field 😱

Copy link
Member Author

Choose a reason for hiding this comment

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

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 can work work on this on this PR it's relatively safe to clean this up

@kevinmessiaen kevinmessiaen changed the title GSK-2418 Add a method to execute test suite and upload result to Hub programmatically GSK-2902 GSK-2418 Add a method to execute test suite and upload result to Hub programmatically + result cleanup Feb 27, 2024
@linear
Copy link

linear bot commented Feb 27, 2024

Copy link
Member

@Hartorn Hartorn left a comment

Choose a reason for hiding this comment

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

I did give this PR a try, and had some issues :

  • I had some issues with suite_id not being set (I added a commit for this)
  • I cannot debug uploaded test results (issue with uuid badly formatted ?
  • when executing test suite from downloaded one, the labels are different (maybe unrelated)

@Hartorn
Copy link
Member

Hartorn commented Feb 28, 2024

Execution in hub
image

Execution in notebook uploaded (see with uuid)
image

Finally download + execution in notebook + uploade (see label of tests)
image

The notebook
wage_classification.zip

@kevinmessiaen
Copy link
Member Author

@Hartorn Thanks for the feedback, I fixed the issue with the uuid being wrongly formatted (yes those are also used for debugging so that's why it fails)

@Hartorn
Copy link
Member

Hartorn commented Feb 29, 2024

@kevinmessiaen I did try it again, but still cannot debug

Internal Server Error
Query did not return a unique result: 14 results were returned

@kevinmessiaen
Copy link
Member Author

@kevinmessiaen I did try it again, but still cannot debug

Internal Server Error
Query did not return a unique result: 14 results were returned

Yes it was the wrong id send (suite_id instead of suite_test_id).

I updated the save so that we can keep track of all generated ids properly

@Hartorn Hartorn force-pushed the GSK-2418 branch 2 times, most recently from b93076a to c7eabb1 Compare March 5, 2024 18:30
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2024

@Hartorn Hartorn merged commit 6b5ccf3 into main Mar 6, 2024
@Hartorn Hartorn deleted the GSK-2418 branch March 6, 2024 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants