Limited write support - #170
Conversation
…for the simmed_ms fixture
This reverts commit 560afd6.
This reverts commit fc8e5f0.
|
Hi @sjperkins — @landmanbester pointed me at this branch while I was planning the move of Four findings from that prototyping, all measured. The first is the one that matters to us. 1. The
|
| observer | sees the new column? |
|---|---|
fresh arcae.table(ms) in the same process |
no |
| separate process | no |
separate process, after dt.close() |
yes |
For a single-process script this is invisible. For any distributed consumer it is a trap: the
natural shape is driver creates the columns, then fans work out to worker processes, and
those workers open their own handles and will not find the column. We can work around it by
closing the DataTree before dispatch, but that is an undocumented ordering constraint that
every consumer has to rediscover. A flush at the end of sync_msv2 would remove it.
3. Concurrent multi-process region writes are correct (nice!)
Four separate processes, each opening its own DataTree with ninstances=1 and writing a
disjoint time region of the same MS with to_msv2(compute=True, region=...): all four
regions came out correct. That is the scenario Ray puts us in, and it means we need no
writer actor and no serialisation layer at all. Worth having as a test on the 0.5.x line
alongside the existing dask test_distributed_write.
4. MainMSv2Array.__setitem__ does not filter row_map == -1 — but arcae saves us
rows = self._structure_factory.instance[self._partition].row_map[key[:2]]
row_key = (rows.ravel(),) + key[2:]
...putcol(self._column, value, index=row_key)Absent (time, baseline) cells carry -1, which goes straight into putcol as a row index.
I checked what arcae does with that, since a numpy-style interpretation would silently
scribble on the last row of the table:
putcol("MODEL_DATA", payload, index=([-1, 5, -1, 9],))
-> accepted, no error
-> rows actually written: [5 9]
-> row 5 got payload[1], row 9 got payload[3] (correctly aligned)
-> last row of the table untouched
So it is safe: arcae skips negative indices and keeps the payload aligned. Given how bad the
alternative would have been, and that partitions with missing baselines are the normal case
for MeerKAT, this feels like it deserves an explicit test rather than resting on arcae's
behaviour being what it is.
5. Minor: the test simulator is stale against arcae 0.5.x
tests/test_write.py cannot run on 0.5.x because of the fixture, not the write path:
xarray_ms/testing/simulator.py:233: in simulate_ms
with Table.ms_from_descriptor(output_ms, "MAIN", 1, table_desc) as T:
E TypeError: Argument 'table_desc' has incorrect type (expected dict, got int)
ms_from_descriptor's signature changed between the two arcae lines. Mentioning it because
it is the first thing anyone rebasing this branch will hit, and it makes the branch look more
broken on 0.5.x than it actually is.
Is there anything we can usefully do to help get this landed? pfb-imaging's degrid work is
gated on it — the rest of the plan (a pure-numpy degrid kernel in
landmanbester/pfb-model-spec#22 and a beam helper in
landmanbester/meerkat-beams#27) is independent and can proceed in parallel, but the MSv4
front-end itself waits on this PR. Happy to contribute tests or the ninstances plumbing if
that is useful rather than in the way.
This is by design. The write support branch is versioned in the following range
I think you believe this because of some internal context that you've stored somewhere but the contents of #211 and #212 should have been merged into this branch. If pfb is explicitly depending on write support (much like tricolour does, it should pin
Correct, this is actually an artifact of the CTDS (creating a column in one process isn't automatically observed by other processes). The suggested workaround is correct. |
|
You're right, and my finding #1 was wrong. Retracting it properly, since it was the one that I inferred "0.4.0-alpha.8 predates 0.5.2, therefore lacks #211/#212" from the version
And I then re-ran everything on the intended stack rather than my patched one:
What still stands, for the record:
One genuine question left, about the release plan rather than the code. tricolour can sit on Thanks for the correction, and for pointing us at ratt-ru/tricolour#106 — the |
The plan is that:
|
casacore's Table::addColumn accepts only a single data manager specification per call, so columns must be added individually rather than in one addcols call with multiple data manager groups. The previous assert only checked that the newly created columns ended up on the table; replace it with a ColumnCreationError that checks every column required for writing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Columns present in casacore's canonical MAIN descriptor but absent from the table were previously validated against that definition but never created (#171). They are now created from a descriptor synthesised by synthesise_column_desc(), which inherits descriptive metadata (comment, keywords) from the canonical definition but not its storage layout: canonical definitions are typically variably-shaped StandardStMan columns whose cells contain no array until written in full, which defeats partial writes. Fixed-shape variables get a TiledColumnStMan, variably-shaped ones a TiledShapeStMan (previously StandardStMan). A variable dtype that disagrees with the canonical valueType wins but now warns via NonCanonicalColumnWarning; variables whose trailing shapes disagree on dimensionality now raise instead of being silently accepted. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Thanks for contributing to xarray-ms.
We would appreciate it if you could add:
doc/source/changelog.rst.📚 Documentation preview 📚: https://xarray-ms--170.org.readthedocs.build/en/170/