# 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).

from datetime import datetime
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
data_science_client = oci.data_science.DataScienceClient(config)


# Send the request to service, some parameters are not required, see API
# doc for more info
create_schedule_response = data_science_client.create_schedule(
    create_schedule_details=oci.data_science.models.CreateScheduleDetails(
        display_name="EXAMPLE-displayName-Value",
        project_id="ocid1.test.oc1..<unique_ID>EXAMPLE-projectId-Value",
        compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
        trigger=oci.data_science.models.ScheduleCronTrigger(
            trigger_type="CRON",
            cron_expression="EXAMPLE-cronExpression-Value",
            time_start=datetime.strptime(
                "2019-05-08T23:30:15.835Z",
                "%Y-%m-%dT%H:%M:%S.%fZ"),
            time_end=datetime.strptime(
                "2045-07-26T00:50:16.617Z",
                "%Y-%m-%dT%H:%M:%S.%fZ")),
        action=oci.data_science.models.ScheduleHttpAction(
            action_type="HTTP",
            action_details=oci.data_science.models.CreateJobRunScheduleActionDetails(
                http_action_type="CREATE_JOB_RUN",
                create_job_run_details=oci.data_science.models.CreateJobRunDetails(
                    project_id="ocid1.test.oc1..<unique_ID>EXAMPLE-projectId-Value",
                    compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
                    job_id="ocid1.test.oc1..<unique_ID>EXAMPLE-jobId-Value",
                    display_name="EXAMPLE-displayName-Value",
                    job_configuration_override_details=oci.data_science.models.DefaultJobConfigurationDetails(
                        job_type="DEFAULT",
                        environment_variables={
                            'EXAMPLE_KEY_eRGcp': 'EXAMPLE_VALUE_Dwp3Udcj99OyGYuFbfbH'},
                        command_line_arguments="EXAMPLE-commandLineArguments-Value",
                        maximum_runtime_in_minutes=8918),
                    job_log_configuration_override_details=oci.data_science.models.JobLogConfigurationDetails(
                        enable_logging=True,
                        enable_auto_log_creation=False,
                        log_group_id="ocid1.test.oc1..<unique_ID>EXAMPLE-logGroupId-Value",
                        log_id="ocid1.test.oc1..<unique_ID>EXAMPLE-logId-Value"),
                    job_environment_configuration_override_details=oci.data_science.models.OcirContainerJobEnvironmentConfigurationDetails(
                        job_environment_type="OCIR_CONTAINER",
                        image="EXAMPLE-image-Value",
                        cmd=["EXAMPLE--Value"],
                        entrypoint=["EXAMPLE--Value"],
                        image_digest="EXAMPLE-imageDigest-Value",
                        image_signature_id="ocid1.test.oc1..<unique_ID>EXAMPLE-imageSignatureId-Value"),
                    freeform_tags={
                        'EXAMPLE_KEY_WOL7e': 'EXAMPLE_VALUE_NSejVzpgZPdRXgF1smTd'},
                    defined_tags={
                        'EXAMPLE_KEY_FAz0i': {
                            'EXAMPLE_KEY_cF29x': 'EXAMPLE--Value'}}))),
        description="EXAMPLE-description-Value",
        log_details=oci.data_science.models.ScheduleLogDetails(
            log_group_id="ocid1.test.oc1..<unique_ID>EXAMPLE-logGroupId-Value",
            log_id="ocid1.test.oc1..<unique_ID>EXAMPLE-logId-Value"),
        freeform_tags={
            'EXAMPLE_KEY_5fYiu': 'EXAMPLE_VALUE_5zHLmuZs9tnGVo7WEhVM'},
        defined_tags={
            'EXAMPLE_KEY_Zjf0j': {
                'EXAMPLE_KEY_updkV': 'EXAMPLE--Value'}}),
    opc_retry_token="EXAMPLE-opcRetryToken-Value",
    opc_request_id="6SU48CNMKEJC7QNMPVUL<unique_ID>")

# Get the data from response
print(create_schedule_response.data)

Was this article helpful?