19#include "scheduler/scheduler.hpp"
21#include <MQSSCIInterfaces/MQSSCompiler.h>
25#include <mqss/submitter/Device.h>
29namespace mqss::qrmci {
40static_assert(std::atomic<bool>::is_always_lock_free);
46 const auto handler = [](
int signal) {
47 if (signal == SIGINT || signal == SIGTERM) {
51 std::signal(SIGINT, handler);
52 std::signal(SIGTERM, handler);
73[[nodiscard]] std::expected<mqss::submitter::Device, Error>
86[[nodiscard]] std::expected<void, Error>
89 std::string_view dispatchQueue =
"");
108std::optional<mqss::Backend>
111 std::string_view dispatchQueue =
"");
131 mqss::mqssci::MQSSCompiler &compiler,
TaskScheduler &scheduler,
145[[nodiscard]] std::expected<void, Error>
147 mqss::mqssci::MQSSCompiler &compiler,
The set of backends a QRM&CI process may schedule onto, and the time-to-live after which an entry nob...
BackendSelectionPolicy
Named rule deciding which backend wins when several of them could run the same task.
@ LowestName
The compatible backend whose name sorts first.
The runtime configuration model shared by every QRM&CI daemon.
std::expected< void, Error > selectCompileAndSchedule(mqss::QuantumTask &task, const BackendRegistry &backends, mqss::mqssci::MQSSCompiler &compiler, TaskScheduler &scheduler, BackendSelectionPolicy policy=BackendSelectionPolicy::LowestName)
Select a backend for task, compile it for that backend, and hand it to scheduler.
std::expected< void, Error > registerOwnDevice(const mqss::submitter::Device &device, BackendRegistry &backends, std::string_view dispatchQueue="")
Read this process's own device and register it, so the daemon has a backend to schedule onto before i...
void logRegisteredBackends(const BackendRegistry &backends)
Log every registered backend and its capabilities at info level.
std::expected< void, Error > compileAndSchedule(mqss::QuantumTask &task, const BackendRegistry &backends, mqss::mqssci::MQSSCompiler &compiler, TaskScheduler &scheduler)
Compile task for the backend it was already assigned and hand it to scheduler.
void installTerminationHandlers()
Register SIGINT and SIGTERM handlers that set terminationRequested.
std::expected< Config, Error > initializeDaemon()
Bring a daemon process up: install the SIGINT/SIGTERM handlers, assemble the configuration,...
std::expected< mqss::submitter::Device, Error > openConfiguredDevice(const SubmitterConfig &config)
Open the QDMI device config names.
mqss::scheduler::Scheduler< mqss::QuantumTask > TaskScheduler
The scheduler every daemon that submits work runs its tasks through.
constinit std::atomic< bool > terminationRequested
Set to true once SIGINT or SIGTERM has been received.
std::optional< mqss::Backend > refreshOwnDeviceStatus(const mqss::submitter::Device &device, BackendRegistry &backends, PublicationThrottle &throttle, std::string_view dispatchQueue="")
Re-read this process's own device and refresh its registry entry, if throttle has a publish slot due.
The error type every std::expected in QRM&CI's public interfaces carries.
Paces how often a device-owning process re-reads and publishes its own status, independently of how f...
Owns the backends a process knows about, keyed by backend name.
Claims at most one status-publication slot per configured interval.
Submitter-specific configuration: its own queue/logging, QDMI credentials and device selection,...