Skip to content

create_predictor_backtest_export_job async

create_predictor_backtest_export_job(
    predictor_backtest_export_job_name: Name,
    predictor_arn: Arn,
    destination: DataDestination,
    *,
    config_overrides: Optional[AsyncforecastClientConfig] = None,
    tags: Optional[Tags] = None,
    format: Optional[Format] = None,
) -> CreatePredictorBacktestExportJobResponse

Exports backtest forecasts and accuracy metrics generated by the CreateAutoPredictor or CreatePredictor operations. Two folders containing CSV or Parquet files are exported to your specified S3 bucket.

The export file names will match the following conventions:

__.csv

The component is in Java SimpleDate format (yyyy-MM-ddTHH-mm-ssZ).

You must specify a DataDestination object that includes an Amazon S3 bucket and an Identity and Access Management (IAM) role that Amazon Forecast can assume to access the Amazon S3 bucket. For more information, see aws-forecast-iam-roles.

The Status of the export job must be ACTIVE before you can access the export in your Amazon S3 bucket. To get the status, use the DescribePredictorBacktestExportJob operation.

Parameters:

  • predictor_backtest_export_job_name (Name) –

    The name for the backtest export job.

  • predictor_arn (Arn) –

    The Amazon Resource Name (ARN) of the predictor that you want to export.

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

    Optional metadata to help you categorize and organize your backtests. Each tag consists of a key and an optional value, both of which you define. Tag keys and values are case sensitive.

    The following restrictions apply to tags:

    • For each resource, each tag key must be unique and each tag key must have one value.

    • Maximum number of tags per resource: 50.

    • Maximum key length: 128 Unicode characters in UTF-8.

    • Maximum value length: 256 Unicode characters in UTF-8.

    • Accepted characters: all letters and numbers, spaces representable in UTF-8, and + - = . _ : / @. If your tagging schema is used across other services and resources, the character restrictions of those services also apply.

    • Key prefixes cannot include any upper or lowercase combination of aws: or AWS:. Values can have this prefix. If a tag value has aws as its prefix but the key does not, Forecast considers it to be a user tag and will count against the limit of 50 tags. Tags with only the key prefix of aws do not count against your tags per resource limit. You cannot edit or delete tag keys with this prefix.

  • format (Optional[Format], default: None ) –

    The format of the exported data, CSV or PARQUET. The default value is CSV.

Raises:

Source code in docs_src/capo_forecast/_services/async_forecast.py
async def create_predictor_backtest_export_job(
    self,
    predictor_backtest_export_job_name: "capo_forecast.types.name.Name",
    predictor_arn: "capo_forecast.types.arn.Arn",
    destination: "capo_forecast.types.data_destination.DataDestination",
    *,
    config_overrides: Optional[AsyncforecastClientConfig] = None,
    tags: Optional["capo_forecast.types.tags.Tags"] = None,
    format: Optional["capo_forecast.types.format.Format"] = None,
) -> "capo_forecast.types.create_predictor_backtest_export_job_response.CreatePredictorBacktestExportJobResponse":
    """<p>Exports backtest forecasts and accuracy metrics generated by the <a>CreateAutoPredictor</a> or <a>CreatePredictor</a> operations. Two folders containing CSV or Parquet files are exported to your specified S3 bucket.</p> <p> The export file names will match the following conventions:</p> <p> <code><ExportJobName>_<ExportTimestamp>_<PartNumber>.csv</code> </p> <p>The <ExportTimestamp> component is in Java SimpleDate format (yyyy-MM-ddTHH-mm-ssZ).</p> <p>You must specify a <a>DataDestination</a> object that includes an Amazon S3 bucket and an Identity and Access Management (IAM) role that Amazon Forecast can assume to access the Amazon S3 bucket. For more information, see <a>aws-forecast-iam-roles</a>.</p> <note> <p>The <code>Status</code> of the export job must be <code>ACTIVE</code> before you can access the export in your Amazon S3 bucket. To get the status, use the <a>DescribePredictorBacktestExportJob</a> operation.</p> </note>

    Args:
        predictor_backtest_export_job_name: <p>The name for the backtest export job.</p>
        predictor_arn: <p>The Amazon Resource Name (ARN) of the predictor that you want to export.</p>
        tags: <p>Optional metadata to help you categorize and organize your backtests. Each tag consists of a key and an optional value, both of which you define. Tag keys and values are case sensitive.</p> <p>The following restrictions apply to tags:</p> <ul> <li> <p>For each resource, each tag key must be unique and each tag key must have one value.</p> </li> <li> <p>Maximum number of tags per resource: 50.</p> </li> <li> <p>Maximum key length: 128 Unicode characters in UTF-8.</p> </li> <li> <p>Maximum value length: 256 Unicode characters in UTF-8.</p> </li> <li> <p>Accepted characters: all letters and numbers, spaces representable in UTF-8, and + - = . _ : / @. If your tagging schema is used across other services and resources, the character restrictions of those services also apply. </p> </li> <li> <p>Key prefixes cannot include any upper or lowercase combination of <code>aws:</code> or <code>AWS:</code>. Values can have this prefix. If a tag value has <code>aws</code> as its prefix but the key does not, Forecast considers it to be a user tag and will count against the limit of 50 tags. Tags with only the key prefix of <code>aws</code> do not count against your tags per resource limit. You cannot edit or delete tag keys with this prefix.</p> </li> </ul>
        format: <p>The format of the exported data, CSV or PARQUET. The default value is CSV.</p>

    Raises:
        capo_forecast.errors.invalid_input_exception.InvalidInputException: <p>We can't process the request because it includes an invalid value or a value that exceeds the valid range.</p>
        capo_forecast.errors.limit_exceeded_exception.LimitExceededException: <p>The limit on the number of resources per account has been exceeded.</p>
        capo_forecast.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>There is already a resource with this name. Try again with a different name.</p>
        capo_forecast.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is in use.</p>
        capo_forecast.errors.resource_not_found_exception.ResourceNotFoundException: <p>We can't find a resource with that Amazon Resource Name (ARN). Check the ARN and try again.</p>
        capo_forecast.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_forecast.types.create_predictor_backtest_export_job_request.CreatePredictorBacktestExportJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_forecast.types.create_predictor_backtest_export_job_response.CreatePredictorBacktestExportJobResponse"
    ]:
        import capo_forecast._operations.amazon_forecast.create_predictor_backtest_export_job

        (
            output,
            http_response,
        ) = await capo_forecast._operations.amazon_forecast.create_predictor_backtest_export_job.async_create_predictor_backtest_export_job(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_forecast.types.create_predictor_backtest_export_job_request.CreatePredictorBacktestExportJobRequest",
    ) -> dict[str, Any]:
        import capo_forecast.types.create_predictor_backtest_export_job_request

        return capo_forecast.types.create_predictor_backtest_export_job_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreatePredictorBacktestExportJob", redact_input=_redact_input
        ),
    )
    input_: capo_forecast.types.create_predictor_backtest_export_job_request.CreatePredictorBacktestExportJobRequest = {
        "predictor_backtest_export_job_name": predictor_backtest_export_job_name,
        "predictor_arn": predictor_arn,
        "destination": destination,
    }
    if tags is not None:
        input_["tags"] = tags
    if format is not None:
        input_["format"] = format

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