Skip to content

Commit

Permalink
Fix SaveHDF5 operator to allow volume=None.
Browse files Browse the repository at this point in the history
  • Loading branch information
tskisner committed Jan 30, 2024
1 parent 826e6d8 commit 4736c96
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ name: Test Binary Wheels
# on: workflow_dispatch
# FIXME: Remove these lines once this workflow merged
# to main branch.
on:
push:
branches:
- master
pull_request:
branches:
- master
- toast3
# on:
# push:
# branches:
# - master
# pull_request:
# branches:
# - master
# - toast3

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
11 changes: 10 additions & 1 deletion src/toast/ops/save_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ class SaveHDF5(Operator):

API = Int(0, help="Internal interface version for this operator")

volume = Unicode("toast_out_hdf5", help="Top-level directory for the data volume")
volume = Unicode(
"toast_out_hdf5",
allow_none=True,
help="Top-level directory for the data volume",
)

# FIXME: We should add a filtering mechanism here to dump a subset of
# observations and / or detectors, as well as figure out subdirectory organization.
Expand Down Expand Up @@ -196,6 +200,11 @@ def __init__(self, **kwargs):
def _exec(self, data, detectors=None, **kwargs):
log = Logger.get()

if self.volume is None:
msg = "You must set the volume trait prior to calling exec()"
log.error(msg)
raise RuntimeError(msg)

# One process creates the top directory
if data.comm.world_rank == 0:
os.makedirs(self.volume, exist_ok=True)
Expand Down

0 comments on commit 4736c96

Please sign in to comment.