None
Test: ingestor|loki|file_found_by_scicat_is_consistent_with_manual|
None
None
None
None
None
None
None
None
None
None
None
instrument = 'loki', coda_proposal_id = '999999'
def test_file_found_by_scicat_is_consistent_with_manual(
instrument: str,
coda_proposal_id: str,
) -> None:
scicat_path = scicat.get_latest_coda_nexus_path(
proposal_id=coda_proposal_id, instrument=instrument
)
> raw_paths = coda.get_latest_nexus_paths(
proposal_id=coda_proposal_id,
instrument=instrument,
n=2,
)
tests/ingestor/ingestor_test.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
instrument = 'loki', proposal_id = '999999', n = 2
@cache
def get_latest_nexus_paths(
instrument: str, proposal_id: str | None, n: int = 1
) -> list[Path]:
"""
Get the latest file paths manually by sorting the files in the directory.
Parameters
----------
instrument:
The instrument name.
proposal_id:
SciCat proposal ID for CODA.
If ``None``, the environment variable ``OVERRIDE_RAW_DATA_DIR`` must be set.
n:
Return up to n files.
Returns
-------
:
Paths to the n latest files for the given instrument and proposal.
"""
base_path = _coda_raw_data_path(proposal_id)
glob = _RAW_FILE_GLOB_PATTERN.format(instrument=instrument)
logging.info(
"Searching for files for instrument %s in %s with glob %s",
instrument,
base_path,
glob,
)
# Note that this gets the ctime of _all_ files matching the glob.
recent_files = sorted(base_path.glob(glob), key=get_ctime)[::-1]
if not recent_files:
logging.error("No files found for instrument %s", instrument)
raise RuntimeError(f"No files found for instrument {instrument}")
openable_files = _first_n_openable_files(recent_files, n)
if not openable_files:
logging.error("No files found for instrument %s that can be opened", instrument)
> raise RuntimeError(
f"No files found for instrument {instrument} that can be opened"
)
E RuntimeError: No files found for instrument loki that can be opened
.tox/ingestor/lib/python3.12/site-packages/dmsc_nightly/nexusfiles/coda.py:73: RuntimeError
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None