Skip to content

Commit

Permalink
Correctly start task in ketos compile progress bar
Browse files Browse the repository at this point in the history
Fixes #504.
  • Loading branch information
mittagessen committed May 10, 2024
1 parent 2fb846a commit 3899b49
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kraken/ketos/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ def compile(ctx, output, workers, format_type, files, random_split, force_type,
with KrakenProgressBar() as progress:
extract_task = progress.add_task('Extracting lines', total=0, start=False, visible=True if not ctx.meta['verbose'] else False)

def _update_bar(advance, total):
if not progress.tasks[0].started:
progress.start_task(extract_task)
progress.update(extract_task, total=total, advance=advance)

arrow_dataset.build_binary_dataset(ground_truth,
output,
format_type,
Expand All @@ -93,7 +98,7 @@ def compile(ctx, output, workers, format_type, files, random_split, force_type,
force_type,
recordbatch_size,
skip_empty_lines,
lambda advance, total: progress.update(extract_task, total=total, advance=advance),
_update_bar,
legacy_polygons=legacy_polygons)

message(f'Output file written to {output}')

0 comments on commit 3899b49

Please sign in to comment.