Creating a Compute Target
Create a compute target in Data Science. Compute targets are of the type "Managed Compute Cluster."
After you create a compute target, you can view its details and perform other tasks, such as updating it, moving it to a different compartment, or deleting it. Use the Actions menus in the Console to access these tasks, or use the relevant commands in the API or CLI. For more information, see Listing Compute Targets.
Before You Begin
Before creating a compute target, note the following prerequisites.
- A compartment to create the compute target in.
- Permission to manage Data Science compute targets. See Compute Target Policies.
- Note the shape and instance count required for your workloads.
- Note the capacity requirements for model deployments that you intend to use the compute target with.
On the Compute targets list page, select Create compute target. If you need help finding the list page, see Listing Compute Targets.
1. Basic information
Provide basic identifying information and metadata.
- Compartment: Select the compartment to create the compute target in.
- Name (Optional): Enter a name to identify the compute target.
- Description (Optional): Enter a description.
- Metadata: Add one or more key-value pairs.
- Tags (Optional): Add tags to the private endpoint. If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later.
Select Next.
2. Compute resources
Provide basic identifying information and metadata.
- Capacity reservation: Select a capacity reservation by compartment.
- Compute shape: Select a shape and configure the instance count.
- Autoscaling configuration (Optional): Select Enable autoscaling and then enter the following information.
- Minimum number of instances
- Maximum number of instances
- Cooldown period in seconds: Window of time to wait before triggering another scaling event. Waiting allows the current scaling event to complete before starting a new one.
- Scaling metric type
For Custom, specify scale-in and scale-out queries (MQL) that return the metric value aggregated for the indicated time. Each query must specify
COMPUTE_TARGET_OCIDasresourceId.Example 1: Scale-in custom metric query:
ComputeTargetIdleInstances[5m]{resourceId = "COMPUTE_TARGET_OCID"}.grouping().mean() > 0Example 2: Scale-out custom metric query:
ComputeTargetUnschedulableWorkloadInstances[5m]{resourceId = "COMPUTE_TARGET_OCID"}.grouping().mean() > 0 - Advanced options:
- Scale-in instance count step: Number of instances to be removed during a scaling-down event.
- Scale-out instance count step: Number of instances to be added during a scaling-up event.
- Scale-in pending duration: Window of time for metric to hold true before scaling-down the compute target.
- Scale-out pending duration: Window of time for metric to hold true before scaling-up the compute target.
- Networking resources: Select the relevant option.
- Default Networking: Restricts traffic to Oracle services only. The system uses the existing service-managed network. The workload is attached by using a secondary VNIC to a preconfigured, service-managed VCN, and subnet. This provided subnet lets egress to the public internet through a NAT gateway, and access to other Oracle Cloud services through a service gateway.
If you need access only to the public internet and OCI services, we recommend using this option. It doesn't require you to create networking resources or write policies for networking permissions.
- Custom Networking: Select the VCN and subnet (by compartment) that you want to use.
For egress access to the public internet, use a private subnet with a route to a NAT gateway.
Note
- Switching from custom networking to managed networking isn't supported after creation.
- If you see the banner
The specified subnet is not accessible. Select a different subnet., then create policies for custom networking.
- Default Networking: Restricts traffic to Oracle services only. The system uses the existing service-managed network. The workload is attached by using a secondary VNIC to a preconfigured, service-managed VCN, and subnet. This provided subnet lets egress to the public internet through a NAT gateway, and access to other Oracle Cloud services through a service gateway.
- Tags (Optional) (under Advanced options): Add tags to the compute target. If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later.
Select Next.
3. Review and create
Review entered information and then select Create to create the compute target.
On creation, the compute target enters an asynchronous provisioning workflow. You can use the compute target after it reaches the active state.
Create a file named
create-compute-target.json:{ "compartmentId": "<compartment_ocid>", "displayName": "mcc-compute-target", "computeConfigurationDetails": { "computeType": "MANAGED_COMPUTE_CLUSTER", "instanceConfiguration": { "instanceShape": "VM.Standard.E4.Flex", "instanceShapeDetails": { "ocpus": 16, "memoryInGBs": 128 }, "bootVolumeSizeInGBs": 100 }, "scalingPolicy": { "policyType": "FIXED_SIZE", "instanceCount": 1 } } }Then run oci data-science compute-target create:
oci data-science compute-target create --from-json file://create-compute-target.jsonFor a complete list of parameters and values for CLI commands, see the CLI Command Reference.
Run the CreateComputeTarget operation to create a compute target.
Creating a Compute Target with the Python SDK
import oci
config = oci.config.from_file("~/.oci/config", "DEFAULT")
data_science_client = oci.data_science.DataScienceClient(config)
data_science_composite_client = oci.data_science.DataScienceClientCompositeOperations(
data_science_client
)
create_compute_target_details = oci.data_science.models.CreateComputeTargetDetails(
compartment_id="<compartment_ocid>",
display_name="mcc-compute-target",
compute_configuration_details=oci.data_science.models.ManagedComputeClusterComputeConfigurationDetails(
compute_type="MANAGED_COMPUTE_CLUSTER",
instance_configuration=oci.data_science.models.ManagedComputeClusterInstanceConfigurationDetails(
instance_shape="VM.Standard.E4.Flex",
instance_shape_details=oci.data_science.models.ManagedComputeClusterInstanceShapeDetails(
ocpus=16,
memory_in_gbs=128,
),
boot_volume_size_in_gbs=100,
),
scaling_policy=oci.data_science.models.ManagedComputeClusterFixedSizeScalingPolicy(
policy_type="FIXED_SIZE",
instance_count=1,
),
),
)
response = data_science_composite_client.create_compute_target_and_wait_for_state(
create_compute_target_details=create_compute_target_details,
wait_for_states=["SUCCEEDED", "FAILED"],
)
compute_target_id = response.data.resources[0].identifier
print(f"Created compute target: {compute_target_id}")