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

Add progress bar to early stages of margin import #204

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/hipscat_import/margin_cache/margin_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,23 @@ def generate_margin_cache(args, client):
args (MarginCacheArguments): A valid `MarginCacheArguments` object.
client (dask.distributed.Client): A dask distributed client object.
"""
with tqdm(total=5, desc="Planning ", disable=not args.progress_bar) as step_progress:
# determine which order to generate margin pixels for
partition_stats = args.catalog.partition_info.get_healpix_pixels()
partition_stats = args.catalog.partition_info.get_healpix_pixels()
step_progress.update(1)

# get the negative tree pixels
negative_pixels = args.catalog.generate_negative_tree_pixels()
# get the negative tree pixels
negative_pixels = args.catalog.generate_negative_tree_pixels()
step_progress.update(1)

combined_pixels = partition_stats + negative_pixels
combined_pixels = partition_stats + negative_pixels
step_progress.update(1)

margin_pairs = _find_partition_margin_pixel_pairs(combined_pixels, args.margin_order)
margin_pairs = _find_partition_margin_pixel_pairs(combined_pixels, args.margin_order)
step_progress.update(1)

_create_margin_directory(combined_pixels, args.catalog_path)
_create_margin_directory(combined_pixels, args.catalog_path)
step_progress.update(1)

_map_to_margin_shards(
client=client,
Expand Down
2 changes: 1 addition & 1 deletion tests/hipscat_import/margin_cache/test_margin_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_margin_cache_gen(small_sky_source_catalog, tmp_path, dask_client):

assert all(data[PartitionInfo.METADATA_ORDER_COLUMN_NAME] == norder)
assert all(data[PartitionInfo.METADATA_PIXEL_COLUMN_NAME] == npix)
assert all(data[PartitionInfo.METADATA_DIR_COLUMN_NAME] == int(npix / 10000) * 10000)
assert all(data[PartitionInfo.METADATA_DIR_COLUMN_NAME] == 0)

assert data.dtypes[PartitionInfo.METADATA_ORDER_COLUMN_NAME] == np.uint8
assert data.dtypes[PartitionInfo.METADATA_DIR_COLUMN_NAME] == np.uint64
Expand Down
Loading