Moving a Model Deployment Between Compartments

Move a Data Science model deployment to a different compartment.

For example, you might want to move a model deployment to promote it from a development compartment to production compartment, or to change the visibility of the model.

    1. Use the Console to sign in to a tenancy with the necessary policies.
    2. Open the navigation menu and select Analytics & AI. Under Machine Learning, select Data Science.
    3. Select the compartment that contains the project with the model deployments.

      All projects in the compartment are listed.

    4. Click the name of the project.

      The project details page opens and lists the notebook sessions.

    5. Under Resources, click Model deployments.

      A tabular list of model deployments in the project is displayed.

    6. Click the name of a model deployment.
    7. Click Move Resource.
    8. Select the new compartment for the model deployment.
    9. Click Move Resource.
    A notification is displayed indicating that the model deployment resource is moved to the new compartment successfully. You might notice the status change to Moving. After the move is completed successfully, the status changes back to Active.
  • Use the oci data-science model-deployment change-compartment command and required parameters to change the compartment:

    oci data-science model-deployment change-compartment --compartment-id <compartment-id>.-c [<text>] --model-deployment-id [<text>] .. [OPTIONS]

    For a complete list of flags and variable options for CLI commands, see the CLI Command Reference.

  • Use the ChangeModelDeploymentCompartment operation to change the compartment for the model deployment.

Impact of the Change Compartment Operation

From the public metrics' perspective, the change compartment opreation has no functional changes. When the deployment is moved to a different compartment, the metrics are moved to the newer compartment, too. So if you have alarms defined based on these metrics such as CPUUtilization, update the alarms with the new compartment. This update can be made after the change.

Regarding OCI Logging, the logs might reside in a compartment different than the model deployment resource compartment. So, as long as the log groups' compartment is unchanged, no changes are required.

If policies are associated with a subcompartment, update the policies for CRUD and predict call operations if those policies are to continue making a successful call. Make the policy update to reflect the new compartment. For more information on policies, see Manage Model Deployment Policies.

Blue-green Based Policy Switching

So as not to disrupt any inference calls because of its associated policy changes, take extra care with the sequencing of changing compartment and policy update operation. The policy update takes between one and five minutes to synchronize and take effect. We recommend not updating the existing policies directly but rather to perform a blue-green based policy switch to avoid any failures in inference calls. The steps are:
  1. Before changing the compartment, add the new policy in the new compartment and wait for a few minutes.
    Now you have two policies in place. One in the old compartment and one in the new compartment.
  2. Confirm that the inference calls succeed.
  3. Update the model deployment resource to change the compartment to the new one.
  4. Confirm that the inference calls succeed still.
  5. Remove the first policy in the old compartment.