diff --git a/broker/JFJochBrokerHttp.cpp b/broker/JFJochBrokerHttp.cpp index b722a6600..f0b638ba3 100644 --- a/broker/JFJochBrokerHttp.cpp +++ b/broker/JFJochBrokerHttp.cpp @@ -16,6 +16,7 @@ #include "../preview/JFJochTIFF.h" #include "OpenAPIConvert.h" #include "../image_pusher/LiveCollection.h" +#include "../writer/RugnuxModelFile.h" #include #include "gen/model/Error_message.h" @@ -152,7 +153,10 @@ static const std::set PROTECTED_PATHS{ "/image_buffer/image.tiff", "/preview/plot", "/preview/plot.bin", - "/live/events" + "/live/events", + "/config/rugnux", + "/config/rugnux/model", + "/rugnux/status" }; std::optional JFJochBrokerHttp::AuthorizationHeader(const httplib::Request &req) { @@ -251,6 +255,11 @@ void JFJochBrokerHttp::register_routes(httplib::Server &server) { server.Post("/config/image_format/raw", bind_noarg(&JFJochBrokerHttp::config_image_format_raw_post)); server.Get("/config/indexing", bind_noarg(&JFJochBrokerHttp::config_indexing_get)); server.Put("/config/indexing", bind_json(&JFJochBrokerHttp::config_indexing_put, Indexing_settings{})); + server.Get("/config/rugnux", bind_noarg(&JFJochBrokerHttp::config_rugnux_get)); + server.Put("/config/rugnux", bind_json(&JFJochBrokerHttp::config_rugnux_put, Rugnux_settings{})); + server.Put("/config/rugnux/model", bind_req(&JFJochBrokerHttp::config_rugnux_model_put)); + server.Delete("/config/rugnux/model", bind_noarg(&JFJochBrokerHttp::config_rugnux_model_delete)); + server.Get("/rugnux/status", bind_noarg(&JFJochBrokerHttp::rugnux_status_get)); server.Get("/config/bragg_integration", bind_noarg(&JFJochBrokerHttp::config_bragg_integration_get)); server.Put("/config/bragg_integration", bind_json(&JFJochBrokerHttp::config_bragg_integration_put, Bragg_integration_settings{})); server.Get("/config/instrument", bind_noarg(&JFJochBrokerHttp::config_instrument_get)); @@ -963,6 +972,60 @@ void JFJochBrokerHttp::config_indexing_put(const Indexing_settings &indexingSett response.status = 200; } +void JFJochBrokerHttp::config_rugnux_get(httplib::Response &response) { + const RugnuxLiveSettings s = state_machine.GetRugnuxLive(); + Rugnux_status ret; + ret.setEnable(s.enable); + ret.setReservedCpus(s.reserved_cpus); + ret.setDeadlineS(s.deadline_s); + ret.setModelLoaded(s.model != nullptr); + if (s.model) + ret.setModelSizeBytes(s.model_size_bytes); + ProcessOutput(ret, response); +} + +void JFJochBrokerHttp::config_rugnux_put(const Rugnux_settings &rugnuxSettings, + httplib::Response &response) { + state_machine.SetRugnuxLive(rugnuxSettings.isEnable(), rugnuxSettings.getReservedCpus(), + rugnuxSettings.getDeadlineS()); + response.status = 200; +} + +void JFJochBrokerHttp::config_rugnux_model_put(const httplib::Request &request, + httplib::Response &response) { + if (request.body.empty()) { + response.status = 400; + response.set_content("Request body cannot be empty", "text/plain"); + return; + } + if (request.body.size() > 64 * 1024 * 1024) { + response.status = 413; + response.set_content("Model cannot be larger than 64 MiB", "text/plain"); + return; + } + std::shared_ptr model; + try { + model = std::make_shared(ParseRugnuxModel(request.body, "model")); + } catch (const std::exception &e) { + response.status = 400; + response.set_content(std::string("Not an atomic model: ") + e.what(), "text/plain"); + return; + } + state_machine.SetRugnuxModel(std::move(model), static_cast(request.body.size())); + logger.Info("Rugnux model uploaded ({} bytes)", request.body.size()); + response.status = 200; +} + +void JFJochBrokerHttp::config_rugnux_model_delete(httplib::Response &response) { + state_machine.SetRugnuxModel(nullptr, 0); + logger.Info("Rugnux model removed"); + response.status = 200; +} + +void JFJochBrokerHttp::rugnux_status_get(httplib::Response &response) { + ProcessOutput(Convert(state_machine.GetRugnuxStatus()), response); +} + void JFJochBrokerHttp::config_bragg_integration_get(httplib::Response &response) { ProcessOutput(Convert(state_machine.GetBraggIntegrationSettings()), response); } diff --git a/broker/JFJochBrokerHttp.h b/broker/JFJochBrokerHttp.h index 8d42a4593..3528ab5d3 100644 --- a/broker/JFJochBrokerHttp.h +++ b/broker/JFJochBrokerHttp.h @@ -34,6 +34,8 @@ #include "gen/model/Jfjoch_statistics.h" #include "gen/model/Plots.h" #include "gen/model/Roi_definitions.h" +#include "gen/model/Rugnux_settings.h" +#include "gen/model/Rugnux_status.h" #include "gen/model/Scan_result.h" #include "gen/model/Spot_finding_settings.h" #include "gen/model/Zeromq_metadata_settings.h" @@ -198,6 +200,12 @@ class JFJochBrokerHttp { void config_indexing_get(httplib::Response &response); void config_indexing_put(const org::openapitools::server::model::Indexing_settings &indexingSettings, httplib::Response &response); + void config_rugnux_get(httplib::Response &response); + void config_rugnux_put(const org::openapitools::server::model::Rugnux_settings &rugnuxSettings, + httplib::Response &response); + void config_rugnux_model_put(const httplib::Request &request, httplib::Response &response); + void config_rugnux_model_delete(httplib::Response &response); + void rugnux_status_get(httplib::Response &response); void config_bragg_integration_get(httplib::Response &response); void config_bragg_integration_put(const org::openapitools::server::model::Bragg_integration_settings &braggIntegrationSettings, httplib::Response &response); diff --git a/broker/JFJochBrokerParser.cpp b/broker/JFJochBrokerParser.cpp index 7f4efcfbc..45409ca9c 100644 --- a/broker/JFJochBrokerParser.cpp +++ b/broker/JFJochBrokerParser.cpp @@ -276,6 +276,15 @@ void ParseReceiverSettings(const org::openapitools::server::model::Jfjoch_settin } } +void ParseRugnuxSettings(const org::openapitools::server::model::Jfjoch_settings &input, JFJochServices &services) { + if (input.rugnuxIsSet()) + services.SetRugnuxLive(RugnuxLiveSettings{ + .enable = input.getRugnux().isEnable(), + .reserved_cpus = input.getRugnux().getReservedCpus(), + .deadline_s = input.getRugnux().getDeadlineS() + }); +} + SpotFindingSettings ParseSpotFindingSettings(const org::openapitools::server::model::Jfjoch_settings &input) { if (input.spotFindingIsSet()) return Convert(input.getSpotFinding()); diff --git a/broker/JFJochBrokerParser.h b/broker/JFJochBrokerParser.h index f5f2f8399..aff60a211 100644 --- a/broker/JFJochBrokerParser.h +++ b/broker/JFJochBrokerParser.h @@ -7,6 +7,7 @@ #include "../acquisition_device/AcquisitionDeviceGroup.h" #include "../image_pusher/ImagePusher.h" #include "../receiver/JFJochReceiverService.h" +#include "JFJochServices.h" #include "gen/model/Jfjoch_settings.h" DetectorGeometryModular ParseStandardDetectorGeometry(const org::openapitools::server::model::Detector &j); @@ -20,4 +21,5 @@ std::unique_ptr ParseImagePusher(const org::openapitools::server::m void ParseAcquisitionDeviceGroup(const org::openapitools::server::model::Jfjoch_settings &input, AcquisitionDeviceGroup &aq_devices); void ParseReceiverSettings(const org::openapitools::server::model::Jfjoch_settings &input, JFJochReceiverService &service); +void ParseRugnuxSettings(const org::openapitools::server::model::Jfjoch_settings &input, JFJochServices &services); SpotFindingSettings ParseSpotFindingSettings(const org::openapitools::server::model::Jfjoch_settings &input); diff --git a/broker/JFJochServices.cpp b/broker/JFJochServices.cpp index 8eb9edb96..31dfaee5f 100644 --- a/broker/JFJochServices.cpp +++ b/broker/JFJochServices.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only #include "JFJochServices.h" + #include "../common/JFJochException.h" #include "../detector_control/SLSDetectorWrapper.h" #include "../detector_control/DectrisDetectorWrapper.h" @@ -370,6 +371,29 @@ void JFJochServices::SetupIndexing(const IndexingSettings &input) { receiver->Indexing(input); } +void JFJochServices::SetRugnuxLive(const RugnuxLiveSettings &input) { + if (receiver) + receiver->RugnuxLive(input.enable, input.model, input.reserved_cpus, input.deadline_s); + rugnux = input; +} + +RugnuxLiveSettings JFJochServices::GetRugnuxLive() const { + return rugnux; +} + +RugnuxLiveSnapshot JFJochServices::GetRugnuxStatus() const { + if (receiver) + return receiver->GetRugnuxStatus(); + return {}; +} + +void JFJochServices::SetRugnuxModel(std::shared_ptr model, int64_t size_bytes) { + RugnuxLiveSettings s = rugnux; + s.model = std::move(model); + s.model_size_bytes = s.model ? size_bytes : 0; + SetRugnuxLive(s); +} + LiveCollection *JFJochServices::GetLiveCollection() { return receiver ? receiver->GetLiveCollection() : nullptr; } diff --git a/broker/JFJochServices.h b/broker/JFJochServices.h index 01f051cc0..20ef4eb6a 100644 --- a/broker/JFJochServices.h +++ b/broker/JFJochServices.h @@ -14,6 +14,14 @@ struct JFJochServicesOutput { JFJochReceiverOutput receiver_output; }; +struct RugnuxLiveSettings { + bool enable = false; + int64_t reserved_cpus = 4; + double deadline_s = 0; // the analysis is cut this long after the last image (0 = never) + std::shared_ptr model; // null = no model + int64_t model_size_bytes = 0; // as uploaded +}; + class JFJochServices { mutable std::shared_timed_mutex detector_mutex; @@ -22,6 +30,8 @@ class JFJochServices { std::shared_ptr image_puller; std::atomic cannot_stop_detector = false; + + RugnuxLiveSettings rugnux; Logger &logger; public: explicit JFJochServices(Logger &in_logger); @@ -76,6 +86,12 @@ public: void SetupIndexing(const IndexingSettings& input); + void SetRugnuxLive(const RugnuxLiveSettings &input); + RugnuxLiveSettings GetRugnuxLive() const; + // The model is kept in memory, parsed, for every following collection; nullptr removes it + void SetRugnuxModel(std::shared_ptr model, int64_t size_bytes); + RugnuxLiveSnapshot GetRugnuxStatus() const; + ImagePusherStatus GetImagePusherStatus() const; LiveCollection *GetLiveCollection(); }; diff --git a/broker/JFJochStateMachine.cpp b/broker/JFJochStateMachine.cpp index 1b93ad2a7..29ee052d0 100644 --- a/broker/JFJochStateMachine.cpp +++ b/broker/JFJochStateMachine.cpp @@ -556,6 +556,10 @@ void JFJochStateMachine::MeasurementThread() { SetState(JFJochState::Idle, "Stream receiver (writer or downstream analysis) cannot cope with data; reduce frame rate", BrokerStatus::MessageSeverity::Warning); + else if (!tmp_output.receiver_output.analysis_warning.empty()) + SetState(JFJochState::Idle, + "Data collection without problems, but " + tmp_output.receiver_output.analysis_warning, + BrokerStatus::MessageSeverity::Warning); else SetState(JFJochState::Idle, "Data collection without problems", @@ -1209,6 +1213,35 @@ IndexingSettings JFJochStateMachine::GetIndexingSettings() const { return experiment.GetIndexingSettings(); } +void JFJochStateMachine::SetRugnuxLive(bool enable, int64_t reserved_cpus, double deadline_s) { + std::unique_lock ul(m); + if (IsRunning()) + throw WrongDAQStateException("Cannot change rugnux settings during data collection"); + std::unique_lock ul2(rugnux_mutex); + RugnuxLiveSettings s = services.GetRugnuxLive(); + s.enable = enable; + s.reserved_cpus = reserved_cpus; + s.deadline_s = deadline_s; + services.SetRugnuxLive(s); +} + +void JFJochStateMachine::SetRugnuxModel(std::shared_ptr model, int64_t size_bytes) { + std::unique_lock ul(m); + if (IsRunning()) + throw WrongDAQStateException("Cannot change rugnux model during data collection"); + std::unique_lock ul2(rugnux_mutex); + services.SetRugnuxModel(std::move(model), size_bytes); +} + +RugnuxLiveSettings JFJochStateMachine::GetRugnuxLive() const { + std::unique_lock ul(rugnux_mutex); + return services.GetRugnuxLive(); +} + +RugnuxLiveSnapshot JFJochStateMachine::GetRugnuxStatus() const { + return services.GetRugnuxStatus(); +} + void JFJochStateMachine::SetIndexingSettings(const IndexingSettings &input) { std::unique_lock ul(m); if (IsRunning()) diff --git a/broker/JFJochStateMachine.h b/broker/JFJochStateMachine.h index a28d9cecc..ed494dcaf 100644 --- a/broker/JFJochStateMachine.h +++ b/broker/JFJochStateMachine.h @@ -90,6 +90,7 @@ class JFJochStateMachine { mutable std::mutex experiment_file_writer_settings_mutex; mutable std::mutex experiment_indexing_settings_mutex; mutable std::mutex experiment_dark_mask_settings_mutex; + mutable std::mutex rugnux_mutex; DiffractionExperiment experiment; // mutex m is protecting: @@ -247,6 +248,11 @@ public: void SetIndexingSettings(const IndexingSettings &input); IndexingSettings GetIndexingSettings() const; + void SetRugnuxLive(bool enable, int64_t reserved_cpus, double deadline_s); + void SetRugnuxModel(std::shared_ptr model, int64_t size_bytes); // null = remove the model + RugnuxLiveSettings GetRugnuxLive() const; + RugnuxLiveSnapshot GetRugnuxStatus() const; + void SetBraggIntegrationSettings(const BraggIntegrationSettings &input); BraggIntegrationSettings GetBraggIntegrationSettings() const; PixelMaskStatistics GetPixelMaskStatistics() const; diff --git a/broker/OpenAPIConvert.cpp b/broker/OpenAPIConvert.cpp index 8cf6f8e6d..5f8a85376 100644 --- a/broker/OpenAPIConvert.cpp +++ b/broker/OpenAPIConvert.cpp @@ -1221,6 +1221,60 @@ DarkMaskSettings Convert(const org::openapitools::server::model::Dark_mask_setti return ret; } +org::openapitools::server::model::Rugnux_live_status Convert(const RugnuxLiveSnapshot& input) { + org::openapitools::server::model::Rugnux_live_status ret; + switch (input.state) { + case RugnuxLiveState::Idle: ret.setState("Idle"); break; + case RugnuxLiveState::Running: ret.setState("Running"); break; + case RugnuxLiveState::Done: ret.setState("Done"); break; + case RugnuxLiveState::Failed: ret.setState("Failed"); break; + case RugnuxLiveState::Cancelled: ret.setState("Cancelled"); break; + case RugnuxLiveState::Skipped: ret.setState("Skipped"); break; + } + ret.setMessage(input.message); + ret.setImagesExpected(input.images_expected); + ret.setImagesReceived(input.images_received); + ret.setElapsedS(input.elapsed_s); + ret.setProbe(input.probe); + if (input.probe_s) + ret.setProbeS(input.probe_s.value()); + if (input.step_progress) + ret.setStepProgress(input.step_progress.value()); + + std::vector steps; + for (const auto &s: input.steps) { + org::openapitools::server::model::Rugnux_live_step step; + step.setTitle(s.title); + step.setStartedS(s.started_s); + if (s.duration_s) + step.setDurationS(s.duration_s.value()); + step.setNotes(s.notes); + steps.push_back(step); + } + ret.setSteps(steps); + + if (input.last_image_s) + ret.setLastImageS(input.last_image_s.value()); + ret.setCut(input.cut); + if (input.cut_s) + ret.setCutS(input.cut_s.value()); + if (input.last_image_to_written_s) + ret.setLastImageToWrittenS(input.last_image_to_written_s.value()); + ret.setVerdict(input.verdict); + ret.setVerdictText(input.verdict_text); + + std::vector summary; + for (const auto &[label, value]: input.summary) { + org::openapitools::server::model::Rugnux_summary_row row; + row.setLabel(label); + row.setValue(value); + summary.push_back(row); + } + ret.setSummary(summary); + ret.setWarnings(input.warnings); + return ret; +} + org::openapitools::server::model::Image_pusher_status Convert(const ImagePusherStatus& input) { org::openapitools::server::model::Image_pusher_status ret; ret.setAddr(input.address); diff --git a/broker/OpenAPIConvert.h b/broker/OpenAPIConvert.h index fd36ea1da..6556cc0bc 100644 --- a/broker/OpenAPIConvert.h +++ b/broker/OpenAPIConvert.h @@ -30,6 +30,7 @@ #include "gen/model/Indexing_settings.h" #include "gen/model/Bragg_integration_settings.h" #include "gen/model/Scan_result.h" +#include "gen/model/Rugnux_live_status.h" #include "../common/JFJochMessages.h" #include "../common/DatasetSettings.h" @@ -41,6 +42,7 @@ #include "../common/InstrumentMetadata.h" #include "../common/ScanResult.h" #include "../image_pusher/ImagePusher.h" +#include "../receiver/RugnuxLiveStatus.h" SpotFindingSettings Convert(const org::openapitools::server::model::Spot_finding_settings &input); org::openapitools::server::model::Spot_finding_settings Convert(const SpotFindingSettings &input); @@ -99,4 +101,5 @@ org::openapitools::server::model::Dark_mask_settings Convert(const DarkMaskSetti DarkMaskSettings Convert(const org::openapitools::server::model::Dark_mask_settings& input); org::openapitools::server::model::Image_pusher_status Convert(const ImagePusherStatus& input); +org::openapitools::server::model::Rugnux_live_status Convert(const RugnuxLiveSnapshot& input); diff --git a/broker/gen/model/Jfjoch_settings.cpp b/broker/gen/model/Jfjoch_settings.cpp index 45a3fba15..2bf33c19a 100644 --- a/broker/gen/model/Jfjoch_settings.cpp +++ b/broker/gen/model/Jfjoch_settings.cpp @@ -44,6 +44,7 @@ Jfjoch_settings::Jfjoch_settings() m_Zeromq_previewIsSet = false; m_Zeromq_metadataIsSet = false; m_Dark_maskIsSet = false; + m_RugnuxIsSet = false; } @@ -141,7 +142,7 @@ bool Jfjoch_settings::validate(std::stringstream& msg, const std::string& pathPr } } - + return success; } @@ -211,7 +212,10 @@ bool Jfjoch_settings::operator==(const Jfjoch_settings& rhs) const ((!zeromqMetadataIsSet() && !rhs.zeromqMetadataIsSet()) || (zeromqMetadataIsSet() && rhs.zeromqMetadataIsSet() && getZeromqMetadata() == rhs.getZeromqMetadata())) && - ((!darkMaskIsSet() && !rhs.darkMaskIsSet()) || (darkMaskIsSet() && rhs.darkMaskIsSet() && getDarkMask() == rhs.getDarkMask())) + ((!darkMaskIsSet() && !rhs.darkMaskIsSet()) || (darkMaskIsSet() && rhs.darkMaskIsSet() && getDarkMask() == rhs.getDarkMask())) && + + + ((!rugnuxIsSet() && !rhs.rugnuxIsSet()) || (rugnuxIsSet() && rhs.rugnuxIsSet() && getRugnux() == rhs.getRugnux())) ; } @@ -263,6 +267,8 @@ void to_json(nlohmann::json& j, const Jfjoch_settings& o) j["zeromq_metadata"] = o.m_Zeromq_metadata; if(o.darkMaskIsSet()) j["dark_mask"] = o.m_Dark_mask; + if(o.rugnuxIsSet()) + j["rugnux"] = o.m_Rugnux; } @@ -361,6 +367,11 @@ void from_json(const nlohmann::json& j, Jfjoch_settings& o) j.at("dark_mask").get_to(o.m_Dark_mask); o.m_Dark_maskIsSet = true; } + if(j.find("rugnux") != j.end()) + { + j.at("rugnux").get_to(o.m_Rugnux); + o.m_RugnuxIsSet = true; + } } @@ -694,6 +705,23 @@ void Jfjoch_settings::unsetDark_mask() { m_Dark_maskIsSet = false; } +org::openapitools::server::model::Rugnux_settings Jfjoch_settings::getRugnux() const +{ + return m_Rugnux; +} +void Jfjoch_settings::setRugnux(org::openapitools::server::model::Rugnux_settings const& value) +{ + m_Rugnux = value; + m_RugnuxIsSet = true; +} +bool Jfjoch_settings::rugnuxIsSet() const +{ + return m_RugnuxIsSet; +} +void Jfjoch_settings::unsetRugnux() +{ + m_RugnuxIsSet = false; +} } // namespace org::openapitools::server::model diff --git a/broker/gen/model/Jfjoch_settings.h b/broker/gen/model/Jfjoch_settings.h index 4fb64e36b..1b778e352 100644 --- a/broker/gen/model/Jfjoch_settings.h +++ b/broker/gen/model/Jfjoch_settings.h @@ -31,6 +31,7 @@ #include "Image_format_settings.h" #include "Zeromq_metadata_settings.h" #include "Detector_settings.h" +#include "Rugnux_settings.h" #include #include "Indexing_settings.h" #include "Detector.h" @@ -216,6 +217,13 @@ public: void setDarkMask(org::openapitools::server::model::Dark_mask_settings const& value); bool darkMaskIsSet() const; void unsetDark_mask(); + /// + /// + /// + org::openapitools::server::model::Rugnux_settings getRugnux() const; + void setRugnux(org::openapitools::server::model::Rugnux_settings const& value); + bool rugnuxIsSet() const; + void unsetRugnux(); friend void to_json(nlohmann::json& j, const Jfjoch_settings& o); friend void from_json(const nlohmann::json& j, Jfjoch_settings& o); @@ -262,6 +270,8 @@ protected: bool m_Zeromq_metadataIsSet; org::openapitools::server::model::Dark_mask_settings m_Dark_mask; bool m_Dark_maskIsSet; + org::openapitools::server::model::Rugnux_settings m_Rugnux; + bool m_RugnuxIsSet; }; diff --git a/broker/gen/model/Rugnux_live_status.cpp b/broker/gen/model/Rugnux_live_status.cpp new file mode 100644 index 000000000..5ef2b451c --- /dev/null +++ b/broker/gen/model/Rugnux_live_status.cpp @@ -0,0 +1,484 @@ +/** +* Jungfraujoch +* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms. +* +* The version of the OpenAPI document: 1.0.0-rc.176 +* Contact: filip.leonarski@psi.ch +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "Rugnux_live_status.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +Rugnux_live_status::Rugnux_live_status() +{ + m_State = ""; + m_Probe = ""; + m_Probe_s = 0.0; + m_Probe_sIsSet = false; + m_Message = ""; + m_Images_expected = 0L; + m_Images_received = 0L; + m_Elapsed_s = 0.0; + m_Step_progress = 0.0f; + m_Step_progressIsSet = false; + m_Last_image_s = 0.0; + m_Last_image_sIsSet = false; + m_Cut = ""; + m_CutIsSet = false; + m_Cut_s = 0.0; + m_Cut_sIsSet = false; + m_Last_image_to_written_s = 0.0; + m_Last_image_to_written_sIsSet = false; + m_Verdict = ""; + m_Verdict_text = ""; + +} + +void Rugnux_live_status::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool Rugnux_live_status::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool Rugnux_live_status::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "Rugnux_live_status" : pathPrefix; + + + if (stepProgressIsSet()) + { + const float& value = m_Step_progress; + const std::string currentValuePath = _pathPrefix + ".stepProgress"; + + + if (value < static_cast(0.0)) + { + success = false; + msg << currentValuePath << ": must be greater than or equal to 0.0;"; + } + if (value > static_cast(1.0)) + { + success = false; + msg << currentValuePath << ": must be less than or equal to 1.0;"; + } + + } + + + /* Steps */ { + const std::vector& value = m_Steps; + const std::string currentValuePath = _pathPrefix + ".steps"; + + + { // Recursive validation of array elements + const std::string oldValuePath = currentValuePath; + int i = 0; + for (const org::openapitools::server::model::Rugnux_live_step& value : value) + { + const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]"; + + success = value.validate(msg, currentValuePath + ".steps") && success; + + i++; + } + } + + } + + + /* Summary */ { + const std::vector& value = m_Summary; + const std::string currentValuePath = _pathPrefix + ".summary"; + + + { // Recursive validation of array elements + const std::string oldValuePath = currentValuePath; + int i = 0; + for (const org::openapitools::server::model::Rugnux_summary_row& value : value) + { + const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]"; + + success = value.validate(msg, currentValuePath + ".summary") && success; + + i++; + } + } + + } + + + /* Warnings */ { + const std::vector& value = m_Warnings; + const std::string currentValuePath = _pathPrefix + ".warnings"; + + + { // Recursive validation of array elements + const std::string oldValuePath = currentValuePath; + int i = 0; + for (const std::string& value : value) + { + const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]"; + + + + i++; + } + } + + } + + return success; +} + +bool Rugnux_live_status::operator==(const Rugnux_live_status& rhs) const +{ + return + + + (getState() == rhs.getState()) + && + + (getProbe() == rhs.getProbe()) + && + + + ((!probeSIsSet() && !rhs.probeSIsSet()) || (probeSIsSet() && rhs.probeSIsSet() && getProbeS() == rhs.getProbeS())) && + + (getMessage() == rhs.getMessage()) + && + + (getImagesExpected() == rhs.getImagesExpected()) + && + + (getImagesReceived() == rhs.getImagesReceived()) + && + + (getElapsedS() == rhs.getElapsedS()) + && + + + ((!stepProgressIsSet() && !rhs.stepProgressIsSet()) || (stepProgressIsSet() && rhs.stepProgressIsSet() && getStepProgress() == rhs.getStepProgress())) && + + (getSteps() == rhs.getSteps()) + && + + + ((!lastImageSIsSet() && !rhs.lastImageSIsSet()) || (lastImageSIsSet() && rhs.lastImageSIsSet() && getLastImageS() == rhs.getLastImageS())) && + + + ((!cutIsSet() && !rhs.cutIsSet()) || (cutIsSet() && rhs.cutIsSet() && getCut() == rhs.getCut())) && + + + ((!cutSIsSet() && !rhs.cutSIsSet()) || (cutSIsSet() && rhs.cutSIsSet() && getCutS() == rhs.getCutS())) && + + + ((!lastImageToWrittenSIsSet() && !rhs.lastImageToWrittenSIsSet()) || (lastImageToWrittenSIsSet() && rhs.lastImageToWrittenSIsSet() && getLastImageToWrittenS() == rhs.getLastImageToWrittenS())) && + + (getVerdict() == rhs.getVerdict()) + && + + (getVerdictText() == rhs.getVerdictText()) + && + + (getSummary() == rhs.getSummary()) + && + + (getWarnings() == rhs.getWarnings()) + + + ; +} + +bool Rugnux_live_status::operator!=(const Rugnux_live_status& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const Rugnux_live_status& o) +{ + j = nlohmann::json::object(); + j["state"] = o.m_State; + j["probe"] = o.m_Probe; + if(o.probeSIsSet()) + j["probe_s"] = o.m_Probe_s; + j["message"] = o.m_Message; + j["images_expected"] = o.m_Images_expected; + j["images_received"] = o.m_Images_received; + j["elapsed_s"] = o.m_Elapsed_s; + if(o.stepProgressIsSet()) + j["step_progress"] = o.m_Step_progress; + j["steps"] = o.m_Steps; + if(o.lastImageSIsSet()) + j["last_image_s"] = o.m_Last_image_s; + if(o.cutIsSet()) + j["cut"] = o.m_Cut; + if(o.cutSIsSet()) + j["cut_s"] = o.m_Cut_s; + if(o.lastImageToWrittenSIsSet()) + j["last_image_to_written_s"] = o.m_Last_image_to_written_s; + j["verdict"] = o.m_Verdict; + j["verdict_text"] = o.m_Verdict_text; + j["summary"] = o.m_Summary; + j["warnings"] = o.m_Warnings; + +} + +void from_json(const nlohmann::json& j, Rugnux_live_status& o) +{ + j.at("state").get_to(o.m_State); + j.at("probe").get_to(o.m_Probe); + if(j.find("probe_s") != j.end()) + { + j.at("probe_s").get_to(o.m_Probe_s); + o.m_Probe_sIsSet = true; + } + j.at("message").get_to(o.m_Message); + j.at("images_expected").get_to(o.m_Images_expected); + j.at("images_received").get_to(o.m_Images_received); + j.at("elapsed_s").get_to(o.m_Elapsed_s); + if(j.find("step_progress") != j.end()) + { + j.at("step_progress").get_to(o.m_Step_progress); + o.m_Step_progressIsSet = true; + } + j.at("steps").get_to(o.m_Steps); + if(j.find("last_image_s") != j.end()) + { + j.at("last_image_s").get_to(o.m_Last_image_s); + o.m_Last_image_sIsSet = true; + } + if(j.find("cut") != j.end()) + { + j.at("cut").get_to(o.m_Cut); + o.m_CutIsSet = true; + } + if(j.find("cut_s") != j.end()) + { + j.at("cut_s").get_to(o.m_Cut_s); + o.m_Cut_sIsSet = true; + } + if(j.find("last_image_to_written_s") != j.end()) + { + j.at("last_image_to_written_s").get_to(o.m_Last_image_to_written_s); + o.m_Last_image_to_written_sIsSet = true; + } + j.at("verdict").get_to(o.m_Verdict); + j.at("verdict_text").get_to(o.m_Verdict_text); + j.at("summary").get_to(o.m_Summary); + j.at("warnings").get_to(o.m_Warnings); + +} + +std::string Rugnux_live_status::getState() const +{ + return m_State; +} +void Rugnux_live_status::setState(std::string const& value) +{ + m_State = value; +} +std::string Rugnux_live_status::getProbe() const +{ + return m_Probe; +} +void Rugnux_live_status::setProbe(std::string const& value) +{ + m_Probe = value; +} +double Rugnux_live_status::getProbeS() const +{ + return m_Probe_s; +} +void Rugnux_live_status::setProbeS(double const value) +{ + m_Probe_s = value; + m_Probe_sIsSet = true; +} +bool Rugnux_live_status::probeSIsSet() const +{ + return m_Probe_sIsSet; +} +void Rugnux_live_status::unsetProbe_s() +{ + m_Probe_sIsSet = false; +} +std::string Rugnux_live_status::getMessage() const +{ + return m_Message; +} +void Rugnux_live_status::setMessage(std::string const& value) +{ + m_Message = value; +} +int64_t Rugnux_live_status::getImagesExpected() const +{ + return m_Images_expected; +} +void Rugnux_live_status::setImagesExpected(int64_t const value) +{ + m_Images_expected = value; +} +int64_t Rugnux_live_status::getImagesReceived() const +{ + return m_Images_received; +} +void Rugnux_live_status::setImagesReceived(int64_t const value) +{ + m_Images_received = value; +} +double Rugnux_live_status::getElapsedS() const +{ + return m_Elapsed_s; +} +void Rugnux_live_status::setElapsedS(double const value) +{ + m_Elapsed_s = value; +} +float Rugnux_live_status::getStepProgress() const +{ + return m_Step_progress; +} +void Rugnux_live_status::setStepProgress(float const value) +{ + m_Step_progress = value; + m_Step_progressIsSet = true; +} +bool Rugnux_live_status::stepProgressIsSet() const +{ + return m_Step_progressIsSet; +} +void Rugnux_live_status::unsetStep_progress() +{ + m_Step_progressIsSet = false; +} +std::vector Rugnux_live_status::getSteps() const +{ + return m_Steps; +} +void Rugnux_live_status::setSteps(std::vector const& value) +{ + m_Steps = value; +} +double Rugnux_live_status::getLastImageS() const +{ + return m_Last_image_s; +} +void Rugnux_live_status::setLastImageS(double const value) +{ + m_Last_image_s = value; + m_Last_image_sIsSet = true; +} +bool Rugnux_live_status::lastImageSIsSet() const +{ + return m_Last_image_sIsSet; +} +void Rugnux_live_status::unsetLast_image_s() +{ + m_Last_image_sIsSet = false; +} +std::string Rugnux_live_status::getCut() const +{ + return m_Cut; +} +void Rugnux_live_status::setCut(std::string const& value) +{ + m_Cut = value; + m_CutIsSet = true; +} +bool Rugnux_live_status::cutIsSet() const +{ + return m_CutIsSet; +} +void Rugnux_live_status::unsetCut() +{ + m_CutIsSet = false; +} +double Rugnux_live_status::getCutS() const +{ + return m_Cut_s; +} +void Rugnux_live_status::setCutS(double const value) +{ + m_Cut_s = value; + m_Cut_sIsSet = true; +} +bool Rugnux_live_status::cutSIsSet() const +{ + return m_Cut_sIsSet; +} +void Rugnux_live_status::unsetCut_s() +{ + m_Cut_sIsSet = false; +} +double Rugnux_live_status::getLastImageToWrittenS() const +{ + return m_Last_image_to_written_s; +} +void Rugnux_live_status::setLastImageToWrittenS(double const value) +{ + m_Last_image_to_written_s = value; + m_Last_image_to_written_sIsSet = true; +} +bool Rugnux_live_status::lastImageToWrittenSIsSet() const +{ + return m_Last_image_to_written_sIsSet; +} +void Rugnux_live_status::unsetLast_image_to_written_s() +{ + m_Last_image_to_written_sIsSet = false; +} +std::string Rugnux_live_status::getVerdict() const +{ + return m_Verdict; +} +void Rugnux_live_status::setVerdict(std::string const& value) +{ + m_Verdict = value; +} +std::string Rugnux_live_status::getVerdictText() const +{ + return m_Verdict_text; +} +void Rugnux_live_status::setVerdictText(std::string const& value) +{ + m_Verdict_text = value; +} +std::vector Rugnux_live_status::getSummary() const +{ + return m_Summary; +} +void Rugnux_live_status::setSummary(std::vector const& value) +{ + m_Summary = value; +} +std::vector Rugnux_live_status::getWarnings() const +{ + return m_Warnings; +} +void Rugnux_live_status::setWarnings(std::vector const& value) +{ + m_Warnings = value; +} + + +} // namespace org::openapitools::server::model + diff --git a/broker/gen/model/Rugnux_live_status.h b/broker/gen/model/Rugnux_live_status.h new file mode 100644 index 000000000..d4b199469 --- /dev/null +++ b/broker/gen/model/Rugnux_live_status.h @@ -0,0 +1,204 @@ +/** +* Jungfraujoch +* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms. +* +* The version of the OpenAPI document: 1.0.0-rc.176 +* Contact: filip.leonarski@psi.ch +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Rugnux_live_status.h + * + * Live rugnux processing of the last collection; kept until the next collection starts + */ + +#ifndef Rugnux_live_status_H_ +#define Rugnux_live_status_H_ + + +#include "Rugnux_summary_row.h" +#include +#include "Rugnux_live_step.h" +#include +#include + +namespace org::openapitools::server::model +{ + +/// +/// Live rugnux processing of the last collection; kept until the next collection starts +/// +class Rugnux_live_status +{ +public: + Rugnux_live_status(); + virtual ~Rugnux_live_status() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const Rugnux_live_status& rhs) const; + bool operator!=(const Rugnux_live_status& rhs) const; + + ///////////////////////////////////////////// + /// Rugnux_live_status members + + /// + /// + /// + std::string getState() const; + void setState(std::string const& value); + /// + /// Answer of the early lattice probe on the first 60 degrees; empty until it answers + /// + std::string getProbe() const; + void setProbe(std::string const& value); + /// + /// When the probe answered, since the collection started + /// + double getProbeS() const; + void setProbeS(double const value); + bool probeSIsSet() const; + void unsetProbe_s(); + /// + /// Why the run failed or was skipped + /// + std::string getMessage() const; + void setMessage(std::string const& value); + /// + /// + /// + int64_t getImagesExpected() const; + void setImagesExpected(int64_t const value); + /// + /// + /// + int64_t getImagesReceived() const; + void setImagesReceived(int64_t const value); + /// + /// + /// + double getElapsedS() const; + void setElapsedS(double const value); + /// + /// Fraction of the current pass's images + /// + float getStepProgress() const; + void setStepProgress(float const value); + bool stepProgressIsSet() const; + void unsetStep_progress(); + /// + /// + /// + std::vector getSteps() const; + void setSteps(std::vector const& value); + /// + /// When the last image arrived (and the cutoff timer started), since the collection started + /// + double getLastImageS() const; + void setLastImageS(double const value); + bool lastImageSIsSet() const; + void unsetLast_image_s(); + /// + /// Empty, or why the analysis was cut: `deadline` (`deadline_s` after the last image) or `cancel` (`POST /cancel`). The end message then carried what was established at the cut. + /// + std::string getCut() const; + void setCut(std::string const& value); + bool cutIsSet() const; + void unsetCut(); + /// + /// When the analysis was cut, since the collection started + /// + double getCutS() const; + void setCutS(double const value); + bool cutSIsSet() const; + void unsetCut_s(); + /// + /// From the last image received to all results written + /// + double getLastImageToWrittenS() const; + void setLastImageToWrittenS(double const value); + bool lastImageToWrittenSIsSet() const; + void unsetLast_image_to_written_s(); + /// + /// OK, WARNINGS, UNUSABLE or FAILED; empty until the run is over + /// + std::string getVerdict() const; + void setVerdict(std::string const& value); + /// + /// + /// + std::string getVerdictText() const; + void setVerdictText(std::string const& value); + /// + /// + /// + std::vector getSummary() const; + void setSummary(std::vector const& value); + /// + /// + /// + std::vector getWarnings() const; + void setWarnings(std::vector const& value); + + friend void to_json(nlohmann::json& j, const Rugnux_live_status& o); + friend void from_json(const nlohmann::json& j, Rugnux_live_status& o); +protected: + std::string m_State; + + std::string m_Probe; + + double m_Probe_s; + bool m_Probe_sIsSet; + std::string m_Message; + + int64_t m_Images_expected; + + int64_t m_Images_received; + + double m_Elapsed_s; + + float m_Step_progress; + bool m_Step_progressIsSet; + std::vector m_Steps; + + double m_Last_image_s; + bool m_Last_image_sIsSet; + std::string m_Cut; + bool m_CutIsSet; + double m_Cut_s; + bool m_Cut_sIsSet; + double m_Last_image_to_written_s; + bool m_Last_image_to_written_sIsSet; + std::string m_Verdict; + + std::string m_Verdict_text; + + std::vector m_Summary; + + std::vector m_Warnings; + + +}; + +} // namespace org::openapitools::server::model + +#endif /* Rugnux_live_status_H_ */ diff --git a/broker/gen/model/Rugnux_live_step.cpp b/broker/gen/model/Rugnux_live_step.cpp new file mode 100644 index 000000000..adcf814e9 --- /dev/null +++ b/broker/gen/model/Rugnux_live_step.cpp @@ -0,0 +1,168 @@ +/** +* Jungfraujoch +* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms. +* +* The version of the OpenAPI document: 1.0.0-rc.176 +* Contact: filip.leonarski@psi.ch +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "Rugnux_live_step.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +Rugnux_live_step::Rugnux_live_step() +{ + m_Title = ""; + m_Started_s = 0.0; + m_Duration_s = 0.0; + m_Duration_sIsSet = false; + +} + +void Rugnux_live_step::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool Rugnux_live_step::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool Rugnux_live_step::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "Rugnux_live_step" : pathPrefix; + + + + /* Notes */ { + const std::vector& value = m_Notes; + const std::string currentValuePath = _pathPrefix + ".notes"; + + + { // Recursive validation of array elements + const std::string oldValuePath = currentValuePath; + int i = 0; + for (const std::string& value : value) + { + const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]"; + + + + i++; + } + } + + } + + return success; +} + +bool Rugnux_live_step::operator==(const Rugnux_live_step& rhs) const +{ + return + + + (getTitle() == rhs.getTitle()) + && + + (getStartedS() == rhs.getStartedS()) + && + + + ((!durationSIsSet() && !rhs.durationSIsSet()) || (durationSIsSet() && rhs.durationSIsSet() && getDurationS() == rhs.getDurationS())) && + + (getNotes() == rhs.getNotes()) + + + ; +} + +bool Rugnux_live_step::operator!=(const Rugnux_live_step& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const Rugnux_live_step& o) +{ + j = nlohmann::json::object(); + j["title"] = o.m_Title; + j["started_s"] = o.m_Started_s; + if(o.durationSIsSet()) + j["duration_s"] = o.m_Duration_s; + j["notes"] = o.m_Notes; + +} + +void from_json(const nlohmann::json& j, Rugnux_live_step& o) +{ + j.at("title").get_to(o.m_Title); + j.at("started_s").get_to(o.m_Started_s); + if(j.find("duration_s") != j.end()) + { + j.at("duration_s").get_to(o.m_Duration_s); + o.m_Duration_sIsSet = true; + } + j.at("notes").get_to(o.m_Notes); + +} + +std::string Rugnux_live_step::getTitle() const +{ + return m_Title; +} +void Rugnux_live_step::setTitle(std::string const& value) +{ + m_Title = value; +} +double Rugnux_live_step::getStartedS() const +{ + return m_Started_s; +} +void Rugnux_live_step::setStartedS(double const value) +{ + m_Started_s = value; +} +double Rugnux_live_step::getDurationS() const +{ + return m_Duration_s; +} +void Rugnux_live_step::setDurationS(double const value) +{ + m_Duration_s = value; + m_Duration_sIsSet = true; +} +bool Rugnux_live_step::durationSIsSet() const +{ + return m_Duration_sIsSet; +} +void Rugnux_live_step::unsetDuration_s() +{ + m_Duration_sIsSet = false; +} +std::vector Rugnux_live_step::getNotes() const +{ + return m_Notes; +} +void Rugnux_live_step::setNotes(std::vector const& value) +{ + m_Notes = value; +} + + +} // namespace org::openapitools::server::model + diff --git a/broker/gen/model/Rugnux_live_step.h b/broker/gen/model/Rugnux_live_step.h new file mode 100644 index 000000000..620411c0d --- /dev/null +++ b/broker/gen/model/Rugnux_live_step.h @@ -0,0 +1,101 @@ +/** +* Jungfraujoch +* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms. +* +* The version of the OpenAPI document: 1.0.0-rc.176 +* Contact: filip.leonarski@psi.ch +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Rugnux_live_step.h + * + * + */ + +#ifndef Rugnux_live_step_H_ +#define Rugnux_live_step_H_ + + +#include +#include +#include + +namespace org::openapitools::server::model +{ + +/// +/// +/// +class Rugnux_live_step +{ +public: + Rugnux_live_step(); + virtual ~Rugnux_live_step() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const Rugnux_live_step& rhs) const; + bool operator!=(const Rugnux_live_step& rhs) const; + + ///////////////////////////////////////////// + /// Rugnux_live_step members + + /// + /// + /// + std::string getTitle() const; + void setTitle(std::string const& value); + /// + /// Start of the step, since the collection started + /// + double getStartedS() const; + void setStartedS(double const value); + /// + /// Set once the next step starts or the run ends + /// + double getDurationS() const; + void setDurationS(double const value); + bool durationSIsSet() const; + void unsetDuration_s(); + /// + /// What the step found (e.g. lattice, space group) + /// + std::vector getNotes() const; + void setNotes(std::vector const& value); + + friend void to_json(nlohmann::json& j, const Rugnux_live_step& o); + friend void from_json(const nlohmann::json& j, Rugnux_live_step& o); +protected: + std::string m_Title; + + double m_Started_s; + + double m_Duration_s; + bool m_Duration_sIsSet; + std::vector m_Notes; + + +}; + +} // namespace org::openapitools::server::model + +#endif /* Rugnux_live_step_H_ */ diff --git a/broker/gen/model/Rugnux_settings.cpp b/broker/gen/model/Rugnux_settings.cpp new file mode 100644 index 000000000..2c710e6dc --- /dev/null +++ b/broker/gen/model/Rugnux_settings.cpp @@ -0,0 +1,192 @@ +/** +* Jungfraujoch +* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms. +* +* The version of the OpenAPI document: 1.0.0-rc.176 +* Contact: filip.leonarski@psi.ch +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "Rugnux_settings.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +Rugnux_settings::Rugnux_settings() +{ + m_Enable = false; + m_EnableIsSet = false; + m_Reserved_cpus = 4L; + m_Reserved_cpusIsSet = false; + m_Deadline_s = 0.0; + m_Deadline_sIsSet = false; + +} + +void Rugnux_settings::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool Rugnux_settings::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool Rugnux_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "Rugnux_settings" : pathPrefix; + + + if (reservedCpusIsSet()) + { + const int64_t& value = m_Reserved_cpus; + const std::string currentValuePath = _pathPrefix + ".reservedCpus"; + + + if (value < 0ll) + { + success = false; + msg << currentValuePath << ": must be greater than or equal to 0;"; + } + + } + + if (deadlineSIsSet()) + { + const double& value = m_Deadline_s; + const std::string currentValuePath = _pathPrefix + ".deadlineS"; + + + if (value < 0.0) + { + success = false; + msg << currentValuePath << ": must be greater than or equal to 0.0;"; + } + + } + + return success; +} + +bool Rugnux_settings::operator==(const Rugnux_settings& rhs) const +{ + return + + + + ((!enableIsSet() && !rhs.enableIsSet()) || (enableIsSet() && rhs.enableIsSet() && isEnable() == rhs.isEnable())) && + + + ((!reservedCpusIsSet() && !rhs.reservedCpusIsSet()) || (reservedCpusIsSet() && rhs.reservedCpusIsSet() && getReservedCpus() == rhs.getReservedCpus())) && + + + ((!deadlineSIsSet() && !rhs.deadlineSIsSet()) || (deadlineSIsSet() && rhs.deadlineSIsSet() && getDeadlineS() == rhs.getDeadlineS())) + + ; +} + +bool Rugnux_settings::operator!=(const Rugnux_settings& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const Rugnux_settings& o) +{ + j = nlohmann::json::object(); + if(o.enableIsSet()) + j["enable"] = o.m_Enable; + if(o.reservedCpusIsSet()) + j["reserved_cpus"] = o.m_Reserved_cpus; + if(o.deadlineSIsSet()) + j["deadline_s"] = o.m_Deadline_s; + +} + +void from_json(const nlohmann::json& j, Rugnux_settings& o) +{ + if(j.find("enable") != j.end()) + { + j.at("enable").get_to(o.m_Enable); + o.m_EnableIsSet = true; + } + if(j.find("reserved_cpus") != j.end()) + { + j.at("reserved_cpus").get_to(o.m_Reserved_cpus); + o.m_Reserved_cpusIsSet = true; + } + if(j.find("deadline_s") != j.end()) + { + j.at("deadline_s").get_to(o.m_Deadline_s); + o.m_Deadline_sIsSet = true; + } + +} + +bool Rugnux_settings::isEnable() const +{ + return m_Enable; +} +void Rugnux_settings::setEnable(bool const value) +{ + m_Enable = value; + m_EnableIsSet = true; +} +bool Rugnux_settings::enableIsSet() const +{ + return m_EnableIsSet; +} +void Rugnux_settings::unsetEnable() +{ + m_EnableIsSet = false; +} +int64_t Rugnux_settings::getReservedCpus() const +{ + return m_Reserved_cpus; +} +void Rugnux_settings::setReservedCpus(int64_t const value) +{ + m_Reserved_cpus = value; + m_Reserved_cpusIsSet = true; +} +bool Rugnux_settings::reservedCpusIsSet() const +{ + return m_Reserved_cpusIsSet; +} +void Rugnux_settings::unsetReserved_cpus() +{ + m_Reserved_cpusIsSet = false; +} +double Rugnux_settings::getDeadlineS() const +{ + return m_Deadline_s; +} +void Rugnux_settings::setDeadlineS(double const value) +{ + m_Deadline_s = value; + m_Deadline_sIsSet = true; +} +bool Rugnux_settings::deadlineSIsSet() const +{ + return m_Deadline_sIsSet; +} +void Rugnux_settings::unsetDeadline_s() +{ + m_Deadline_sIsSet = false; +} + + +} // namespace org::openapitools::server::model + diff --git a/broker/gen/model/Rugnux_settings.h b/broker/gen/model/Rugnux_settings.h new file mode 100644 index 000000000..d8aafa5b0 --- /dev/null +++ b/broker/gen/model/Rugnux_settings.h @@ -0,0 +1,96 @@ +/** +* Jungfraujoch +* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms. +* +* The version of the OpenAPI document: 1.0.0-rc.176 +* Contact: filip.leonarski@psi.ch +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Rugnux_settings.h + * + * Rugnux live mode: rotation collections from a DECTRIS detector are processed by rugnux inside the broker while they arrive, and the merged result is sent to the writer. + */ + +#ifndef Rugnux_settings_H_ +#define Rugnux_settings_H_ + + +#include + +namespace org::openapitools::server::model +{ + +/// +/// Rugnux live mode: rotation collections from a DECTRIS detector are processed by rugnux inside the broker while they arrive, and the merged result is sent to the writer. +/// +class Rugnux_settings +{ +public: + Rugnux_settings(); + virtual ~Rugnux_settings() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const Rugnux_settings& rhs) const; + bool operator!=(const Rugnux_settings& rhs) const; + + ///////////////////////////////////////////// + /// Rugnux_settings members + + /// + /// Process DECTRIS rotation collections with rugnux live + /// + bool isEnable() const; + void setEnable(bool const value); + bool enableIsSet() const; + void unsetEnable(); + /// + /// CPU threads left to the receiver and the image pusher while rugnux runs + /// + int64_t getReservedCpus() const; + void setReservedCpus(int64_t const value); + bool reservedCpusIsSet() const; + void unsetReserved_cpus(); + /// + /// Fixed cutoff: this long after the last image the analysis is cut, and the collection ends with what it has established (as `POST /cancel` after the last image does). 0 means no cutoff. + /// + double getDeadlineS() const; + void setDeadlineS(double const value); + bool deadlineSIsSet() const; + void unsetDeadline_s(); + + friend void to_json(nlohmann::json& j, const Rugnux_settings& o); + friend void from_json(const nlohmann::json& j, Rugnux_settings& o); +protected: + bool m_Enable; + bool m_EnableIsSet; + int64_t m_Reserved_cpus; + bool m_Reserved_cpusIsSet; + double m_Deadline_s; + bool m_Deadline_sIsSet; + +}; + +} // namespace org::openapitools::server::model + +#endif /* Rugnux_settings_H_ */ diff --git a/broker/gen/model/Rugnux_status.cpp b/broker/gen/model/Rugnux_status.cpp new file mode 100644 index 000000000..63a02e682 --- /dev/null +++ b/broker/gen/model/Rugnux_status.cpp @@ -0,0 +1,177 @@ +/** +* Jungfraujoch +* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms. +* +* The version of the OpenAPI document: 1.0.0-rc.176 +* Contact: filip.leonarski@psi.ch +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "Rugnux_status.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +Rugnux_status::Rugnux_status() +{ + m_Enable = false; + m_Reserved_cpus = 0L; + m_Deadline_s = 0.0; + m_Deadline_sIsSet = false; + m_Model_loaded = false; + m_Model_size_bytes = 0L; + m_Model_size_bytesIsSet = false; + +} + +void Rugnux_status::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool Rugnux_status::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool Rugnux_status::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "Rugnux_status" : pathPrefix; + + + return success; +} + +bool Rugnux_status::operator==(const Rugnux_status& rhs) const +{ + return + + + (isEnable() == rhs.isEnable()) + && + + (getReservedCpus() == rhs.getReservedCpus()) + && + + + ((!deadlineSIsSet() && !rhs.deadlineSIsSet()) || (deadlineSIsSet() && rhs.deadlineSIsSet() && getDeadlineS() == rhs.getDeadlineS())) && + + (isModelLoaded() == rhs.isModelLoaded()) + && + + + ((!modelSizeBytesIsSet() && !rhs.modelSizeBytesIsSet()) || (modelSizeBytesIsSet() && rhs.modelSizeBytesIsSet() && getModelSizeBytes() == rhs.getModelSizeBytes())) + + ; +} + +bool Rugnux_status::operator!=(const Rugnux_status& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const Rugnux_status& o) +{ + j = nlohmann::json::object(); + j["enable"] = o.m_Enable; + j["reserved_cpus"] = o.m_Reserved_cpus; + if(o.deadlineSIsSet()) + j["deadline_s"] = o.m_Deadline_s; + j["model_loaded"] = o.m_Model_loaded; + if(o.modelSizeBytesIsSet()) + j["model_size_bytes"] = o.m_Model_size_bytes; + +} + +void from_json(const nlohmann::json& j, Rugnux_status& o) +{ + j.at("enable").get_to(o.m_Enable); + j.at("reserved_cpus").get_to(o.m_Reserved_cpus); + if(j.find("deadline_s") != j.end()) + { + j.at("deadline_s").get_to(o.m_Deadline_s); + o.m_Deadline_sIsSet = true; + } + j.at("model_loaded").get_to(o.m_Model_loaded); + if(j.find("model_size_bytes") != j.end()) + { + j.at("model_size_bytes").get_to(o.m_Model_size_bytes); + o.m_Model_size_bytesIsSet = true; + } + +} + +bool Rugnux_status::isEnable() const +{ + return m_Enable; +} +void Rugnux_status::setEnable(bool const value) +{ + m_Enable = value; +} +int64_t Rugnux_status::getReservedCpus() const +{ + return m_Reserved_cpus; +} +void Rugnux_status::setReservedCpus(int64_t const value) +{ + m_Reserved_cpus = value; +} +double Rugnux_status::getDeadlineS() const +{ + return m_Deadline_s; +} +void Rugnux_status::setDeadlineS(double const value) +{ + m_Deadline_s = value; + m_Deadline_sIsSet = true; +} +bool Rugnux_status::deadlineSIsSet() const +{ + return m_Deadline_sIsSet; +} +void Rugnux_status::unsetDeadline_s() +{ + m_Deadline_sIsSet = false; +} +bool Rugnux_status::isModelLoaded() const +{ + return m_Model_loaded; +} +void Rugnux_status::setModelLoaded(bool const value) +{ + m_Model_loaded = value; +} +int64_t Rugnux_status::getModelSizeBytes() const +{ + return m_Model_size_bytes; +} +void Rugnux_status::setModelSizeBytes(int64_t const value) +{ + m_Model_size_bytes = value; + m_Model_size_bytesIsSet = true; +} +bool Rugnux_status::modelSizeBytesIsSet() const +{ + return m_Model_size_bytesIsSet; +} +void Rugnux_status::unsetModel_size_bytes() +{ + m_Model_size_bytesIsSet = false; +} + + +} // namespace org::openapitools::server::model + diff --git a/broker/gen/model/Rugnux_status.h b/broker/gen/model/Rugnux_status.h new file mode 100644 index 000000000..84405ff40 --- /dev/null +++ b/broker/gen/model/Rugnux_status.h @@ -0,0 +1,108 @@ +/** +* Jungfraujoch +* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms. +* +* The version of the OpenAPI document: 1.0.0-rc.176 +* Contact: filip.leonarski@psi.ch +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Rugnux_status.h + * + * + */ + +#ifndef Rugnux_status_H_ +#define Rugnux_status_H_ + + +#include + +namespace org::openapitools::server::model +{ + +/// +/// +/// +class Rugnux_status +{ +public: + Rugnux_status(); + virtual ~Rugnux_status() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const Rugnux_status& rhs) const; + bool operator!=(const Rugnux_status& rhs) const; + + ///////////////////////////////////////////// + /// Rugnux_status members + + /// + /// Rugnux live mode is enabled + /// + bool isEnable() const; + void setEnable(bool const value); + /// + /// CPU threads left to the receiver and the image pusher while rugnux runs + /// + int64_t getReservedCpus() const; + void setReservedCpus(int64_t const value); + /// + /// Seconds after the last image at which the analysis is cut; 0 means no cutoff + /// + double getDeadlineS() const; + void setDeadlineS(double const value); + bool deadlineSIsSet() const; + void unsetDeadline_s(); + /// + /// A model was uploaded with `PUT /config/rugnux/model` + /// + bool isModelLoaded() const; + void setModelLoaded(bool const value); + /// + /// Size of the uploaded model file + /// + int64_t getModelSizeBytes() const; + void setModelSizeBytes(int64_t const value); + bool modelSizeBytesIsSet() const; + void unsetModel_size_bytes(); + + friend void to_json(nlohmann::json& j, const Rugnux_status& o); + friend void from_json(const nlohmann::json& j, Rugnux_status& o); +protected: + bool m_Enable; + + int64_t m_Reserved_cpus; + + double m_Deadline_s; + bool m_Deadline_sIsSet; + bool m_Model_loaded; + + int64_t m_Model_size_bytes; + bool m_Model_size_bytesIsSet; + +}; + +} // namespace org::openapitools::server::model + +#endif /* Rugnux_status_H_ */ diff --git a/broker/gen/model/Rugnux_summary_row.cpp b/broker/gen/model/Rugnux_summary_row.cpp new file mode 100644 index 000000000..fb14209e2 --- /dev/null +++ b/broker/gen/model/Rugnux_summary_row.cpp @@ -0,0 +1,105 @@ +/** +* Jungfraujoch +* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms. +* +* The version of the OpenAPI document: 1.0.0-rc.176 +* Contact: filip.leonarski@psi.ch +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "Rugnux_summary_row.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +Rugnux_summary_row::Rugnux_summary_row() +{ + m_Label = ""; + m_Value = ""; + +} + +void Rugnux_summary_row::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool Rugnux_summary_row::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool Rugnux_summary_row::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "Rugnux_summary_row" : pathPrefix; + + + return success; +} + +bool Rugnux_summary_row::operator==(const Rugnux_summary_row& rhs) const +{ + return + + + (getLabel() == rhs.getLabel()) + && + + (getValue() == rhs.getValue()) + + + ; +} + +bool Rugnux_summary_row::operator!=(const Rugnux_summary_row& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const Rugnux_summary_row& o) +{ + j = nlohmann::json::object(); + j["label"] = o.m_Label; + j["value"] = o.m_Value; + +} + +void from_json(const nlohmann::json& j, Rugnux_summary_row& o) +{ + j.at("label").get_to(o.m_Label); + j.at("value").get_to(o.m_Value); + +} + +std::string Rugnux_summary_row::getLabel() const +{ + return m_Label; +} +void Rugnux_summary_row::setLabel(std::string const& value) +{ + m_Label = value; +} +std::string Rugnux_summary_row::getValue() const +{ + return m_Value; +} +void Rugnux_summary_row::setValue(std::string const& value) +{ + m_Value = value; +} + + +} // namespace org::openapitools::server::model + diff --git a/broker/gen/model/Rugnux_summary_row.h b/broker/gen/model/Rugnux_summary_row.h new file mode 100644 index 000000000..2dde1bd71 --- /dev/null +++ b/broker/gen/model/Rugnux_summary_row.h @@ -0,0 +1,84 @@ +/** +* Jungfraujoch +* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms. +* +* The version of the OpenAPI document: 1.0.0-rc.176 +* Contact: filip.leonarski@psi.ch +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Rugnux_summary_row.h + * + * + */ + +#ifndef Rugnux_summary_row_H_ +#define Rugnux_summary_row_H_ + + +#include +#include + +namespace org::openapitools::server::model +{ + +/// +/// +/// +class Rugnux_summary_row +{ +public: + Rugnux_summary_row(); + virtual ~Rugnux_summary_row() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const Rugnux_summary_row& rhs) const; + bool operator!=(const Rugnux_summary_row& rhs) const; + + ///////////////////////////////////////////// + /// Rugnux_summary_row members + + /// + /// + /// + std::string getLabel() const; + void setLabel(std::string const& value); + /// + /// + /// + std::string getValue() const; + void setValue(std::string const& value); + + friend void to_json(nlohmann::json& j, const Rugnux_summary_row& o); + friend void from_json(const nlohmann::json& j, Rugnux_summary_row& o); +protected: + std::string m_Label; + + std::string m_Value; + + +}; + +} // namespace org::openapitools::server::model + +#endif /* Rugnux_summary_row_H_ */ diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 0041d5097..59ccbf326 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -2684,6 +2684,167 @@ components: $ref: '#/components/schemas/zeromq_metadata_settings' dark_mask: $ref: '#/components/schemas/dark_mask_settings' + rugnux: + $ref: '#/components/schemas/rugnux_settings' + rugnux_settings: + type: object + description: | + Rugnux live mode: rotation collections from a DECTRIS detector are processed by rugnux + inside the broker while they arrive, and the merged result is sent to the writer. + properties: + enable: + type: boolean + default: false + description: Process DECTRIS rotation collections with rugnux live + reserved_cpus: + type: integer + format: int64 + minimum: 0 + default: 4 + description: CPU threads left to the receiver and the image pusher while rugnux runs + deadline_s: + type: number + format: double + minimum: 0.0 + default: 0.0 + description: | + Fixed cutoff: this long after the last image the analysis is cut, and the collection ends + with what it has established (as `POST /cancel` after the last image does). 0 means no cutoff. + rugnux_status: + type: object + required: + - enable + - reserved_cpus + - model_loaded + properties: + enable: + type: boolean + description: Rugnux live mode is enabled + reserved_cpus: + type: integer + format: int64 + description: CPU threads left to the receiver and the image pusher while rugnux runs + deadline_s: + type: number + format: double + description: Seconds after the last image at which the analysis is cut; 0 means no cutoff + model_loaded: + type: boolean + description: A model was uploaded with `PUT /config/rugnux/model` + model_size_bytes: + type: integer + format: int64 + description: Size of the uploaded model file + rugnux_live_step: + type: object + required: + - title + - started_s + - notes + properties: + title: + type: string + started_s: + type: number + format: double + description: Start of the step, since the collection started + duration_s: + type: number + format: double + description: Set once the next step starts or the run ends + notes: + type: array + description: What the step found (e.g. lattice, space group) + items: + type: string + rugnux_summary_row: + type: object + required: + - label + - value + properties: + label: + type: string + value: + type: string + rugnux_live_status: + type: object + description: Live rugnux processing of the last collection; kept until the next collection starts + required: + - state + - message + - images_expected + - images_received + - elapsed_s + - steps + - verdict + - verdict_text + - summary + - warnings + - probe + properties: + state: + type: string + enum: [Idle, Running, Done, Failed, Cancelled, Skipped] + probe: + type: string + description: Answer of the early lattice probe on the first 60 degrees; empty until it answers + probe_s: + type: number + format: double + description: When the probe answered, since the collection started + message: + type: string + description: Why the run failed or was skipped + images_expected: + type: integer + format: int64 + images_received: + type: integer + format: int64 + elapsed_s: + type: number + format: double + step_progress: + type: number + format: float + minimum: 0.0 + maximum: 1.0 + description: Fraction of the current pass's images + steps: + type: array + items: + $ref: '#/components/schemas/rugnux_live_step' + last_image_s: + type: number + format: double + description: When the last image arrived (and the cutoff timer started), since the collection started + cut: + type: string + description: | + Empty, or why the analysis was cut: `deadline` (`deadline_s` after the last image) or `cancel` + (`POST /cancel`). The end message then carried what was established at the cut. + cut_s: + type: number + format: double + description: When the analysis was cut, since the collection started + last_image_to_written_s: + type: number + format: double + description: From the last image received to all results written + verdict: + type: string + description: OK, WARNINGS, UNUSABLE or FAILED; empty until the run is over + verdict_text: + type: string + summary: + type: array + items: + $ref: '#/components/schemas/rugnux_summary_row' + warnings: + type: array + items: + type: string zeromq_metadata_settings: type: object required: @@ -2895,6 +3056,11 @@ paths: Any frame that is currently being processed by CPU will be finished and sent to writer. Given the command is making sure to gracefully stop data acquisition and detector, it might take some time to switch back after command finished to `Idle` state. + With rugnux live mode (`/config/rugnux`) the command also cuts the rugnux analysis, during the collection + or after its last image alike: the collection ends with what the analysis has established + (see `cut` in `/rugnux/status`). After the last image the collection itself is complete and is not + marked as cancelled. + If data collection is not running, the command has no effect. responses: "200": @@ -3331,6 +3497,133 @@ paths: application/json: schema: $ref: '#/components/schemas/detector_list' + /config/rugnux: + put: + summary: Change rugnux live mode settings + description: | + This can only be done when detector is `Idle`, `Error` or `Inactive` states. + security: + - bearerAuth: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/rugnux_settings' + responses: + "401": + description: The current dataset is protected and no valid bearer token was presented. + content: + text/plain: + schema: + type: string + "200": + description: Everything OK + "400": + description: Input parsing or validation error + content: + text/plain: + schema: + type: string + description: Exception error + "500": + description: Error within Jungfraujoch code - see output message. + content: + application/json: + schema: + $ref: '#/components/schemas/error_message' + get: + summary: Get rugnux live mode settings and model status + description: Can be done anytime + security: + - bearerAuth: [] + responses: + "401": + description: The current dataset is protected and no valid bearer token was presented. + content: + text/plain: + schema: + type: string + "200": + description: Everything OK + content: + application/json: + schema: + $ref: '#/components/schemas/rugnux_status' + /config/rugnux/model: + put: + summary: Upload the model used by rugnux live mode + description: | + This can only be done when detector is `Idle`, `Error` or `Inactive` states. + The model (PDB or mmCIF, optionally gzipped; at most 64 MiB) is used for molecular replacement + and validation of every following rugnux live collection, until it is removed with + `DELETE /config/rugnux/model` or replaced by another upload. + security: + - bearerAuth: [] + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + responses: + "401": + description: The current dataset is protected and no valid bearer token was presented. + content: + text/plain: + schema: + type: string + "200": + description: All good + "400": + description: Empty body, or not a model that can be read (PDB or mmCIF, optionally gzipped) + "413": + description: Model larger than 64 MiB + "500": + description: Error within Jungfraujoch code - see output message. + content: + application/json: + schema: + $ref: '#/components/schemas/error_message' + delete: + summary: Remove the model used by rugnux live mode + description: | + This can only be done when detector is `Idle`, `Error` or `Inactive` states. + security: + - bearerAuth: [] + responses: + "401": + description: The current dataset is protected and no valid bearer token was presented. + content: + text/plain: + schema: + type: string + "200": + description: All good + "500": + description: Error within Jungfraujoch code - see output message. + content: + application/json: + schema: + $ref: '#/components/schemas/error_message' + /rugnux/status: + get: + summary: Get live rugnux processing status of the last collection + description: Can be done anytime + security: + - bearerAuth: [] + responses: + "401": + description: The current dataset is protected and no valid bearer token was presented. + content: + text/plain: + schema: + type: string + "200": + description: Everything OK + content: + application/json: + schema: + $ref: '#/components/schemas/rugnux_live_status' /config/zeromq_preview: put: summary: Set ZeroMQ preview settings diff --git a/broker/jfjoch_broker.cpp b/broker/jfjoch_broker.cpp index 7457e5a3f..d26812935 100644 --- a/broker/jfjoch_broker.cpp +++ b/broker/jfjoch_broker.cpp @@ -116,6 +116,7 @@ int main(int argc, char **argv) { if (receiver) broker.Services().Receiver(receiver.get()); + ParseRugnuxSettings(settings, broker.Services()); httplib::Server server; httpServer = &server; diff --git a/broker/redoc-static.html b/broker/redoc-static.html index 8d7d26a87..d0feb243c 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -333,7 +333,8 @@ data-styled.g113[id="sc-EgOXT"]{content:"cFEcOl,"}/*!sc*/ .fPdOXD{font-size:0.929em;line-height:20px;background-color:#186FAF;color:#ffffff;padding:3px 10px;text-transform:uppercase;font-family:Montserrat,sans-serif;margin:0;}/*!sc*/ .cnqpVw{font-size:0.929em;line-height:20px;background-color:#95507c;color:#ffffff;padding:3px 10px;text-transform:uppercase;font-family:Montserrat,sans-serif;margin:0;}/*!sc*/ .qGfV{font-size:0.929em;line-height:20px;background-color:#2F8132;color:#ffffff;padding:3px 10px;text-transform:uppercase;font-family:Montserrat,sans-serif;margin:0;}/*!sc*/ -data-styled.g114[id="sc-eZYNyq"]{content:"fPdOXD,cnqpVw,qGfV,"}/*!sc*/ +.guGttd{font-size:0.929em;line-height:20px;background-color:#cc3333;color:#ffffff;padding:3px 10px;text-transform:uppercase;font-family:Montserrat,sans-serif;margin:0;}/*!sc*/ +data-styled.g114[id="sc-eZYNyq"]{content:"fPdOXD,cnqpVw,qGfV,guGttd,"}/*!sc*/ .kWacYr{position:absolute;width:100%;z-index:100;background:#fafafa;color:#263238;box-sizing:border-box;box-shadow:0 0 6px rgba(0,0,0,0.33);overflow:hidden;border-bottom-left-radius:4px;border-bottom-right-radius:4px;-webkit-transition:all 0.25s ease;transition:all 0.25s ease;visibility:hidden;-webkit-transform:translateY(-50%) scaleY(0);-ms-transform:translateY(-50%) scaleY(0);transform:translateY(-50%) scaleY(0);}/*!sc*/ data-styled.g115[id="sc-dlWCHZ"]{content:"kWacYr,"}/*!sc*/ .cndTNO{padding:10px;}/*!sc*/ @@ -393,7 +394,7 @@ data-styled.g138[id="sc-dxcDKg"]{content:"eajCCh,"}/*!sc*/ -

