Synapse Multipart Upload

Implements the client side of Synapse multipart upload, which provides a robust means of uploading large files (into the 10s of GB). End users should not need to call any of these functions directly.

synapseclient.core.upload.multipart_upload.multipart_upload_file(syn, file_path: str, dest_file_name: Optional[str] = None, content_type: Optional[str] = None, part_size: Optional[int] = None, storage_location_id: Optional[str] = None, preview: bool = True, force_restart: bool = False, max_threads: Optional[int] = None)str

Upload a file to a Synapse upload destination in chunks.

Parameters
  • syn – a Synapse object

  • file_path – the file to upload

  • dest_file_name – upload as a different filename

  • content_type – contentType`_

  • part_size – number of bytes per part. Minimum 5MB.

  • storage_location_id – an id indicating where the file should be stored. Retrieved from Synapse’s UploadDestination

  • preview – True to generate a preview

:param force_restart True to restart a previously initiated upload

from scratch, False to try to resume

:param max_threads number of concurrent threads to devote

to upload

Returns

a File Handle ID

Keyword arguments are passed down to _multipart_upload() and _start_multipart_upload().

synapseclient.core.upload.multipart_upload.multipart_upload_string(syn, text: str, dest_file_name: Optional[str] = None, part_size: Optional[int] = None, content_type: Optional[str] = None, storage_location_id: Optional[str] = None, preview: bool = True, force_restart: bool = False, max_threads: Optional[int] = None)

Upload a file to a Synapse upload destination in chunks.

Parameters
  • syn – a Synapse object

  • text – a string to upload as a file.

  • dest_file_name – upload as a different filename

  • content_type – contentType`_

  • part_size – number of bytes per part. Minimum 5MB.

  • storage_location_id – an id indicating where the file should be stored. Retrieved from Synapse’s UploadDestination

  • preview – True to generate a preview

:param force_restart True to restart a previously initiated upload

from scratch, False to try to resume

:param max_threads number of concurrent threads to devote

to upload

Returns

a File Handle ID

Keyword arguments are passed down to _multipart_upload() and _start_multipart_upload().

synapseclient.core.upload.multipart_upload.shared_executor(executor)

An outside process that will eventually trigger an upload through the this module can configure a shared Executor by running its code within this context manager.

synapseclient.core.upload.multipart_upload._multipart_upload(syn, dest_file_name, upload_request, part_fn, md5_fn, force_restart: bool = False, max_threads: Optional[int] = None)