Skip to content

create_data_repository_task

create_data_repository_task(
    *,
    config_overrides: Optional[FSxClientConfig] = None,
    type: Optional[DataRepositoryTaskType] = None,
    paths: Optional[DataRepositoryTaskPaths] = None,
    file_system_id: Optional[FileSystemId] = None,
    report: Optional[CompletionReport] = None,
    client_request_token: Optional[ClientRequestToken] = None,
    tags: Optional[Tags] = None,
    capacity_to_release: Optional[CapacityToRelease] = None,
    release_configuration: Optional[ReleaseConfiguration] = None,
) -> CreateDataRepositoryTaskResponse

Creates an Amazon FSx for Lustre data repository task. A CreateDataRepositoryTask operation will fail if a data repository is not linked to the FSx file system.

You use import and export data repository tasks to perform bulk operations between your FSx for Lustre file system and its linked data repositories. An example of a data repository task is exporting any data and metadata changes, including POSIX metadata, to files, directories, and symbolic links (symlinks) from your FSx file system to a linked data repository.

You use release data repository tasks to release data from your file system for files that are exported to S3. The metadata of released files remains on the file system so users or applications can still access released files by reading the files again, which will restore data from Amazon S3 to the FSx for Lustre file system.

To learn more about data repository tasks, see Data Repository Tasks. To learn more about linking a data repository to your file system, see Linking your file system to an S3 bucket.

Parameters:

  • type (Optional[DataRepositoryTaskType], default: None ) –

    Specifies the type of data repository task to create.

    • EXPORT_TO_REPOSITORY tasks export from your Amazon FSx for Lustre file system to a linked data repository.

    • IMPORT_METADATA_FROM_REPOSITORY tasks import metadata changes from a linked S3 bucket to your Amazon FSx for Lustre file system.

    • RELEASE_DATA_FROM_FILESYSTEM tasks release files in your Amazon FSx for Lustre file system that have been exported to a linked S3 bucket and that meet your specified release criteria.

    • AUTO_RELEASE_DATA tasks automatically release files from an Amazon File Cache resource.

  • paths (Optional[DataRepositoryTaskPaths], default: None ) –

    A list of paths for the data repository task to use when the task is processed. If a path that you provide isn't valid, the task fails. If you don't provide paths, the default behavior is to export all files to S3 (for export tasks), import all files from S3 (for import tasks), or release all exported files that meet the last accessed time criteria (for release tasks).

    • For export tasks, the list contains paths on the FSx for Lustre file system from which the files are exported to the Amazon S3 bucket. The default path is the file system root directory. The paths you provide need to be relative to the mount point of the file system. If the mount point is /mnt/fsx and /mnt/fsx/path1 is a directory or file on the file system you want to export, then the path to provide is path1.

    • For import tasks, the list contains paths in the Amazon S3 bucket from which POSIX metadata changes are imported to the FSx for Lustre file system. The path can be an S3 bucket or prefix in the format s3://bucket-name/prefix (where prefix is optional).

    • For release tasks, the list contains directory or file paths on the FSx for Lustre file system from which to release exported files. If a directory is specified, files within the directory are released. If a file path is specified, only that file is released. To release all exported files in the file system, specify a forward slash (/) as the path.

      A file must also meet the last accessed time criteria specified in for the file to be released.

  • report (Optional[CompletionReport], default: None ) –

    Defines whether or not Amazon FSx provides a CompletionReport once the task has completed. A CompletionReport provides a detailed report on the files that Amazon FSx processed that meet the criteria specified by the Scope parameter. For more information, see Working with Task Completion Reports.

  • capacity_to_release (Optional[CapacityToRelease], default: None ) –

    Specifies the amount of data to release, in GiB, by an Amazon File Cache AUTO_RELEASE_DATA task that automatically releases files from the cache.

  • release_configuration (Optional[ReleaseConfiguration], default: None ) –

    The configuration that specifies the last accessed time criteria for files that will be released from an Amazon FSx for Lustre file system.

