Go to the documentation of this file.
4 #include <QWaitCondition>
47 bool CheckRun(
const QDateTime& now);
52 bool CheckImmediate(
void);
53 bool CheckStartup(
void);
55 QString
GetTag(
void) {
return m_dbTag; }
59 QDateTime QueryLastRun(
void);
60 QDateTime QueryLastSuccess(
void);
63 virtual QDateTime UpdateLastRun(
const QDateTime& last,
bool successful=
true);
64 virtual void SetLastRun(
const QDateTime& last,
bool successful=
true);
66 virtual bool DoCheckRun(
const QDateTime& ) {
return false; }
67 virtual bool DoRun(
void) {
return false; }
75 bool m_confirm {
false};
78 bool m_running {
false};
91 bool DoCheckRun(
const QDateTime& now)
override;
92 virtual bool InWindow(
const QDateTime& now);
93 virtual bool PastWindow(
const QDateTime& now);
94 QDateTime
UpdateLastRun(
const QDateTime& last,
bool successful=
true)
override;
95 void SetLastRun(
const QDateTime& last,
bool successful=
true)
override;
96 virtual void SetWindow(
float min,
float max);
99 virtual void CalculateWindow(
void);
105 double m_currentProb { 1.0 };
115 std::chrono::hours minhour, std::chrono::hours maxhour,
118 virtual void SetHourWindow(std::chrono::hours min, std::chrono::hours max);
119 bool InWindow(
const QDateTime& now)
override;
134 void run(
void)
override;
159 void StartThread(
void);
162 void customEvent(QEvent *e)
override;
168 QTimer *m_timer {
nullptr };
Manages registered HouseKeeperTasks and queues tasks for operation.
HouseKeeperStartup m_startup
std::chrono::seconds m_retry
QList< HouseKeepingThread * > m_threadList
virtual bool InWindow(const QDateTime &now)
virtual bool DoCheckRun(const QDateTime &)
@ kHKRunOnStartup
task is queued when HouseKeeper is started
HouseKeepingThread(HouseKeeper *p)
QQueue< HouseKeeperTask * > m_taskQueue
QDateTime UpdateLastRun(bool successful=true)
virtual void Terminate(void)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
@ kHKLocal
task should only run once per machine e.g.
virtual void SetLastRun(const QDateTime &last, bool successful=true)
virtual void CalculateWindow(void)
~HouseKeepingThread() override=default
QDateTime GetLastRun(void)
Modified HouseKeeperTask for tasks to be run at a regular interval.
Thread used to perform queued HouseKeeper tasks.
@ kHKInst
task should run on every process e.g.
HouseKeeperScope GetScope(void)
QPair< std::chrono::seconds, std::chrono::seconds > m_windowElapsed
QMap< QString, HouseKeeperTask * > m_taskMap
QPair< std::chrono::hours, std::chrono::hours > m_windowHour
@ kHKGlobal
task should only run once per cluster e.g.
std::chrono::seconds m_period
This is a wrapper around QThread that does several additional things.
@ kHKNormal
task is checked normally
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
QPair< float, float > m_windowPercent
QDateTime GetLastSuccess(void)
QWaitCondition m_waitCondition
Definition for a single task to be run by the HouseKeeper.
@ kHKRunImmediateOnStartup
task is run during HouseKeeper startup
Modified PeriodicHouseKeeperTask for tasks to be run once daily.
General purpose reference counter.
bool ConfirmRun(void) const
bool IsRunning(void) const