broker rugnux live: no files, END built from the result in memory, and review fixes
No files. The receiver no longer makes a /tmp scratch directory or reads rugnux's files back: AddToEndMessage moves the merged MtzTable and the map coefficients out of ProcessResult::outputs and converts the placed model with PlacedModelFromStructure (now given the data cell, as WritePlacedModel is). FillRugnuxResultBlocks and MtzTableFromFile are gone; their test now builds the blocks from the same in-memory outputs and still checks the writer reproduces rugnux's own files byte for byte. The live status report is built from the result with the writer's file prefix as its label. AddToEndMessage never throws: a failure is logged and the END goes without the blocks. Review fixes: - MakeRugnuxLiveSetup sets nthreads_auto, as a bare `rugnux` does, so the per-image loop keeps to GPUWorkersPerCard per card instead of starting one GPU worker per CPU thread; the 60-degree probe gets a quarter of the threads (at least 2). - A failure setting rugnux up (start message, reader, thread start) marks the live status Failed and nothing else; the collection goes on as in Lite. MeasurementThread and ForwardThread also catch std::exception, so no exception skips the latch or the reader's Ended(). - The ParallelFor pool is lowered to nice 10 only where it can be raised back (CAP_SYS_NICE, or RLIMIT_NICE reaching 0); otherwise it is left alone and that is logged once. - The preview and metadata sockets get the END without the result blocks. - Receiver plots and scan result are fed only from the canonical pass (RugnuxObserver::OnImagePass): the pre-pass reports [0, E) again at the header geometry and the plots accumulate, so it would count those images twice. The canonical pass reads every image once. - A collection the image buffer cannot hold is still not analysed, and now says so in the broker status (Warning) as well as the rugnux status. With rugnux live off nothing changes: the extra END resets are of empty blocks and analysis_warning is empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5028aac0ee
commit
e16db07ffd
11 files changed
+183
-134
No files matched your search
@@ -84,7 +84,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("RugnuxResultFiles: rugnux's files -> END blocks -> CBOR -> writer, byte for byte", "[rugnux_result_files]") {
|
||||
TEST_CASE("RugnuxResultFiles: rugnux's outputs -> END blocks -> CBOR -> writer, byte for byte", "[rugnux_result_files]") {
|
||||
Logger logger("RugnuxResultFiles");
|
||||
const std::filesystem::path dir = std::filesystem::temp_directory_path() / "rugnux_result_files_test";
|
||||
std::filesystem::remove_all(dir);
|
||||
@@ -115,7 +115,12 @@ TEST_CASE("RugnuxResultFiles: rugnux's files -> END blocks -> CBOR -> writer, by
|
||||
OutputProvenance provenance;
|
||||
provenance.command_line = "rugnux -N 8 input_master.h5";
|
||||
provenance.input_file = "/some/where/input_master.h5";
|
||||
WriteMtzReflections(reflections, TEST_CELL, experiment, provenance, original + ".mtz");
|
||||
// The files as rugnux writes them from its outputs (RugnuxOutputFiles.cpp), and the same outputs as the
|
||||
// broker puts them in the END message (JFJochReceiverRugnux::AddToEndMessage).
|
||||
EndMessage end{};
|
||||
end.max_image_number = 100;
|
||||
end.merged = MergedMtzTable(reflections, TEST_CELL, experiment, provenance);
|
||||
WriteMtz(*end.merged, original + ".mtz");
|
||||
|
||||
// Map coefficients as model validation lays them out (ModelMaps::coefficients).
|
||||
MtzTable maps;
|
||||
@@ -137,15 +142,10 @@ TEST_CASE("RugnuxResultFiles: rugnux's files -> END blocks -> CBOR -> writer, by
|
||||
maps.columns[c].values.push_back(row[c]);
|
||||
}
|
||||
WriteMtz(maps, original + "_maps.mtz");
|
||||
end.map_coefficients = maps;
|
||||
|
||||
WritePlacedModel(TestModel(), TEST_CELL, experiment.GetSpaceGroupOrP1(), original, logger);
|
||||
|
||||
EndMessage end{};
|
||||
end.max_image_number = 100;
|
||||
FillRugnuxResultBlocks(original, end);
|
||||
REQUIRE(end.merged);
|
||||
REQUIRE(end.map_coefficients);
|
||||
REQUIRE(end.placed_model);
|
||||
end.placed_model = PlacedModelFromStructure(TestModel(), TEST_CELL, experiment.GetSpaceGroupOrP1().xhm());
|
||||
REQUIRE(end.merged->columns.size() == 16); // with the anomalous columns
|
||||
CHECK(end.merged->columns[0].values.size() == reflections.size());
|
||||
CHECK(end.placed_model->atom_name.size() == 2 * 3 * 6 + 2);
|
||||
@@ -242,3 +242,31 @@ TEST_CASE("RugnuxResultFiles: an MTZ table that describes no file is refused", "
|
||||
|
||||
std::filesystem::remove(path);
|
||||
}
|
||||
|
||||
TEST_CASE("RugnuxResultFiles: a placed model block that describes no model is refused", "[rugnux_result_files]") {
|
||||
Logger logger("RugnuxResultFiles");
|
||||
const PlacedModelMessage good = PlacedModelFromStructure(TestModel(), TEST_CELL, "P 43 21 2");
|
||||
REQUIRE_NOTHROW(PlacedModelStructure(good));
|
||||
|
||||
PlacedModelMessage short_field = good;
|
||||
short_field.b_iso.pop_back();
|
||||
CHECK_THROWS(PlacedModelStructure(short_field));
|
||||
|
||||
PlacedModelMessage bad_aniso = good;
|
||||
bad_aniso.aniso.resize(5);
|
||||
CHECK_THROWS(PlacedModelStructure(bad_aniso));
|
||||
|
||||
// The writer reports it and goes on: no file, no crash.
|
||||
const std::filesystem::path dir = std::filesystem::temp_directory_path() / "rugnux_result_files_bad_model";
|
||||
std::filesystem::remove_all(dir);
|
||||
std::filesystem::create_directories(dir);
|
||||
const std::string prefix = (dir / "run").string();
|
||||
EndMessage end{};
|
||||
end.placed_model = short_field;
|
||||
REQUIRE_NOTHROW(WriteRugnuxResultFiles(end, prefix, false, logger));
|
||||
end.placed_model = good;
|
||||
end.placed_model->space_group_name = "not a group";
|
||||
REQUIRE_NOTHROW(WriteRugnuxResultFiles(end, prefix, false, logger));
|
||||
CHECK(!std::filesystem::exists(prefix + "_model.cif"));
|
||||
std::filesystem::remove_all(dir);
|
||||
}
|
||||
Reference in new issue
Block a user