From 4736c96cfd6691732490feb6c895af23dd962222 Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Tue, 30 Jan 2024 06:46:08 -0800 Subject: [PATCH] Fix SaveHDF5 operator to allow volume=None. --- .github/workflows/wheels.yml | 16 ++++++++-------- src/toast/ops/save_hdf5.py | 11 ++++++++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 3661ba2c6..af6bbc3ad 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -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 }} diff --git a/src/toast/ops/save_hdf5.py b/src/toast/ops/save_hdf5.py index 5f9b63430..4193e5b0b 100644 --- a/src/toast/ops/save_hdf5.py +++ b/src/toast/ops/save_hdf5.py @@ -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. @@ -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)