broker: initialize clears the image buffer, turns live rugnux off and removes its model
Initialize is the fresh start between users, so nothing of the previous one's session is left: the image buffer is cleared, live rugnux processing is disabled and the uploaded MR model is dropped. It is done at the start of Initialize, under m then rugnux_mutex (the order the other setters take), so it happens even if configuring the detector then fails. The receiver is always Idle when the state machine is not running, so the buffer clear has no unmet precondition. The dashboard's rugnux panel read the settings only once, on mount, so after an initialize from any client it kept showing the previous run; it now polls them like the Rugnux tab does. The /initialize description in jfjoch_api.yaml says so; the frontend client is regenerated (description only). The python client docs and redoc follow at the release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PXc1zD1yxHqaR1DGdCTHL4
This commit is contained in:
1 parent
aa05882c46
commit
c2e5e4a4e8
6 files changed
+37
-2
No files matched your search
@@ -329,6 +329,18 @@ void JFJochStateMachine::Initialize() {
|
||||
ResetError(); // Clear error, we don't care what was it
|
||||
start_exception = nullptr; // Re-initialising discards a pending start failure
|
||||
|
||||
// A fresh start: no images from before, and no live rugnux analysis or model left over from the
|
||||
// previous user.
|
||||
services.ClearImageBuffer();
|
||||
{
|
||||
std::unique_lock ul2(rugnux_mutex);
|
||||
RugnuxLiveSettings s = services.GetRugnuxLive();
|
||||
s.enable = false;
|
||||
s.model = nullptr;
|
||||
s.model_size_bytes = 0;
|
||||
services.SetRugnuxLive(s);
|
||||
}
|
||||
|
||||
logger.Info("Initialize");
|
||||
SetState(JFJochState::Busy, "Configuring indexing threads", BrokerStatus::MessageSeverity::Info);
|
||||
try {
|
||||
|
||||
@@ -2917,6 +2917,7 @@ paths:
|
||||
This operation will reconfigure network interface of the detector.
|
||||
During operation of the detector it is recommended to use the `POST /pedestal` operation instead.
|
||||
If storage cells are used, the execution time might be few minutes.
|
||||
It also clears the image buffer, disables live rugnux analysis and removes the rugnux model.
|
||||
|
||||
This is async function - one needs to use `POST /wait_till_done` to ensure operation is done.
|
||||
responses:
|
||||
|
||||
@@ -16,6 +16,7 @@ import type { deleteConfigRugnuxModelData, deleteConfigRugnuxModelError, getConf
|
||||
* This operation will reconfigure network interface of the detector.
|
||||
* During operation of the detector it is recommended to use the `POST /pedestal` operation instead.
|
||||
* If storage cells are used, the execution time might be few minutes.
|
||||
* It also clears the image buffer, disables live rugnux analysis and removes the rugnux model.
|
||||
*
|
||||
* This is async function - one needs to use `POST /wait_till_done` to ensure operation is done.
|
||||
*
|
||||
|
||||
@@ -28,6 +28,7 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
||||
* This operation will reconfigure network interface of the detector.
|
||||
* During operation of the detector it is recommended to use the `POST /pedestal` operation instead.
|
||||
* If storage cells are used, the execution time might be few minutes.
|
||||
* It also clears the image buffer, disables live rugnux analysis and removes the rugnux model.
|
||||
*
|
||||
* This is async function - one needs to use `POST /wait_till_done` to ensure operation is done.
|
||||
*
|
||||
|
||||
@@ -14,9 +14,10 @@ const KEY_ROW = /space group|unit cell|resolution|completeness|signal/i;
|
||||
// Live rugnux processing of the last collection, as a full-width dashboard row: the timeline, the
|
||||
// step it is on and the steps behind it, and once it is over the verdict with the key results.
|
||||
// Nothing while rugnux has not run, and nothing - not even the status polling - while the mode is off
|
||||
// (the settings are read once, on mount). Renders its own grid item, so an idle card leaves no gap.
|
||||
// (the settings are polled, as initialize turns the mode off). Renders its own grid item, so an idle
|
||||
// card leaves no gap.
|
||||
function RugnuxStatus() {
|
||||
const {data: settings} = useQuery(getConfigRugnuxOptions());
|
||||
const {data: settings} = useQuery({...getConfigRugnuxOptions(), refetchInterval: 2000});
|
||||
const enabled = settings?.enable === true;
|
||||
const {data: s, isError} = useQuery({
|
||||
...getRugnuxStatusOptions(),
|
||||
|
||||
@@ -30,6 +30,25 @@ TEST_CASE("JFJochStateMachine_States") {
|
||||
REQUIRE(state_machine.GetStatus().state == JFJochState::Inactive);
|
||||
}
|
||||
|
||||
TEST_CASE("JFJochStateMachine_Initialize_DisablesRugnux") {
|
||||
Logger logger("JFJochStateMachine_Initialize_DisablesRugnux");
|
||||
JFJochServices services(logger);
|
||||
DiffractionExperiment experiment;
|
||||
JFJochStateMachine state_machine(experiment, services, logger);
|
||||
state_machine.AddDetectorSetup(DetJF4M());
|
||||
|
||||
state_machine.SetRugnuxLive(true, 4, 30.0);
|
||||
REQUIRE(state_machine.GetRugnuxLive().enable);
|
||||
|
||||
REQUIRE_NOTHROW(state_machine.Initialize());
|
||||
REQUIRE_NOTHROW(state_machine.WaitTillMeasurementDone());
|
||||
|
||||
const auto s = state_machine.GetRugnuxLive();
|
||||
CHECK(!s.enable);
|
||||
CHECK(s.model == nullptr);
|
||||
CHECK(s.model_size_bytes == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("JFJochStateMachine_State_Pedestal") {
|
||||
Logger logger("JFJochStateMachine_State_Pedestal");
|
||||
JFJochServices services(logger);
|
||||
|
||||
Reference in new issue
Block a user