# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).
import oci
# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()
# Initialize service client with default config file
batch_client = oci.batch.BatchComputingClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
create_batch_context_response = batch_client.create_batch_context(
create_batch_context_details=oci.batch.models.CreateBatchContextDetails(
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
network=oci.batch.models.CreateNetworkDetails(
subnet_id="ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
nsg_ids=["EXAMPLE--Value"]),
fleets=[
oci.batch.models.CreateServiceManagedFleetDetails(
type="SERVICE_MANAGED_FLEET",
name="EXAMPLE-name-Value",
shape=oci.batch.models.FleetShape(
shape_name="EXAMPLE-shapeName-Value",
ocpus=741,
memory_in_gbs=257),
max_concurrent_tasks=513)],
display_name="EXAMPLE-displayName-Value",
description="EXAMPLE-description-Value",
freeform_tags={
'EXAMPLE_KEY_yhmEo': 'EXAMPLE_VALUE_gG76XUEIEXDp04uCVGo8'},
defined_tags={
'EXAMPLE_KEY_IHMew': {
'EXAMPLE_KEY_NqQKG': 'EXAMPLE--Value'}},
job_priority_configurations=[
oci.batch.models.JobPriorityConfiguration(
tag_namespace="EXAMPLE-tagNamespace-Value",
tag_key="EXAMPLE-tagKey-Value",
weight=-72,
values={
'EXAMPLE_KEY_LoI7Z': -1520622313})],
entitlements={
'EXAMPLE_KEY_2QUD1': 1856133934},
logging_configuration=oci.batch.models.OciLoggingConfiguration(
type="OCI_LOGGING",
log_group_id="ocid1.test.oc1..<unique_ID>EXAMPLE-logGroupId-Value",
log_id="ocid1.test.oc1..<unique_ID>EXAMPLE-logId-Value")),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="ATTBMACGMS3CJOYD2ET8<unique_ID>")
# Get the data from response
print(create_batch_context_response.data)