Raises:

  • BadRequest –

    A generic error indicating a failure with a client request.

  • DataRepositoryTaskExecuting –

    An existing data repository task is currently executing on the file system. Wait until the existing task has completed, then create the new task.

  • FileSystemNotFound –

    No Amazon FSx file systems were found based upon supplied parameters.

  • IncompatibleParameterError –

    The error returned when a second request is received with the same client request token but different parameters settings. A client request token should always uniquely identify a single request.

  • InternalServerError –

    A generic error indicating a server-side failure.

  • ServiceLimitExceeded –

    An error indicating that a particular service limit was exceeded. You can increase some service limits by contacting Amazon Web Services Support.

  • UnsupportedOperation –

    The requested operation is not supported for this resource or API.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_fsx/_services/f_sx.py
def create_data_repository_task(
    self,
    *,
    config_overrides: Optional[FSxClientConfig] = None,
    type: Optional[
        "capo_fsx.types.data_repository_task_type.DataRepositoryTaskType"
    ] = None,
    paths: Optional[
        "capo_fsx.types.data_repository_task_paths.DataRepositoryTaskPaths"
    ] = None,
    file_system_id: Optional["capo_fsx.types.file_system_id.FileSystemId"] = None,
    report: Optional["capo_fsx.types.completion_report.CompletionReport"] = None,
    client_request_token: Optional[
        "capo_fsx.types.client_request_token.ClientRequestToken"
    ] = None,
    tags: Optional["capo_fsx.types.tags.Tags"] = None,
    capacity_to_release: Optional[
        "capo_fsx.types.capacity_to_release.CapacityToRelease"
    ] = None,
    release_configuration: Optional[
        "capo_fsx.types.release_configuration.ReleaseConfiguration"
    ] = None,
) -> "capo_fsx.types.create_data_repository_task_response.CreateDataRepositoryTaskResponse":
    """<p>Creates an Amazon FSx for Lustre data repository task. A <code>CreateDataRepositoryTask</code> operation will fail if a data repository is not linked to the FSx file system.</p> <p>You use import and export data repository tasks to perform bulk operations between your FSx for Lustre file system and its linked data repositories. An example of a data repository task is exporting any data and metadata changes, including POSIX metadata, to files, directories, and symbolic links (symlinks) from your FSx file system to a linked data repository.</p> <p>You use release data repository tasks to release data from your file system for files that are exported to S3. The metadata of released files remains on the file system so users or applications can still access released files by reading the files again, which will restore data from Amazon S3 to the FSx for Lustre file system.</p> <p>To learn more about data repository tasks, see <a href="https://docs.aws.amazon.com/fsx/latest/LustreGuide/data-repository-tasks.html">Data Repository Tasks</a>. To learn more about linking a data repository to your file system, see <a href="https://docs.aws.amazon.com/fsx/latest/LustreGuide/create-dra-linked-data-repo.html">Linking your file system to an S3 bucket</a>.</p>

    Args:
        type: <p>Specifies the type of data repository task to create.</p> <ul> <li> <p> <code>EXPORT_TO_REPOSITORY</code> tasks export from your Amazon FSx for Lustre file system to a linked data repository.</p> </li> <li> <p> <code>IMPORT_METADATA_FROM_REPOSITORY</code> tasks import metadata changes from a linked S3 bucket to your Amazon FSx for Lustre file system.</p> </li> <li> <p> <code>RELEASE_DATA_FROM_FILESYSTEM</code> tasks release files in your Amazon FSx for Lustre file system that have been exported to a linked S3 bucket and that meet your specified release criteria.</p> </li> <li> <p> <code>AUTO_RELEASE_DATA</code> tasks automatically release files from an Amazon File Cache resource.</p> </li> </ul>
        paths: <p>A list of paths for the data repository task to use when the task is processed. If a path that you provide isn't valid, the task fails. If you don't provide paths, the default behavior is to export all files to S3 (for export tasks), import all files from S3 (for import tasks), or release all exported files that meet the last accessed time criteria (for release tasks).</p> <ul> <li> <p>For export tasks, the list contains paths on the FSx for Lustre file system from which the files are exported to the Amazon S3 bucket. The default path is the file system root directory. The paths you provide need to be relative to the mount point of the file system. If the mount point is <code>/mnt/fsx</code> and <code>/mnt/fsx/path1</code> is a directory or file on the file system you want to export, then the path to provide is <code>path1</code>.</p> </li> <li> <p>For import tasks, the list contains paths in the Amazon S3 bucket from which POSIX metadata changes are imported to the FSx for Lustre file system. The path can be an S3 bucket or prefix in the format <code>s3://bucket-name/prefix</code> (where <code>prefix</code> is optional).</p> </li> <li> <p>For release tasks, the list contains directory or file paths on the FSx for Lustre file system from which to release exported files. If a directory is specified, files within the directory are released. If a file path is specified, only that file is released. To release all exported files in the file system, specify a forward slash (/) as the path.</p> <note> <p>A file must also meet the last accessed time criteria specified in for the file to be released.</p> </note> </li> </ul>
        report: <p>Defines whether or not Amazon FSx provides a CompletionReport once the task has completed. A CompletionReport provides a detailed report on the files that Amazon FSx processed that meet the criteria specified by the <code>Scope</code> parameter. For more information, see <a href="https://docs.aws.amazon.com/fsx/latest/LustreGuide/task-completion-report.html">Working with Task Completion Reports</a>.</p>
        capacity_to_release: <p>Specifies the amount of data to release, in GiB, by an Amazon File Cache <code>AUTO_RELEASE_DATA</code> task that automatically releases files from the cache.</p>
        release_configuration: <p>The configuration that specifies the last accessed time criteria for files that will be released from an Amazon FSx for Lustre file system.</p>

    Raises:
        capo_fsx.errors.bad_request.BadRequest: <p>A generic error indicating a failure with a client request.</p>
        capo_fsx.errors.data_repository_task_executing.DataRepositoryTaskExecuting: <p>An existing data repository task is currently executing on the file system. Wait until the existing task has completed, then create the new task.</p>
        capo_fsx.errors.file_system_not_found.FileSystemNotFound: <p>No Amazon FSx file systems were found based upon supplied parameters.</p>
        capo_fsx.errors.incompatible_parameter_error.IncompatibleParameterError: <p>The error returned when a second request is received with the same client request token but different parameters settings. A client request token should always uniquely identify a single request.</p>
        capo_fsx.errors.internal_server_error.InternalServerError: <p>A generic error indicating a server-side failure.</p>
        capo_fsx.errors.service_limit_exceeded.ServiceLimitExceeded: <p>An error indicating that a particular service limit was exceeded. You can increase some service limits by contacting Amazon Web Services Support.</p>
        capo_fsx.errors.unsupported_operation.UnsupportedOperation: <p>The requested operation is not supported for this resource or API.</p>
        capo_fsx.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_fsx.types.create_data_repository_task_request.CreateDataRepositoryTaskRequest]",
    ) -> OperationResponse[
        "capo_fsx.types.create_data_repository_task_response.CreateDataRepositoryTaskResponse"
    ]:
        import capo_fsx._operations.aws_simba_api_service_v20180301.create_data_repository_task

        output, http_response = (
            capo_fsx._operations.aws_simba_api_service_v20180301.create_data_repository_task.create_data_repository_task(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDataRepositoryTask")
    )
    input_: capo_fsx.types.create_data_repository_task_request.CreateDataRepositoryTaskRequest = {}
    if type is not None:
        input_["type"] = type
    if paths is not None:
        input_["paths"] = paths
    if file_system_id is not None:
        input_["file_system_id"] = file_system_id
    if report is not None:
        input_["report"] = report
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if tags is not None:
        input_["tags"] = tags
    if capacity_to_release is not None:
        input_["capacity_to_release"] = capacity_to_release
    if release_configuration is not None:
        input_["release_configuration"] = release_configuration

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output