Skip to content

Commit 054483b

Browse files
authored
669 Add CLI argument to disable progress indicators (#670)
1 parent 05b939d commit 054483b

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

.github/workflows/epidata_main.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ jobs:
115115
- name: Dowload Data
116116
run: |
117117
mkdir -p data_dl
118-
getcasedata -o data_dl
119-
getpopuldata -o data_dl
120-
getjhdata -o data_dl
121-
getdividata -o data_dl
122-
getcommutermobility -o data_dl
123-
getvaccinationdata -o data_dl
124-
gethospitalizationdata -o data_dl
118+
getcasedata -o data_dl --no-progress-indicators
119+
getpopuldata -o data_dl --no-progress-indicators
120+
getjhdata -o data_dl --no-progress-indicators
121+
getdividata -o data_dl --no-progress-indicators
122+
getcommutermobility -o data_dl --no-progress-indicators
123+
getvaccinationdata -o data_dl --no-progress-indicators
124+
gethospitalizationdata -o data_dl --no-progress-indicators
125125
- name: Upload Data
126126
uses: actions/upload-artifact@v3
127127
with:

pycode/memilio-epidata/memilio/epidata/getDataIntoPandasDataFrame.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def cli(what):
235235
- file-format, choices = ['json', 'hdf5', 'json_timeasstring']
236236
- out_path
237237
- no_raw
238+
- no_progress_indicators (excluded from dict)
238239
The default values are defined in default dict.
239240
240241
Depending on what following parser can be added:
@@ -341,9 +342,21 @@ def cli(what):
341342
'-sd', '--sanitize_data', type=int, default=1,
342343
help='Redistributes cases of every county either based on regions ratios or on thresholds and population'
343344
)
344-
args = parser.parse_args()
345345

346-
return vars(args)
346+
parser.add_argument(
347+
'--no-progress-indicators',
348+
help='Disables all progress indicators (used for downloads etc.).',
349+
action='store_true')
350+
351+
args = vars(parser.parse_args())
352+
# disable progress indicators globally, if the argument --no-progress-indicators was specified
353+
progress_indicator.ProgressIndicator.disable_indicators(
354+
args["no_progress_indicators"])
355+
# remove the no_progress_indicators entry from the dict
356+
# (after disabling indicators, its value is no longer usefull)
357+
args.pop("no_progress_indicators")
358+
359+
return args
347360

348361

349362
def append_filename(

0 commit comments

Comments
 (0)