Skip to content

Commit 1983e09

Browse files
committed
Add parameter for output progress frequency
Also use a default value of 0 instead of None to update in real time.
1 parent 325e37b commit 1983e09

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

awscli/customizations/s3/results.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class ResultPrinter(BaseResultHandler):
316316
SRC_TRANSFER_LOCATION_FORMAT = '{src}'
317317

318318
def __init__(
319-
self, result_recorder, out_file=None, error_file=None, frequency=None
319+
self, result_recorder, out_file=None, error_file=None, frequency=0
320320
):
321321
"""Prints status of ongoing transfer
322322
@@ -357,7 +357,7 @@ def __call__(self, result):
357357
"""Print the progress of the ongoing transfer based on a result"""
358358
if (
359359
self._first
360-
or (self._frequency is None)
360+
or (self._frequency == 0)
361361
or (time.time() - self._now >= self._frequency)
362362
):
363363
self._result_handler_map.get(type(result), self._print_noop)(

awscli/customizations/s3/s3handler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ def _add_result_printer(self, result_recorder, result_processor_handlers):
104104
elif not self._cli_params.get('progress'):
105105
result_printer = NoProgressResultPrinter(result_recorder)
106106
else:
107-
result_printer = ResultPrinter(result_recorder, frequency=5)
107+
result_printer = ResultPrinter(
108+
result_recorder,
109+
frequency=self._cli_params.get('progress_frequency'),
110+
)
108111
result_processor_handlers.append(result_printer)
109112

110113

awscli/customizations/s3/subcommands.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,19 @@
526526
),
527527
}
528528

529+
PROGRESS_FREQUENCY = {
530+
'name': 'progress-frequency',
531+
'dest': 'progress_frequency',
532+
'cli_type_name': 'integer',
533+
'default': 0,
534+
'help_text': (
535+
'Number of seconds to wait before updating file '
536+
'transfer progress. This flag is only applied when '
537+
'the quiet and only-show-errors flags are not '
538+
'provided.'
539+
),
540+
}
541+
529542

530543
EXPECTED_SIZE = {
531544
'name': 'expected-size',
@@ -669,6 +682,7 @@
669682
SOURCE_REGION,
670683
ONLY_SHOW_ERRORS,
671684
NO_PROGRESS,
685+
PROGRESS_FREQUENCY,
672686
PAGE_SIZE,
673687
IGNORE_GLACIER_WARNINGS,
674688
FORCE_GLACIER_TRANSFER,

0 commit comments

Comments
 (0)