Cancel running data collection

Command will inform FPGA network card to stop pedestal or data collection at the current stage. Any frame that is currently being processed by CPU will be finished and sent to writer. Given the command is making sure to gracefully stop data acquisition and detector, it might take some time to switch back after command finished to Idle state.

+

With rugnux live mode (/config/rugnux) the command also cuts the rugnux analysis, during the collection +or after its last image alike: the collection ends with what the analysis has established +(see cut in /rugnux/status). After the last image the collection itself is complete and is not +marked as cancelled.

If data collection is not running, the command has no effect.

Responses

Request samples

Content type
application/json
{
  • "id": 1
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

List available detectors

Configured detectors that can be selected by used

Responses

Response samples

Content type
application/json
{
  • "detectors": [
    ],
  • "current_id": 0
}

Set ZeroMQ preview settings

Jungfraujoch can generate preview message stream on ZeroMQ SUB socket. +

http://localhost:5232/config/select_detector

Response samples

Content type
application/json
{
  • "detectors": [
    ],
  • "current_id": 0
}

Change rugnux live mode settings

This can only be done when detector is Idle, Error or Inactive states.

+
Authorizations:
bearerAuth
Request Body schema: application/json
enable
boolean
Default: false

Process DECTRIS rotation collections with rugnux live

+
reserved_cpus
integer <int64> >= 0
Default: 4

CPU threads left to the receiver and the image pusher while rugnux runs

+
deadline_s
number <double> >= 0
Default: 0

Fixed cutoff: this long after the last image the analysis is cut, and the collection ends +with what it has established (as POST /cancel after the last image does). 0 means no cutoff.

+

Responses

Request samples

Content type
application/json
{
  • "enable": false,
  • "reserved_cpus": 4,
  • "deadline_s": 0
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get rugnux live mode settings and model status

Can be done anytime

+
Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "enable": true,
  • "reserved_cpus": 0,
  • "deadline_s": 0.1,
  • "model_loaded": true,
  • "model_size_bytes": 0
}

Upload the model used by rugnux live mode

This can only be done when detector is Idle, Error or Inactive states. +The model (PDB or mmCIF, optionally gzipped; at most 64 MiB) is used for molecular replacement +and validation of every following rugnux live collection, until it is removed with +DELETE /config/rugnux/model or replaced by another upload.

+
Authorizations:
bearerAuth
Request Body schema: application/octet-stream
string <binary>

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Remove the model used by rugnux live mode

This can only be done when detector is Idle, Error or Inactive states.

+
Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get live rugnux processing status of the last collection

Can be done anytime

+
Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "state": "Idle",
  • "probe": "string",
  • "probe_s": 0.1,
  • "message": "string",
  • "images_expected": 0,
  • "images_received": 0,
  • "elapsed_s": 0.1,
  • "step_progress": 1,
  • "steps": [
    ],
  • "last_image_s": 0.1,
  • "cut": "string",
  • "cut_s": 0.1,
  • "last_image_to_written_s": 0.1,
  • "verdict": "string",
  • "verdict_text": "string",
  • "summary": [
    ],
  • "warnings": [
    ]
}

Set ZeroMQ preview settings

Jungfraujoch can generate preview message stream on ZeroMQ SUB socket. Here settings of the socket can be adjusted. While the data structure contains also socket_address, this cannot be changed via HTTP and is ignore in PUT request. Options set with this PUT request have no effect on HTTP based preview.

@@ -844,9 +882,9 @@ Address follows ZeroMQ convention for sockets - in practice ipc://

Request samples

Content type
application/json
{
  • "enabled": true,
  • "period_ms": 1000,
  • "socket_address": "string"
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get ZeroMQ preview settings

Responses

Request samples

Content type
application/json
{
  • "enabled": true,
  • "period_ms": 1000,
  • "socket_address": "string"
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get ZeroMQ preview settings

Responses

Response samples

Content type
application/json
{
  • "enabled": true,
  • "period_ms": 1000,
  • "socket_address": "string"
}

Set ZeroMQ metadata settings

Jungfraujoch can generate metadata message stream on ZeroMQ PUB socket. This stream covers all images. +

http://localhost:5232/config/zeromq_preview

Response samples

Content type
application/json
{
  • "enabled": true,
  • "period_ms": 1000,
  • "socket_address": "string"
}

Set ZeroMQ metadata settings

Jungfraujoch can generate metadata message stream on ZeroMQ PUB socket. This stream covers all images. Here settings of the socket can be adjusted. While the data structure contains also socket_address, this cannot be changed via HTTP and is ignore in PUT request.

Request Body schema: application/json
enabled
required
boolean
Default: true

ZeroMQ metadata socket is enabled.

@@ -859,9 +897,9 @@ Address follows ZeroMQ convention for sockets - in practice ipc://

Request samples

Content type
application/json
{
  • "enabled": true,
  • "period_ms": 1000,
  • "socket_address": "string"
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get ZeroMQ metadata socket settings

Responses

Request samples

Content type
application/json
{
  • "enabled": true,
  • "period_ms": 1000,
  • "socket_address": "string"
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get ZeroMQ metadata socket settings

Responses

Response samples

Content type
application/json
{
  • "enabled": true,
  • "period_ms": 1000,
  • "socket_address": "string"
}

Set configuration for dark data collection to calculate mask

This is only possible when operating DECTRIS detectors at the moment; it will be also available for PSI EIGER at some point. +

http://localhost:5232/config/zeromq_metadata

Response samples

Content type
application/json
{
  • "enabled": true,
  • "period_ms": 1000,
  • "socket_address": "string"
}

Set configuration for dark data collection to calculate mask

This is only possible when operating DECTRIS detectors at the moment; it will be also available for PSI EIGER at some point. This can only be done when detector is Idle, Error or Inactive states.

Request Body schema: application/json
detector_threshold_keV
required
number <float> [ 2.5 .. 100 ]
Default: 3.5

Energy threshold for dark image collection

frame_time_us
required
integer <int64> [ 500 .. 100000 ]
Default: 10000

Time between frames for dark image collection

@@ -872,51 +910,51 @@ This can only be done when detector is Idle, Error or

Request samples

Content type
application/json
{
  • "detector_threshold_keV": 3.5,
  • "frame_time_us": 10000,
  • "number_of_frames": 1000,
  • "max_allowed_pixel_count": 1,
  • "max_frames_with_signal": 10
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get settings for dark data collection to calculate mask

Responses

Request samples

Content type
application/json
{
  • "detector_threshold_keV": 3.5,
  • "frame_time_us": 10000,
  • "number_of_frames": 1000,
  • "max_allowed_pixel_count": 1,
  • "max_frames_with_signal": 10
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get settings for dark data collection to calculate mask

Responses

Response samples

Content type
application/json
{
  • "detector_threshold_keV": 3.5,
  • "frame_time_us": 10000,
  • "number_of_frames": 1000,
  • "max_allowed_pixel_count": 1,
  • "max_frames_with_signal": 10
}

Get Jungfraujoch status

Status of the data acquisition

+
http://localhost:5232/config/dark_mask

Response samples

Content type
application/json
{
  • "detector_threshold_keV": 3.5,
  • "frame_time_us": 10000,
  • "number_of_frames": 1000,
  • "max_allowed_pixel_count": 1,
  • "max_frames_with_signal": 10
}

Get Jungfraujoch status

Status of the data acquisition

Responses

Response samples

Content type
application/json
{
  • "state": "Inactive",
  • "progress": 1,
  • "message": "string",
  • "message_severity": "success",
  • "gpu_count": 0,
  • "broker_version": "1.0.0-rc.128"
}

Get status of FPGA devices

Responses

Response samples

Content type
application/json
{
  • "state": "Inactive",
  • "progress": 1,
  • "message": "string",
  • "message_severity": "success",
  • "gpu_count": 0,
  • "broker_version": "1.0.0-rc.128"
}

Get status of FPGA devices

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Return XFEL pulse IDs for the current data acquisition

Return array of XFEL pulse IDs - (-1) if image not recorded

+
http://localhost:5232/fpga_status

Response samples

Content type
application/json
[
  • {
    }
]

Return XFEL pulse IDs for the current data acquisition

Return array of XFEL pulse IDs - (-1) if image not recorded

Responses

Response samples

Content type
application/json
[
  • 0
]

Return XFEL event codes for the current data acquisition

Return array of XFEL event codes

+
http://localhost:5232/xfel/pulse_id

Response samples

Content type
application/json
[
  • 0
]

Return XFEL event codes for the current data acquisition

Return array of XFEL event codes

Responses

Response samples

Content type
application/json
[
  • 0
]

Get status of image pusher

Responses

Response samples

Content type
application/json
[
  • 0
]

Get status of image pusher

Responses

Response samples

Content type
application/json
{
  • "pusher_type": "ZeroMQ",
  • "addr": [
    ],
  • "connected_writers": 0,
  • "images_written": 0,
  • "images_write_error": 0,
  • "writer_fifo_utilization": [
    ]
}

Get detector status

Status of the JUNGFRAU detector

+
http://localhost:5232/image_pusher/status

Response samples

Content type
application/json
{
  • "pusher_type": "ZeroMQ",
  • "addr": [
    ],
  • "connected_writers": 0,
  • "images_written": 0,
  • "images_write_error": 0,
  • "writer_fifo_utilization": [
    ]
}

Get detector status

Status of the JUNGFRAU detector

Responses

Response samples

Content type
application/json
{
  • "state": "Idle",
  • "powerchip": "PowerOn",
  • "server_version": "string",
  • "number_of_triggers_left": 0,
  • "fpga_temp_degC": [
    ],
  • "high_voltage_V": [
    ]
}

Get ROI definitions

Responses

Response samples

Content type
application/json
{
  • "state": "Idle",
  • "powerchip": "PowerOn",
  • "server_version": "string",
  • "number_of_triggers_left": 0,
  • "fpga_temp_degC": [
    ],
  • "high_voltage_V": [
    ]
}

Get ROI definitions

Responses

Response samples

Content type
application/json
{
  • "box": {
    },
  • "circle": {
    },
  • "azim": {
    }
}

Upload ROI definitions

Request Body schema: application/json
required
object (roi_box_list)

List of box ROIs

+
http://localhost:5232/config/roi

Response samples

Content type
application/json
{
  • "box": {
    },
  • "circle": {
    },
  • "azim": {
    }
}

Upload ROI definitions

Request Body schema: application/json
required
object (roi_box_list)

List of box ROIs

required
object (roi_circle_list)

List of circular ROIs

required
object (roi_azim_list)

List of azimuthal ROIs

Responses

Request samples

Content type
application/json
{
  • "box": {
    },
  • "circle": {
    },
  • "azim": {
    }
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get general statistics

measurement is omitted unless the request carries a valid bearer token for a protected +

http://localhost:5232/config/roi

Request samples

Content type
application/json
{
  • "box": {
    },
  • "circle": {
    },
  • "azim": {
    }
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get general statistics

measurement is omitted unless the request carries a valid bearer token for a protected dataset (see tokens in /start).

Responses

Response samples

Content type
application/json
{
  • "detector": {
    },
  • "detector_list": {
    },
  • "detector_settings": {
    },
  • "image_format_settings": {
    },
  • "instrument_metadata": {
    },
  • "file_writer_settings": {
    },
  • "data_processing_settings": {
    },
  • "measurement": {
    },
  • "broker": {
    },
  • "fpga": [
    ],
  • "calibration": [
    ],
  • "zeromq_preview": {
    },
  • "zeromq_metadata": {
    },
  • "dark_mask": {
    },
  • "pixel_mask": {
    },
  • "roi": {
    },
  • "az_int": {
    },
  • "buffer": {
    },
  • "indexing": {
    },
  • "bragg_integration": {
    },
  • "image_pusher": {
    }
}

Get data collection statistics

Results of the last data collection (dataset name, unit cell, ...)

+
http://localhost:5232/statistics

Response samples

Content type
application/json
{
  • "detector": {
    },
  • "detector_list": {
    },
  • "detector_settings": {
    },
  • "image_format_settings": {
    },
  • "instrument_metadata": {
    },
  • "file_writer_settings": {
    },
  • "data_processing_settings": {
    },
  • "measurement": {
    },
  • "broker": {
    },
  • "fpga": [
    ],
  • "calibration": [
    ],
  • "zeromq_preview": {
    },
  • "zeromq_metadata": {
    },
  • "dark_mask": {
    },
  • "pixel_mask": {
    },
  • "roi": {
    },
  • "az_int": {
    },
  • "buffer": {
    },
  • "indexing": {
    },
  • "bragg_integration": {
    },
  • "image_pusher": {
    }
}

Get data collection statistics

Results of the last data collection (dataset name, unit cell, ...)

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "file_prefix": "string",
  • "run_number": 0,
  • "experiment_group": "string",
  • "images_expected": 0,
  • "images_collected": 0,
  • "images_sent": 0,
  • "images_written": 0,
  • "images_discarded_lossy_compression": 0,
  • "max_image_number_sent": 0,
  • "collection_efficiency": 1,
  • "compression_ratio": 5.3,
  • "cancelled": true,
  • "max_receiver_delay": 0,
  • "indexing_rate": 0.1,
  • "detector_width": 0,
  • "detector_height": 0,
  • "detector_pixel_depth": 2,
  • "bkg_estimate": 0.1,
  • "unit_cell": "string",
  • "error_pixels": 0.1,
  • "saturated_pixels": 0.1,
  • "roi_beam_pixels": 0.1,
  • "roi_beam_sum": 0.1
}

Get calibration statistics

Statistics are provided for each module/storage cell separately

+
http://localhost:5232/statistics/data_collection

Response samples

Content type
application/json
{
  • "file_prefix": "string",
  • "run_number": 0,
  • "experiment_group": "string",
  • "images_expected": 0,
  • "images_collected": 0,
  • "images_sent": 0,
  • "images_written": 0,
  • "images_discarded_lossy_compression": 0,
  • "max_image_number_sent": 0,
  • "collection_efficiency": 1,
  • "compression_ratio": 5.3,
  • "cancelled": true,
  • "max_receiver_delay": 0,
  • "indexing_rate": 0.1,
  • "detector_width": 0,
  • "detector_height": 0,
  • "detector_pixel_depth": 2,
  • "bkg_estimate": 0.1,
  • "unit_cell": "string",
  • "error_pixels": 0.1,
  • "saturated_pixels": 0.1,
  • "roi_beam_pixels": 0.1,
  • "roi_beam_sum": 0.1
}

Get calibration statistics

Statistics are provided for each module/storage cell separately

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get mask of the detector (binary)

Detector must be Initialized. +

http://localhost:5232/statistics/calibration

Response samples

Content type
application/json
[
  • {
    }
]

Get mask of the detector (binary)

Detector must be Initialized. Get full pixel mask of the detector. See NXmx standard for meaning of pixel values.

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get mask of the detector (TIFF)

Should be in Idle state. +

http://localhost:5232/config/user_mask

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get mask of the detector (TIFF)

Should be in Idle state. Get full pixel mask of the detector See NXmx standard for meaning of pixel values

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get pedestal in TIFF format

query Parameters
gain_level
required
integer

Gain level (0, 1, 2)

+
http://localhost:5232/config/user_mask.tiff

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get pedestal in TIFF format

query Parameters
gain_level
required
integer

Gain level (0, 1, 2)

sc
integer

Storage cell number

Responses

Response samples

Content type
application/json
{
  • "title": "string",
  • "unit_x": "image_number",
  • "size_x": 0.1,
  • "size_y": 0.1,
  • "plot": [
    ]
}

Generate 1D plot from Jungfraujoch and send in raw binary format. +

http://localhost:5232/preview/plot

Response samples

Content type
application/json
{
  • "title": "string",
  • "unit_x": "image_number",
  • "size_x": 0.1,
  • "size_y": 0.1,
  • "plot": [
    ]
}

Generate 1D plot from Jungfraujoch and send in raw binary format. Data are provided as (32-bit) float binary array. This format doesn't transmit information about X-axis, only values, so it is of limited use for azimuthal integration.

Authorizations:
bearerAuth
query Parameters
type
required
string
Enum: "bkg_estimate" "spindle_blind_fraction" "azint" "azint_1d" "spot_count" "spot_count_low_res" "spot_count_indexed" "spot_count_ice" "indexing_rate" "indexing_lattice_count" "indexing_unit_cell_length" "indexing_unit_cell_angle" "profile_radius" "mosaicity" "b_factor" "error_pixels" "saturated_pixels" "image_collection_efficiency" "receiver_delay" "receiver_free_send_buf" "strong_pixels" "roi_sum" "roi_mean" "roi_max_count" "roi_pixels" "roi_weighted_x" "roi_weighted_y" "packets_received" "max_pixel_value" "resolution_estimate" "pixel_sum" "processing_time" "beam_center_x" "beam_center_y" "integrated_reflections" "image_scale_factor" "image_scale_cc" "compression_ratio" "ice_ring_score"

Type of requested plot

@@ -990,13 +1028,13 @@ This format doesn't transmit information about X-axis, only values, so it i

Response samples

Content type
application/json
{
  • "file_prefix": "string",
  • "rotation_unit_cell": {
    },
  • "rotation_crystal_lattice": [
    ],
  • "rotation_bravais": "string",
  • "images": [
    ]
}

Get Start message in CBOR format

Contains metadata for a dataset (e.g., experimental geometry)

+
http://localhost:5232/result/scan

Response samples

Content type
application/json
{
  • "file_prefix": "string",
  • "rotation_unit_cell": {
    },
  • "rotation_crystal_lattice": [
    ],
  • "rotation_bravais": "string",
  • "images": [
    ]
}

Get Start message in CBOR format

Contains metadata for a dataset (e.g., experimental geometry)

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Event stream of the collection, for a reader following it

Server-sent events (text/event-stream) for the current collection, from the moment /start has +

http://localhost:5232/image_buffer/start.cbor

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Event stream of the collection, for a reader following it

Server-sent events (text/event-stream) for the current collection, from the moment /start has accepted it: first its whole history, then every change, until it ends or a new collection begins. Only one reader at a time. Events, each with a JSON data line:

    @@ -1024,7 +1062,7 @@ A comment line (: keepalive) every 10 s when nothing happens.

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get preview image in JPEG format using custom settings

Authorizations:
bearerAuth
query Parameters
id
integer <int64> >= -2
Default: -1

Image ID in the image buffer. Special values: -1 - last image in the buffer, -2: last indexed image in the buffer

+
http://localhost:5232/image_buffer/image.cbor

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get preview image in JPEG format using custom settings

Authorizations:
bearerAuth
query Parameters
id
integer <int64> >= -2
Default: -1

Image ID in the image buffer. Special values: -1 - last image in the buffer, -2: last indexed image in the buffer

show_user_mask
boolean
Default: false

Show user mask

show_roi
boolean
Default: false

Show ROI areas on the image

show_spots
boolean
Default: true

Show spot finding results on the image

@@ -1041,7 +1079,7 @@ A comment line (: keepalive) every 10 s when nothing happens.

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get preview image in TIFF format

Authorizations:
bearerAuth
query Parameters
id
integer <int64> >= -2
Default: -1

Image ID in the image buffer. Special values: -1 - last image in the buffer, -2: last indexed image in the buffer

+
http://localhost:5232/image_buffer/image.jpeg

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get preview image in TIFF format

Authorizations:
bearerAuth
query Parameters
id
integer <int64> >= -2
Default: -1

Image ID in the image buffer. Special values: -1 - last image in the buffer, -2: last indexed image in the buffer

Responses

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get status of the image buffers

Can be run at any stage of Jungfraujoch operation, including during data collection. +

http://localhost:5232/image_buffer/clear

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get status of the image buffers

Can be run at any stage of Jungfraujoch operation, including during data collection. The status of the image buffer is volatile during data collection - if data collection goes for more images than available buffer slots, then image might be replaced in the buffer between calling /images and /image.cbor.

Responses

Response samples

Content type
application/json
{
  • "min_image_number": 0,
  • "max_image_number": 0,
  • "image_numbers": [
    ],
  • "total_slots": 0,
  • "available_slots": 0,
  • "in_preparation_slots": 0,
  • "in_sending_slots": 0,
  • "current_counter": 0
}

Get Jungfraujoch version of jfjoch_broker

Responses

Response samples

Content type
application/json
{
  • "min_image_number": 0,
  • "max_image_number": 0,
  • "image_numbers": [
    ],
  • "total_slots": 0,
  • "available_slots": 0,
  • "in_preparation_slots": 0,
  • "in_sending_slots": 0,
  • "current_counter": 0
}

Get Jungfraujoch version of jfjoch_broker

Responses