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

Option to disable progress spinner #481

Open
kent-at-multiscale opened this issue Oct 26, 2017 · 12 comments
Open

Option to disable progress spinner #481

kent-at-multiscale opened this issue Oct 26, 2017 · 12 comments

Comments

@kent-at-multiscale
Copy link

I am using gsutil in a scripting environment to move large files. I need to have progress logged so we can monitor jobs and get status updates. However, the progress indicator for gsutil cp includes a spinner that assumes it is working in a terminal. This produces an incredible amount of garbage in a log file.

This is related to #429 and #265 but is not the same request. I still need to see the progress, it just needs to omit the special control characters that assume the output is a terminal window. In other words, I want an option to remove the spinner and instead just write a new line.

@houglum
Copy link
Collaborator

houglum commented Oct 27, 2017

Thanks for submitting the request -- I've seen a few mentions of this since we did the UI overhaul and added the spinner-based progress printing. I agree that it would be much nicer to provide a way for gsutil to do progress printing that doesn't look like a mess when not directed to a terminal, either by providing an explicit option for this or (probably better) to have gsutil automatically do this if stdout refers to something besides a terminal.

@supersteves
Copy link

I second a need for this. We're running gsutil through Ant, and don't see any progress updates until the command finishes, whereupon all updates are concatenated. Can't see any workaround for this using Ant options. Ideally we'd see a newline per progress update, every minute perhaps. Some option not to be clever with the terminal? Rather than disabling altogether via -q.

@keeth
Copy link

keeth commented Feb 20, 2018

Plus one. Having to choose between reams of garbage directed to log file or complete silence is not ideal. Thanks!

@berlincount
Copy link

Plus one! :)

@dantheperson
Copy link

+1

@jeremyvisser
Copy link

We already have a helper function IsRunningInteractively() which tests whether stdin/out isatty():

def IsRunningInteractively():
"""Returns True if currently running interactively on a TTY."""
return sys.stdout.isatty() and sys.stderr.isatty() and sys.stdin.isatty()

The StatusMessageManager should call IsRunningInteractively() at some point to decide whether to actually show the spinner:

def __init__(self, update_message_period=1, update_spinner_period=0.6,
sliding_throughput_period=5, first_throughput_latency=10,
quiet_mode=False, custom_time=None, verbose=False,
console_width=80):

@hero2017
Copy link

hero2017 commented Apr 14, 2019

+1
Not sure if we're talking about the same thing here but when I run my PS script from Task Scheduler I see this kind of garbage in my log when using gsutil cp ... :

Uploading gs://temp/db1.zip: 0 B/1.20 GiB
Uploading gs://temp/db1.zip: 98.75 MiB/1.20
Uploading gs://temp/db1.zip: 98.81 MiB/1.20
...and keeps repeating this until it uploads the entire 1.20 GB.

This can be tens or hundreds of lines depending on the file size. When I run the same script from a PS command prompt the progress is displayed on line.

Source: https://stackoverflow.com/questions/55654436/running-powershell-script-with-gsutil-cp-to-gcp-shows-upload-progress-on-multipl/55669118#55669118

@ashatrov-realforce
Copy link

Our Jenkins output has a few extra thousands of lines with:

/ [274/418 files][454.8 MiB/  1.2 GiB]  35% Done                                
/ [275/418 files][455.9 MiB/  1.2 GiB]  35% Done                                
/ [276/418 files][456.6 MiB/  1.2 GiB]  36% Done                                
/ [277/418 files][457.9 MiB/  1.2 GiB]  36% Done                                
/ [278/418 files][457.9 MiB/  1.2 GiB]  36% Done                                
/ [279/418 files][457.9 MiB/  1.2 GiB]  36% Done                                

-q - option will hide progress and filenames too. It is more convenient to have file names and status of the downloading in output but disable printing of the progress bar.

@ej2catz
Copy link

ej2catz commented Jun 7, 2021

Plus One! How can this not yet be a thing?

@NotNANtoN
Copy link

I would actually like to have the reserve for my terminal. I have a load of small files that I do not care about and that spam my terminal but I do care about the general progress. So I only want the progress bar and not printing each single file.

phette23 added a commit to cca/moodle-backups that referenced this issue Jun 6, 2023
… entirely

see GoogleCloudPlatform/gsutil#481 there is no option to remove the progress bar
I tried piping through sed and (head -n1 && tail -n1) to preserve the first & last line
but neither of those worked. There is probably some convoluted sed edit that would work
@gabrielboehme
Copy link

+1

@aycaecemgul
Copy link

This probably won't be implemented at this point but here i go: +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests