def _s3_upload_file()

in app/source/dragen/src/scheduler/aws_utils.py [0:0]


def _s3_upload_file(file_path, bucket, obj_key, s3_client, transfer_client):
    # Check if the key is a 'root' instead of full key name
    if obj_key.endswith('/'):
        name_only = file_path.rsplit('/', 1)[1]  # strip out the leading directory path
        obj_key = obj_key + name_only
    transfer_client.upload_file(
        file_path,
        bucket,
        obj_key,
        extra_args={'ServerSideEncryption': 'AES256'}
    )

    # Once Upload is complete, get the object info to check the size
    response = s3_client.head_object(Bucket=bucket, Key=obj_key)
    return response['ContentLength'] if response else None