Skip to content

mecfs_bio.build_system.wf.synapse_downloader

Synapse download capability

Classes:

SharedClientSynapseDownloader

SharedClientSynapseDownloader()

Bases: SynapseDownloader

Downloads via a lazily authenticated Synapse client reused across calls.

Methods:

Source code in mecfs_bio/build_system/wf/synapse_downloader.py
def __init__(self) -> None:
    self._client: synapseclient.Synapse | None = None
    self._login_lock = threading.Lock()

download

download(
    synid: str, dest_dir: Path, expected_name: str
) -> Path
Source code in mecfs_bio/build_system/wf/synapse_downloader.py
def download(self, synid: str, dest_dir: Path, expected_name: str) -> Path:

    files = synapseutils.syncFromSynapse(
        self._client_or_login(), synid, path=str(dest_dir)
    )
    assert len(files) == 1, f"expected one file for {synid}, got {len(files)}"
    assert files[0].name == expected_name, files[0].name
    return Path(files[0].path)

SynapseDownloader

Bases: ABC

Downloads a single file from synapse.org into a local directory.

Methods:

  • download

    Download the single file at synid into dest_dir, assert its name equals

download abstractmethod

download(
    synid: str, dest_dir: Path, expected_name: str
) -> Path

Download the single file at synid into dest_dir, assert its name equals expected_name, and return its local path.

Source code in mecfs_bio/build_system/wf/synapse_downloader.py
@abstractmethod
def download(self, synid: str, dest_dir: Path, expected_name: str) -> Path:
    """Download the single file at synid into dest_dir, assert its name equals
    expected_name, and return its local path."""