Skip to content

create_dataset_export_job async

create_dataset_export_job(
    job_name: Name,
    dataset_arn: Arn,
    role_arn: RoleArn,
    job_output: DatasetExportJobOutput,
    *,
    config_overrides: Optional[AsyncPersonalizeClientConfig] = None,
    ingestion_mode: Optional[IngestionMode] = None,
    tags: Optional[Tags] = None,
) -> CreateDatasetExportJobResponse

Creates a job that exports data from your dataset to an Amazon S3 bucket. To allow Amazon Personalize to export the training data, you must specify an service-linked IAM role that gives Amazon Personalize PutObject permissions for your Amazon S3 bucket. For information, see Exporting a dataset in the Amazon Personalize developer guide.

Status

A dataset export job can be in one of the following states:

  • CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED

To get the status of the export job, call DescribeDatasetExportJob, and specify the Amazon Resource Name (ARN) of the dataset export job. The dataset export is complete when the status shows as ACTIVE. If the status shows as CREATE FAILED, the response includes a failureReason key, which describes why the job failed.

Parameters:

  • job_name (Name) –

    The name for the dataset export job.

  • dataset_arn (Arn) –

    The Amazon Resource Name (ARN) of the dataset that contains the data to export.

  • ingestion_mode (Optional[IngestionMode], default: None ) –

    The data to export, based on how you imported the data. You can choose to export only BULK data that you imported using a dataset import job, only PUT data that you imported incrementally (using the console, PutEvents, PutUsers and PutItems operations), or ALL for both types. The default value is PUT.

  • role_arn (RoleArn) –

    The Amazon Resource Name (ARN) of the IAM service role that has permissions to add data to your output Amazon S3 bucket.

  • job_output (DatasetExportJobOutput) –

    The path to the Amazon S3 bucket where the job's output is stored.

  • tags (Optional[Tags], default: None ) –

    A list of tags to apply to the dataset export job.

Raises:

Source code in docs_src/capo_personalize/_services/async_personalize.py
async def create_dataset_export_job(
    self,
    job_name: "capo_personalize.types.name.Name",
    dataset_arn: "capo_personalize.types.arn.Arn",
    role_arn: "capo_personalize.types.role_arn.RoleArn",
    job_output: "capo_personalize.types.dataset_export_job_output.DatasetExportJobOutput",
    *,
    config_overrides: Optional[AsyncPersonalizeClientConfig] = None,
    ingestion_mode: Optional[
        "capo_personalize.types.ingestion_mode.IngestionMode"
    ] = None,
    tags: Optional["capo_personalize.types.tags.Tags"] = None,
) -> "capo_personalize.types.create_dataset_export_job_response.CreateDatasetExportJobResponse":
    """<p> Creates a job that exports data from your dataset to an Amazon S3 bucket. To allow Amazon Personalize to export the training data, you must specify an service-linked IAM role that gives Amazon Personalize <code>PutObject</code> permissions for your Amazon S3 bucket. For information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/export-data.html">Exporting a dataset</a> in the Amazon Personalize developer guide. </p> <p> <b>Status</b> </p> <p>A dataset export job can be in one of the following states:</p> <ul> <li> <p>CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED</p> </li> </ul> <p> To get the status of the export job, call <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeDatasetExportJob.html">DescribeDatasetExportJob</a>, and specify the Amazon Resource Name (ARN) of the dataset export job. The dataset export is complete when the status shows as ACTIVE. If the status shows as CREATE FAILED, the response includes a <code>failureReason</code> key, which describes why the job failed. </p>

    Args:
        job_name: <p>The name for the dataset export job.</p>
        dataset_arn: <p>The Amazon Resource Name (ARN) of the dataset that contains the data to export.</p>
        ingestion_mode: <p>The data to export, based on how you imported the data. You can choose to export only <code>BULK</code> data that you imported using a dataset import job, only <code>PUT</code> data that you imported incrementally (using the console, PutEvents, PutUsers and PutItems operations), or <code>ALL</code> for both types. The default value is <code>PUT</code>. </p>
        role_arn: <p>The Amazon Resource Name (ARN) of the IAM service role that has permissions to add data to your output Amazon S3 bucket.</p>
        job_output: <p>The path to the Amazon S3 bucket where the job's output is stored.</p>
        tags: <p>A list of <a href="https://docs.aws.amazon.com/personalize/latest/dg/tagging-resources.html">tags</a> to apply to the dataset export job.</p>

    Raises:
        capo_personalize.errors.invalid_input_exception.InvalidInputException: <p>Provide a valid value for the field or parameter.</p>
        capo_personalize.errors.limit_exceeded_exception.LimitExceededException: <p>The limit on the number of requests per second has been exceeded.</p>
        capo_personalize.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The specified resource already exists.</p>
        capo_personalize.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is in use.</p>
        capo_personalize.errors.resource_not_found_exception.ResourceNotFoundException: <p>Could not find the specified resource.</p>
        capo_personalize.errors.too_many_tags_exception.TooManyTagsException: <p>You have exceeded the maximum number of tags you can apply to this resource. </p>
        capo_personalize.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_personalize.types.create_dataset_export_job_request.CreateDatasetExportJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_personalize.types.create_dataset_export_job_response.CreateDatasetExportJobResponse"
    ]:
        import capo_personalize._operations.amazon_personalize.create_dataset_export_job

        (
            output,
            http_response,
        ) = await capo_personalize._operations.amazon_personalize.create_dataset_export_job.async_create_dataset_export_job(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_personalize.types.create_dataset_export_job_request.CreateDatasetExportJobRequest",
    ) -> dict[str, Any]:
        import capo_personalize.types.create_dataset_export_job_request

        return capo_personalize.types.create_dataset_export_job_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateDatasetExportJob", redact_input=_redact_input),
    )
    input_: capo_personalize.types.create_dataset_export_job_request.CreateDatasetExportJobRequest = {
        "job_name": job_name,
        "dataset_arn": dataset_arn,
        "role_arn": role_arn,
        "job_output": job_output,
    }
    if ingestion_mode is not None:
        input_["ingestion_mode"] = ingestion_mode
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output