Skip to content

Conversation

@henchaves
Copy link
Member

Description

This PR aims to fix the code snippet displayed for a custom testing function.
Basically, we must provide to user the code to instantiate GiskardClient and download the testing function.
Also, we should provide the code to download a slicing function/transformation function if they are linked to the given testing function.

Related Issue

GSK-1506 (available on Linear)

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 Aug 7, 2023

GSK-1506 Code snippet for pickled function (and default values) does not work

image.png

When I open a pickled function (custom tag) from the catalog, the code snippet is wrong.

It should be:

import giskard

client = giskard.GiskardClient(
    url="http://localhost:9000",  # URL of your Giskard instance
    token="ey...")

# Download artifacts
identity = giskard.SlicingFunction.download("a880b7c6-9db2-5e27-9273-488c10f08dcc", client)

#Download test
always_pass = giskard.GiskardTest.download("4e0ef6cc-ad0c-5a24-b9f5-a2fea349faae", client)

# Execute code
test_result, passed = always_pass(slicing_function=identity)

print(f"TEST RESULT: {test_result} - PASSED: {passed}")

@henchaves henchaves self-assigned this Aug 7, 2023
@henchaves henchaves marked this pull request as ready for review August 25, 2023 10:39
.value()
.filter(i => i !== 'str'),
selected.value.name
.filter(i => i !== 'str')
Copy link
Member

Choose a reason for hiding this comment

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

I think that we should ignore any primitives (int, float, 'str, bool, ...).

Copy link
Member

Choose a reason for hiding this comment

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

Furthermore we also only need to import when the default value is set

Copy link
Member Author

Choose a reason for hiding this comment

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

Furthermore we also only need to import when the default value is set

The line 196 creates an array of only required params

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

2.9% 2.9% Coverage
0.0% 0.0% Duplication

@henchaves henchaves merged commit a0912c1 into main Aug 30, 2023
@Hartorn Hartorn deleted the feature/gsk-1506-code-snippet-for-pickled-function-and-default-values-does branch September 13, 2023 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants