Skip to main content
Ctrl+K
Scitacean - Home Scitacean - Home
  • User guide
  • API reference
  • Developer documentation
    • SciCat
    • SciCat backend
  • GitHub
  • PyPI
  • Conda
  • User guide
  • API reference
  • Developer documentation
  • SciCat
  • SciCat backend
  • GitHub
  • PyPI
  • Conda

Section Navigation

  • scitacean.Client
  • scitacean.Dataset
  • scitacean.File
  • scitacean.transfer.copy.CopyFileTransfer
  • scitacean.transfer.link.LinkFileTransfer
  • scitacean.transfer.select.SelectFileTransfer
  • scitacean.transfer.sftp.SFTPFileTransfer
  • scitacean.client.ScicatClient
  • scitacean.datablock.OrigDatablock
  • scitacean.dataset.DatablockUploadModels
  • scitacean.PID
  • scitacean.Profile
  • scitacean.RemotePath
  • scitacean.Thumbnail
  • scitacean.DatasetType
  • scitacean.FileUploadError
  • scitacean.IntegrityError
  • scitacean.ScicatCommError
  • scitacean.ScicatLoginError
  • scitacean.model
    • scitacean.model.Attachment
    • scitacean.model.DatasetType
    • scitacean.model.History
    • scitacean.model.Instrument
    • scitacean.model.Lifecycle
    • scitacean.model.Relationship
    • scitacean.model.Sample
    • scitacean.model.Technique
    • scitacean.model.DownloadAttachment
    • scitacean.model.DownloadDatablock
    • scitacean.model.DownloadDataFile
    • scitacean.model.DownloadDataset
    • scitacean.model.DownloadHistory
    • scitacean.model.DownloadInstrument
    • scitacean.model.DownloadLifecycle
    • scitacean.model.DownloadOrigDatablock
    • scitacean.model.DownloadRelationship
    • scitacean.model.DownloadSample
    • scitacean.model.DownloadTechnique
    • scitacean.model.UploadAttachment
    • scitacean.model.UploadDatablock
    • scitacean.model.UploadDataFile
    • scitacean.model.UploadDerivedDataset
    • scitacean.model.UploadOrigDatablock
    • scitacean.model.UploadRawDataset
    • scitacean.model.UploadRelationship
    • scitacean.model.UploadSample
    • scitacean.model.UploadTechnique
    • scitacean.model.construct
  • scitacean.testing
    • scitacean.testing.backend
      • scitacean.testing.backend.add_pytest_options
      • scitacean.testing.backend.backend_enabled
      • scitacean.testing.backend.configure
      • scitacean.testing.backend.skip_if_not_backend
      • scitacean.testing.backend.start_backend
      • scitacean.testing.backend.stop_backend
      • scitacean.testing.backend.wait_until_backend_is_live
      • scitacean.testing.backend.config
        • scitacean.testing.backend.config.USERS
        • scitacean.testing.backend.config.SCICAT_PORT
        • scitacean.testing.backend.config.PID_PREFIX
        • scitacean.testing.backend.config.SITE
        • scitacean.testing.backend.config.dump_account_config
        • scitacean.testing.backend.config.local_access
        • scitacean.testing.backend.config.SciCatAccess
        • scitacean.testing.backend.config.ScicatCredentials
        • scitacean.testing.backend.config.ScicatUser
      • scitacean.testing.backend.fixtures
        • scitacean.testing.backend.fixtures.client
        • scitacean.testing.backend.fixtures.fake_client
        • scitacean.testing.backend.fixtures.real_client
        • scitacean.testing.backend.fixtures.require_scicat_backend
        • scitacean.testing.backend.fixtures.scicat_access
        • scitacean.testing.backend.fixtures.scicat_backend
      • scitacean.testing.backend.seed
        • scitacean.testing.backend.seed.INITIAL_DATASETS
        • scitacean.testing.backend.seed.INITIAL_ORIG_DATABLOCKS
        • scitacean.testing.backend.seed.INITIAL_ATTACHMENTS
        • scitacean.testing.backend.seed.save_seed
        • scitacean.testing.backend.seed.seed_database
        • scitacean.testing.backend.seed.seed_worker
    • scitacean.testing.client
      • scitacean.testing.client.process_uploaded_dataset
      • scitacean.testing.client.FakeClient
      • scitacean.testing.client.FakeScicatClient
    • scitacean.testing.docs
      • scitacean.testing.docs.setup_fake_client
    • scitacean.testing.sftp
      • scitacean.testing.sftp.fixtures
        • scitacean.testing.sftp.fixtures.require_sftp_fileserver
        • scitacean.testing.sftp.fixtures.sftp_access
        • scitacean.testing.sftp.fixtures.sftp_base_dir
        • scitacean.testing.sftp.fixtures.sftp_connect_with_username_password
        • scitacean.testing.sftp.fixtures.sftp_data_dir
        • scitacean.testing.sftp.fixtures.sftp_fileserver
    • scitacean.testing.strategies
      • scitacean.testing.strategies.datasets
      • scitacean.testing.strategies.emails
      • scitacean.testing.strategies.multi_emails
      • scitacean.testing.strategies.orcids
    • scitacean.testing.transfer
      • scitacean.testing.transfer.FakeDownloadConnection
      • scitacean.testing.transfer.FakeFileTransfer
      • scitacean.testing.transfer.FakeUploadConnection
  • scitacean.typing
    • scitacean.typing.DownloadConnection
    • scitacean.typing.Downloader
    • scitacean.typing.FileTransfer
    • scitacean.typing.UploadConnection
    • scitacean.typing.Uploader
  • scitacean.filesystem.checksum_of_file
  • scitacean.filesystem.escape_path
  • scitacean.filesystem.file_size
  • scitacean.filesystem.file_modification_time
  • scitacean.logging.logger_name
  • scitacean.logging.get_logger
  • scitacean.util.formatter.DatasetPathFormatter
On this page
  • LinkFileTransfer
    • LinkFileTransfer.__init__()
    • LinkFileTransfer.connect_for_download()
    • LinkFileTransfer.connect_for_upload()
    • LinkFileTransfer.source_folder_for()

This Page

  • Show Source
  • API reference
  • scitacean.transfer.link.LinkFileTransfer

scitacean.transfer.link.LinkFileTransfer#

class scitacean.transfer.link.LinkFileTransfer(*, source_folder=None)[source]#

Upload / download files by creating symlinks.

This file transfer does not actually upload or download files. Instead, it requires that the ‘remote’ file system is directly accessible from the ‘local’ file system. It creates symlinks in the local download folder to the ‘remote’ files.

Note

A note on terminology: In Scitacean, ‘remote’ refers to the file server where the data files are stored that belong to SciCat datasets. In contrast, ‘local’ refers to the file system of the machine that runs the Python process. The two filesystems can be the same. However, Scitacean maintains a strict separation between the two and uses ‘downloaders’ and ‘uploaders’ to transfer between them even if that transfer is a simple symlink.

See also the documentation of scitacean.File.

Warning

This file transfer does not work on Windows because it converts between RemotePath and pathlib.Path. This requires that both use the same directory separators. Since RemotePath uses UNIX-style forward slashes, it is incompatible with Windows paths. In practice, this should not be a problem because SciCat file storage should never be a Windows server.

Warning

This file transfer cannot upload files. Instead, consider copying or moving the files to the SciCat source folder, e.g., by using :scitacean.transfer.copy.CopyFileTransfer` or writing the files there directly from your workflow.

Attempting to upload files will raise NotImplementedError.

Examples

Given a dataset with source_folder="/dataset/source" and a file with path "file1.dat", this

client = Client.from_token(
    url="...",
    token="...",
    file_transfer=LinkFileTransfer()
)
ds = client.get_dataset(pid="...")
ds = client.download_files(ds, target="/downloads")

creates the following symlink:

/downloads/file1.dat -> /dataset/source/file1.dat

Constructors

__init__(*[, source_folder])

Construct a new Link file transfer.

Methods

connect_for_download(dataset, ...)

Create a connection for downloads, use as a context manager.

connect_for_upload(dataset, ...)

Create a connection for uploads, use as a context manager.

source_folder_for(dataset)

Return the source folder used for the given dataset.

__init__(*, source_folder=None)[source]#

Construct a new Link file transfer.

Parameters:

source_folder (str | RemotePath | None, default: None) – Upload files to this folder if set. Otherwise, upload to the dataset’s source_folder. Ignored when downloading files.

connect_for_download(dataset, representative_file_path)[source]#

Create a connection for downloads, use as a context manager.

Parameters:
  • dataset (Dataset) – The dataset for which to download files.

  • representative_file_path (RemotePath) – A path to a file that can be used to check whether files for this dataset are accessible. The transfer assumes that, if this path is accessible, all files for this dataset are.

Returns:

Iterator[LinkDownloadConnection] – A connection object that can download files.

Raises:

FileNotAccessibleError – If files for the given dataset cannot be accessed based on representative_file_path.

connect_for_upload(dataset, representative_file_path)[source]#

Create a connection for uploads, use as a context manager.

Parameters:
  • dataset (Dataset) – The connection will be used to upload files of this dataset. Used to determine the target folder.

  • representative_file_path (RemotePath) – A path on the remote to check whether files for this dataset can be written. The transfer assumes that, if it is possible to write to this path, it is possible to write to the paths of all files to be uploaded.

Raises:

NotImplementedError – This file transfer does not implement uploading files.

Return type:

Iterator[LinkUploadConnection]

source_folder_for(dataset)[source]#

Return the source folder used for the given dataset.

Return type:

RemotePath

previous

scitacean.transfer.copy.CopyFileTransfer

next

scitacean.transfer.select.SelectFileTransfer

© Copyright 2023 SciCat Project.

Created using Sphinx 8.1.3.

Current scitacean version: 25.3.2 (older versions).

Built with the PyData Sphinx Theme 0.16.1.