Skip to content

Improve error message when trying to define an existing variant #530

@R-Palazzo

Description

@R-Palazzo

Environment Details

  • SDGym version: 0.12.1

Error Description

Calling create_synthesizer_variant() twice with the same display_name raises a confusing error:

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

This appears to happen when a variant with the given display_name already exists. SDGym should detect duplicates and raise a clear error (e.g. ValueError: Variant 'HSA_2Clusters' already exists. Choose a different name.).

Steps to reproduce

from sdgym import create_synthesizer_variant

HSA_2Clusters = create_synthesizer_variant(
  synthesizer_class='HSASynthesizer',
  synthesizer_parameters={'default_num_clusters': 2},
  display_name='HSA_2Clusters'
)

HSA_2Clusters = create_synthesizer_variant(
  synthesizer_class='HSASynthesizer',
  synthesizer_parameters={'default_num_clusters': 2},
  display_name='HSA_2Clusters'
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions