Skip to content

Fix Recursion Issue in OCIDatascienceModel Due to is_model_by_reference Conflict in New OCI SDK #1073

New issue

Have a question about this project? Sign up for a free account to open an issue and contact its maintainers and the community.

By clicking “Sign up for ”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on ? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

mrDzurb
Copy link
Member

Description

This PR resolves a recursion issue that occurred when creating a new model in Model Catalog (MC) with the new OCI SDK version.

Issue:

The new oci.data_science.models.Model introduced an is_model_by_reference field, which conflicts with the existing is_model_by_reference property in OCIDatascienceModel.
Since OCIDatascienceModel inherits from oci.data_science.models.Model, having the same attribute name caused recursive calls when serializing the model using sanitize_for_serialization from the OCI SDK.
This led to failures when attempting to create a new model in MC.

Fix:

Renamed is_model_by_reference to _is_model_by_reference in OCIDatascienceModel to prevent recursion and ensure compatibility with the new OCI SDK.

Impact:

  • Fixes model creation failures in Model Catalog.
  • Ensures compatibility with the new OCI SDK.
  • Maintains backward compatibility with existing MC records.

Test

from ads.model.service.oci_datascience_model import OCIDataScienceModel

OCI_MODEL_PAYLOAD = {
    "compartment_id": "ocid1.compartment.oc1..<unique_ocid>",
    "project_id": "ocid1.datascienceproject.oc1.iad.<unique_ocid>",
    "display_name": "Generic Model With Small Artifact new",
    "description": "The model description",
    "lifecycle_state": "ACTIVE",
    "created_by": "ocid1.user.oc1..<unique_ocid>",
    "freeform_tags": {"key1": "value1"},
    "defined_tags": {"key1": {"skey1": "value1"}},
    "time_created": "2025-08-24T17:07:39.200000Z",
}

OCIDataScienceModel(**OCI_MODEL_PAYLOAD).to_dict()

@oracle-contributor-agreementoracle-contributor-agreement bot added the OCA VerifiedAll contributors have signed the Oracle Contributor Agreement.label Feb 14, 2025
@github-actionsGitHub Actions
Copy link

-actions bot commented Feb 14, 2025

📌 Cov diff with main:

Coverage-100%

📌 Overall coverage:

Coverage-56.68%

@mrDzurbmrDzurb enabled auto-merge February 14, 2025 18:10
@mrDzurbmrDzurb merged commit d50c68e into main Feb 14, 2025
21 checks passed
@qiuosier
Copy link
Member

qiuosier commented Mar 4, 2025

Actually in the OCI SDK, attributes are always defined with both attr and _attr. Both is_model_by_reference and _ is_model_by_reference are defined in the new SDK. The change in this PR will still cause a conflict. We need to rename this attribute to something else.
image

Sign up for free to join this conversation on . Already have an account? Sign in to comment
Labels
OCA VerifiedAll contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants