Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYNPY-1333] Print transfer progress for FTP #1017

Merged
merged 2 commits into from
Nov 27, 2023

Conversation

BryanFauble
Copy link
Contributor

Problem:
When a file is being downloaded from an FTP link there is no indication that anything is occurring.

Solution:
Adding in a reporthook function that will print the transfer progress based on the block number, read size, and total size.

Testing:

  1. I tested this out with a script similar to what tom added in the Jira:
import synapseclient

syn = synapseclient.Synapse(debug=True)
syn.login()


file_ent = synapseclient.File(
    "ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR197/048/SRR19761348/SRR19761348_1.fastq.gz",
    name="SRR19761348_1.fastq.gz",
    # This parameter will store this file as a link
    synapseStore=False,
    parent="syn52569429",
)
file_ent = syn.store(obj=file_ent)
syn.get(entity=file_ent, downloadFile=True)

After running the script I get:
Downloading [--------------------]0.63% 9.0MB/1.4GB (3.1MB/s) SRR19761348_1.fastq.gz

This is just like downloading synapse stored file which look like:
Downloading [####################]100.00% 12.0bytes/12.0bytes (4.5kB/s) my_super_cool_junk_file.txt

@BryanFauble BryanFauble requested a review from a team as a code owner November 27, 2023 21:31
Copy link
Member

@thomasyu888 thomasyu888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 nice! Thanks for pushing this through. Just a small comment but it looks good.

synapseclient/client.py Show resolved Hide resolved
@BryanFauble BryanFauble merged commit 639aff0 into develop Nov 27, 2023
29 checks passed
@BryanFauble BryanFauble deleted the SYNPY-1333-ftp-progress-tracking branch November 27, 2023 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants