fix: return created dataset/evaluator from create_version, not bool - #6131
fix: return created dataset/evaluator from create_version, not bool#6131papriwal wants to merge 2 commits into
Conversation
Callers previously had to call get()/refresh() to retrieve the ARN.
Thread description through Evaluator.create/get/refresh and AIRHub.import_hub_content, matching DataSet. Also fix a missing positional arg in Evaluator.__init__ that dropped sagemaker_session
|
Claude finished @papriwal's task in 2m 23s —— View job Code ReviewI reviewed the diff ( 1. Failure semantics diverge between the two sibling methods (main concern)
For two sibling entity types with the same method name and near-identical purpose, this is a surprising inconsistency for SDK consumers. A caller writing generic code over both types can't rely on a single contract: one signals failure with a falsy return, the other with an exception. The Suggest picking one convention for both. Raising is generally the more Pythonic choice (a bare Note this is also a subtle backward-incompatibility: existing 2. Preserve the exception chain (
|
Callers previously had to call get()/refresh() to retrieve the ARN.
Description
Fixes two issues in the AI Registry
create_versionAPI forDataSetandEvaluator:DataSet.create_version()andEvaluator.create_version()returned a barebooland silently swallowed exceptions on failure, instead of returning the newly created entity (or raising/returningNoneon failure). Both now return the createdDataSet/Evaluatorinstance.Adds
descriptionsupport toEvaluator, matching the existingDataSetpattern.descriptionis now threaded throughEvaluator.create(),refresh(), andget(), andAIRHub.import_hub_content()now forwardsdescriptionto the underlyingHubContentDescriptionAPI field for both entity types (previously accepted by the AWS API but never exposed by the SDK).Also fixes a pre-existing bug in
Evaluator.__init__'ssuper().__init__()call: it was missing a positional argument, which causedsagemaker_sessionto be silently written into the parent class'sdescriptionslot instead of its own — meaningsagemaker_sessionwas effectively dropped on everyEvaluatorinstance.Testing
create_versionreturning the created entity (success) andNone/raising on failure, for bothDataSetandEvaluator.descriptionreachingAIRHub.import_hub_content's call args for bothDataSet.create()andEvaluator.create().Evaluator.get()correctly reading backdescriptionfrom the API response.test_create_dataset_versionandtest_create_evaluator_versionto assert on the returned entity fromcreate_version()instead of a boolean.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.