def get_training_request()

in custom_resource/sagemaker_training_job.py [0:0]


def get_training_request(event):
    props = event["ResourceProperties"]

    # Load raw request
    request = json.loads(props["TrainingJobRequest"])

    # Add the KmsKeyId to monitoring outputs and cluster volume if provided
    if props.get("KmsKeyId") is not None:
        request["ResourceConfig"]["VolumeKmsKeyId"] = props["KmsKeyId"]

    # Set the training job name
    request["TrainingJobName"] = props["TrainingJobName"]

    # Add experiment tracking
    request["ExperimentConfig"] = {
        "ExperimentName": props["ExperimentName"],
        "TrialName": props["TrialName"],
        "TrialComponentDisplayName": "Training",
    }

    return request