Mercurial > hg > orthanc
annotate OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp @ 5573:823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 26 Apr 2024 16:01:26 +0200 |
parents | e02cdf358905 |
children | 3a6d6d35193c |
rev | line source |
---|---|
4961 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5452
diff
changeset
|
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium |
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5452
diff
changeset
|
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4961 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU General Public License as | |
10 * published by the Free Software Foundation, either version 3 of the | |
11 * License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
5538
6ce05f8b5b13
deprecating OrthancPluginSetDescription2(), OrthancPluginExtendOrthancExplorer2() and OrthancPluginSetRootUri2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
23 #define HOUSEKEEPER_NAME "housekeeper" |
6ce05f8b5b13
deprecating OrthancPluginSetDescription2(), OrthancPluginExtendOrthancExplorer2() and OrthancPluginSetRootUri2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
24 |
4961 | 25 #include "../Common/OrthancPluginCppWrapper.h" |
26 | |
27 #include <boost/thread.hpp> | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
28 #include <boost/algorithm/string.hpp> |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
29 #include <boost/date_time/posix_time/posix_time.hpp> |
4991 | 30 #include <boost/date_time/special_defs.hpp> |
4961 | 31 #include <json/value.h> |
32 #include <json/writer.h> | |
33 #include <string.h> | |
34 #include <iostream> | |
35 #include <algorithm> | |
36 #include <map> | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
37 #include <list> |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
38 #include <time.h> |
4961 | 39 |
40 static int globalPropertyId_ = 0; | |
41 static bool force_ = false; | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
42 static unsigned int throttleDelay_ = 0; |
4961 | 43 static std::unique_ptr<boost::thread> workerThread_; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
44 static bool workerThreadShouldStop_ = false; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
45 static bool triggerOnStorageCompressionChange_ = true; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
46 static bool triggerOnMainDicomTagsChange_ = true; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
47 static bool triggerOnUnnecessaryDicomAsJsonFiles_ = true; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
48 static bool triggerOnIngestTranscodingChange_ = true; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
49 static bool triggerOnDicomWebCacheChange_ = true; |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
50 static std::string limitMainDicomTagsReconstructLevel_ = ""; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
51 static std::string limitToChange_ = ""; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
52 static std::string limitToUrl_ = ""; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
53 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
54 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
55 struct RunningPeriod |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
56 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
57 int fromHour_; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
58 int toHour_; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
59 int weekday_; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
60 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
61 RunningPeriod(const std::string& weekday, const std::string& period) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
62 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
63 if (weekday == "Monday") |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
64 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
65 weekday_ = 1; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
66 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
67 else if (weekday == "Tuesday") |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
68 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
69 weekday_ = 2; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
70 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
71 else if (weekday == "Wednesday") |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
72 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
73 weekday_ = 3; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
74 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
75 else if (weekday == "Thursday") |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
76 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
77 weekday_ = 4; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
78 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
79 else if (weekday == "Friday") |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
80 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
81 weekday_ = 5; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
82 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
83 else if (weekday == "Saturday") |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
84 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
85 weekday_ = 6; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
86 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
87 else if (weekday == "Sunday") |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
88 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
89 weekday_ = 0; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
90 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
91 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
92 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
93 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: invalid schedule: unknown 'day': " + weekday); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
94 ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
95 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
96 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
97 std::vector<std::string> hours; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
98 boost::split(hours, period, boost::is_any_of("-")); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
99 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
100 fromHour_ = boost::lexical_cast<int>(hours[0]); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
101 toHour_ = boost::lexical_cast<int>(hours[1]); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
102 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
103 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
104 bool isInPeriod() const |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
105 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
106 time_t now = time(NULL); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
107 tm* nowLocalTime = localtime(&now); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
108 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
109 if (nowLocalTime->tm_wday != weekday_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
110 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
111 return false; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
112 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
113 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
114 if (nowLocalTime->tm_hour >= fromHour_ && nowLocalTime->tm_hour < toHour_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
115 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
116 return true; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
117 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
118 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
119 return false; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
120 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
121 }; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
122 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
123 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
124 struct RunningPeriods |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
125 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
126 std::list<RunningPeriod> runningPeriods_; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
127 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
128 void load(const Json::Value& scheduleConfiguration) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
129 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
130 // "Monday": ["0-6", "20-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
131 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
132 Json::Value::Members names = scheduleConfiguration.getMemberNames(); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
133 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
134 for (Json::Value::Members::const_iterator it = names.begin(); |
5280 | 135 it != names.end(); ++it) |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
136 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
137 for (Json::Value::ArrayIndex i = 0; i < scheduleConfiguration[*it].size(); i++) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
138 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
139 runningPeriods_.push_back(RunningPeriod(*it, scheduleConfiguration[*it][i].asString())); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
140 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
141 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
142 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
143 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
144 bool isInPeriod() |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
145 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
146 if (runningPeriods_.size() == 0) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
147 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
148 return true; // if no config: always run |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
149 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
150 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
151 for (std::list<RunningPeriod>::const_iterator it = runningPeriods_.begin(); |
5280 | 152 it != runningPeriods_.end(); ++it) |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
153 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
154 if (it->isInPeriod()) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
155 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
156 return true; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
157 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
158 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
159 return false; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
160 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
161 }; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
162 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
163 RunningPeriods runningPeriods_; |
4961 | 164 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
165 |
4961 | 166 struct DbConfiguration |
167 { | |
168 std::string orthancVersion; | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
169 std::string patientsMainDicomTagsSignature; |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
170 std::string studiesMainDicomTagsSignature; |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
171 std::string seriesMainDicomTagsSignature; |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
172 std::string instancesMainDicomTagsSignature; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
173 std::string ingestTranscoding; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
174 std::string dicomWebVersion; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
175 bool storageCompressionEnabled; |
4961 | 176 |
177 DbConfiguration() | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
178 : storageCompressionEnabled(false) |
4961 | 179 { |
180 } | |
181 | |
182 bool IsDefined() const | |
183 { | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
184 return !orthancVersion.empty(); |
4961 | 185 } |
186 | |
187 void Clear() | |
188 { | |
189 orthancVersion.clear(); | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
190 patientsMainDicomTagsSignature.clear(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
191 studiesMainDicomTagsSignature.clear(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
192 seriesMainDicomTagsSignature.clear(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
193 instancesMainDicomTagsSignature.clear(); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
194 ingestTranscoding.clear(); |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
195 dicomWebVersion.clear(); |
4961 | 196 } |
197 | |
198 void ToJson(Json::Value& target) | |
199 { | |
200 if (!IsDefined()) | |
201 { | |
202 target = Json::nullValue; | |
203 } | |
204 else | |
205 { | |
206 Json::Value signatures; | |
207 | |
208 target = Json::objectValue; | |
209 | |
210 // default main dicom tags signature are the one from Orthanc 1.4.2 (last time the list was changed): | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
211 signatures["Patient"] = patientsMainDicomTagsSignature; |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
212 signatures["Study"] = studiesMainDicomTagsSignature; |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
213 signatures["Series"] = seriesMainDicomTagsSignature; |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
214 signatures["Instance"] = instancesMainDicomTagsSignature; |
4961 | 215 |
216 target["MainDicomTagsSignature"] = signatures; | |
217 target["OrthancVersion"] = orthancVersion; | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
218 target["StorageCompressionEnabled"] = storageCompressionEnabled; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
219 target["IngestTranscoding"] = ingestTranscoding; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
220 target["DicomWebVersion"] = dicomWebVersion; |
4961 | 221 } |
222 } | |
223 | |
224 void FromJson(Json::Value& source) | |
225 { | |
226 if (!source.isNull()) | |
227 { | |
228 orthancVersion = source["OrthancVersion"].asString(); | |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
229 if (source.isMember("DicomWebVersion")) |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
230 { |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
231 dicomWebVersion = source["DicomWebVersion"].asString(); |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
232 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
233 else |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
234 { |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
235 dicomWebVersion = "1.14"; // the first change that requires processing has been introduced between 1.14 & 1.15 |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
236 } |
4961 | 237 |
238 const Json::Value& signatures = source["MainDicomTagsSignature"]; | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
239 patientsMainDicomTagsSignature = signatures["Patient"].asString(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
240 studiesMainDicomTagsSignature = signatures["Study"].asString(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
241 seriesMainDicomTagsSignature = signatures["Series"].asString(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
242 instancesMainDicomTagsSignature = signatures["Instance"].asString(); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
243 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
244 storageCompressionEnabled = source["StorageCompressionEnabled"].asBool(); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
245 ingestTranscoding = source["IngestTranscoding"].asString(); |
4961 | 246 } |
247 } | |
248 }; | |
249 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
250 |
4961 | 251 struct PluginStatus |
252 { | |
253 int statusVersion; | |
254 int64_t lastProcessedChange; | |
255 int64_t lastChangeToProcess; | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
256 boost::posix_time::ptime lastTimeStarted; |
4961 | 257 |
258 DbConfiguration currentlyProcessingConfiguration; // last configuration being processed (has not reached last change yet) | |
259 DbConfiguration lastProcessedConfiguration; // last configuration that has been fully processed (till last change) | |
260 | |
261 PluginStatus() | |
262 : statusVersion(1), | |
263 lastProcessedChange(-1), | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
264 lastChangeToProcess(-1), |
4993 | 265 lastTimeStarted(boost::date_time::not_a_date_time) |
4961 | 266 { |
267 } | |
268 | |
269 void ToJson(Json::Value& target) | |
270 { | |
271 target = Json::objectValue; | |
272 | |
273 target["Version"] = statusVersion; | |
274 target["LastProcessedChange"] = Json::Value::Int64(lastProcessedChange); | |
275 target["LastChangeToProcess"] = Json::Value::Int64(lastChangeToProcess); | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
276 |
4993 | 277 if (lastTimeStarted == boost::date_time::not_a_date_time) |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
278 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
279 target["LastTimeStarted"] = Json::Value::null; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
280 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
281 else |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
282 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
283 target["LastTimeStarted"] = boost::posix_time::to_iso_string(lastTimeStarted); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
284 } |
4961 | 285 |
286 currentlyProcessingConfiguration.ToJson(target["CurrentlyProcessingConfiguration"]); | |
287 lastProcessedConfiguration.ToJson(target["LastProcessedConfiguration"]); | |
288 } | |
289 | |
290 void FromJson(Json::Value& source) | |
291 { | |
292 statusVersion = source["Version"].asInt(); | |
293 lastProcessedChange = source["LastProcessedChange"].asInt64(); | |
294 lastChangeToProcess = source["LastChangeToProcess"].asInt64(); | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
295 if (source["LastTimeStarted"].isNull()) |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
296 { |
4993 | 297 lastTimeStarted = boost::date_time::not_a_date_time; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
298 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
299 else |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
300 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
301 lastTimeStarted = boost::posix_time::from_iso_string(source["LastTimeStarted"].asString()); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
302 } |
4961 | 303 |
304 Json::Value& current = source["CurrentlyProcessingConfiguration"]; | |
305 Json::Value& last = source["LastProcessedConfiguration"]; | |
306 | |
307 currentlyProcessingConfiguration.FromJson(current); | |
308 lastProcessedConfiguration.FromJson(last); | |
309 } | |
310 }; | |
311 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
312 static PluginStatus pluginStatus_; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
313 static boost::recursive_mutex pluginStatusMutex_; |
4961 | 314 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
315 static void ReadStatusFromDb() |
4961 | 316 { |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
317 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
318 |
4961 | 319 OrthancPlugins::OrthancString globalPropertyContent; |
320 | |
321 globalPropertyContent.Assign(OrthancPluginGetGlobalProperty(OrthancPlugins::GetGlobalContext(), | |
322 globalPropertyId_, | |
323 "")); | |
324 | |
325 if (!globalPropertyContent.IsNullOrEmpty()) | |
326 { | |
327 Json::Value jsonStatus; | |
328 globalPropertyContent.ToJson(jsonStatus); | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
329 pluginStatus_.FromJson(jsonStatus); |
4961 | 330 } |
331 else | |
332 { | |
333 // default config | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
334 pluginStatus_.statusVersion = 1; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
335 pluginStatus_.lastProcessedChange = -1; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
336 pluginStatus_.lastChangeToProcess = -1; |
4993 | 337 pluginStatus_.lastTimeStarted = boost::date_time::not_a_date_time; |
4961 | 338 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
339 pluginStatus_.lastProcessedConfiguration.orthancVersion = "1.9.0"; // when we don't know, we assume some files were stored with Orthanc 1.9.0 (last version saving the dicom-as-json files) |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
340 pluginStatus_.lastProcessedConfiguration.dicomWebVersion = "1.14"; // the first change that requires processing has been introduced between 1.14 & 1.15 |
4961 | 341 |
342 // default main dicom tags signature are the one from Orthanc 1.4.2 (last time the list was changed): | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
343 pluginStatus_.lastProcessedConfiguration.patientsMainDicomTagsSignature = "0010,0010;0010,0020;0010,0030;0010,0040;0010,1000"; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
344 pluginStatus_.lastProcessedConfiguration.studiesMainDicomTagsSignature = "0008,0020;0008,0030;0008,0050;0008,0080;0008,0090;0008,1030;0020,000d;0020,0010;0032,1032;0032,1060"; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
345 pluginStatus_.lastProcessedConfiguration.seriesMainDicomTagsSignature = "0008,0021;0008,0031;0008,0060;0008,0070;0008,1010;0008,103e;0008,1070;0018,0010;0018,0015;0018,0024;0018,1030;0018,1090;0018,1400;0020,000e;0020,0011;0020,0037;0020,0105;0020,1002;0040,0254;0054,0081;0054,0101;0054,1000"; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
346 pluginStatus_.lastProcessedConfiguration.instancesMainDicomTagsSignature = "0008,0012;0008,0013;0008,0018;0020,0012;0020,0013;0020,0032;0020,0037;0020,0100;0020,4000;0028,0008;0054,1330"; |
4961 | 347 } |
348 } | |
349 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
350 static void SaveStatusInDb() |
4961 | 351 { |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
352 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
353 |
4961 | 354 Json::Value jsonStatus; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
355 pluginStatus_.ToJson(jsonStatus); |
4961 | 356 |
357 Json::StreamWriterBuilder builder; | |
358 builder.settings_["indentation"] = " "; | |
359 std::string serializedStatus = Json::writeString(builder, jsonStatus); | |
360 | |
361 OrthancPluginSetGlobalProperty(OrthancPlugins::GetGlobalContext(), | |
362 globalPropertyId_, | |
363 serializedStatus.c_str()); | |
364 } | |
365 | |
366 static void GetCurrentDbConfiguration(DbConfiguration& configuration) | |
367 { | |
368 Json::Value signatures; | |
369 Json::Value systemInfo; | |
370 | |
371 OrthancPlugins::RestApiGet(systemInfo, "/system", false); | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
372 configuration.patientsMainDicomTagsSignature = systemInfo["MainDicomTags"]["Patient"].asString(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
373 configuration.studiesMainDicomTagsSignature = systemInfo["MainDicomTags"]["Study"].asString(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
374 configuration.seriesMainDicomTagsSignature = systemInfo["MainDicomTags"]["Series"].asString(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
375 configuration.instancesMainDicomTagsSignature = systemInfo["MainDicomTags"]["Instance"].asString(); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
376 configuration.storageCompressionEnabled = systemInfo["StorageCompression"].asBool(); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
377 configuration.ingestTranscoding = systemInfo["IngestTranscoding"].asString(); |
4961 | 378 |
379 configuration.orthancVersion = OrthancPlugins::GetGlobalContext()->orthancVersion; | |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
380 |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
381 Json::Value pluginInfo; |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
382 if (OrthancPlugins::RestApiGet(pluginInfo, "/plugins/dicom-web", false)) |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
383 { |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
384 configuration.dicomWebVersion = pluginInfo["Version"].asString(); |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
385 } |
4961 | 386 } |
387 | |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
388 static void CheckNeedsProcessing(bool& needsReconstruct, bool& needsReingest, bool& needsDicomWebCaching, const DbConfiguration& current, const DbConfiguration& last) |
4961 | 389 { |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
390 needsReconstruct = false; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
391 needsReingest = false; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
392 needsDicomWebCaching = false; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
393 |
4961 | 394 if (!last.IsDefined()) |
395 { | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
396 return; |
4961 | 397 } |
398 | |
399 const char* lastVersion = last.orthancVersion.c_str(); | |
400 | |
401 if (!OrthancPlugins::CheckMinimalVersion(lastVersion, 1, 9, 1)) | |
402 { | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
403 if (triggerOnUnnecessaryDicomAsJsonFiles_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
404 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
405 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: your storage might still contain some dicom-as-json files -> will perform housekeeping"); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
406 needsReconstruct = true; // the default reconstruct removes the dicom-as-json |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
407 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
408 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
409 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
410 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: your storage might still contain some dicom-as-json files but the trigger has been disabled"); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
411 } |
4961 | 412 } |
413 | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
414 if (last.patientsMainDicomTagsSignature != current.patientsMainDicomTagsSignature) |
4961 | 415 { |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
416 if (triggerOnMainDicomTagsChange_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
417 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
418 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Patient main dicom tags have changed, -> will perform housekeeping"); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
419 needsReconstruct = true; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
420 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
421 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
422 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
423 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Patient main dicom tags have changed but the trigger is disabled"); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
424 } |
4961 | 425 } |
426 | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
427 if (last.studiesMainDicomTagsSignature != current.studiesMainDicomTagsSignature) |
4961 | 428 { |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
429 if (triggerOnMainDicomTagsChange_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
430 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
431 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Study main dicom tags have changed, -> will perform housekeeping"); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
432 needsReconstruct = true; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
433 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
434 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
435 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
436 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Study main dicom tags have changed but the trigger is disabled"); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
437 } |
4961 | 438 } |
439 | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
440 if (last.seriesMainDicomTagsSignature != current.seriesMainDicomTagsSignature) |
4961 | 441 { |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
442 if (triggerOnMainDicomTagsChange_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
443 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
444 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Series main dicom tags have changed, -> will perform housekeeping"); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
445 needsReconstruct = true; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
446 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
447 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
448 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
449 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Series main dicom tags have changed but the trigger is disabled"); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
450 } |
4961 | 451 } |
452 | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
453 if (last.instancesMainDicomTagsSignature != current.instancesMainDicomTagsSignature) |
4961 | 454 { |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
455 if (triggerOnMainDicomTagsChange_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
456 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
457 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Instance main dicom tags have changed, -> will perform housekeeping"); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
458 needsReconstruct = true; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
459 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
460 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
461 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
462 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Instance main dicom tags have changed but the trigger is disabled"); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
463 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
464 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
465 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
466 if (current.storageCompressionEnabled != last.storageCompressionEnabled) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
467 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
468 if (triggerOnStorageCompressionChange_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
469 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
470 if (current.storageCompressionEnabled) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
471 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
472 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: storage compression is now enabled -> will perform housekeeping"); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
473 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
474 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
475 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
476 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: storage compression is now disabled -> will perform housekeeping"); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
477 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
478 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
479 needsReingest = true; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
480 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
481 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
482 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
483 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: storage compression has changed but the trigger is disabled"); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
484 } |
4961 | 485 } |
486 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
487 if (current.ingestTranscoding != last.ingestTranscoding) |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
488 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
489 if (triggerOnIngestTranscodingChange_) |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
490 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
491 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: ingest transcoding has changed -> will perform housekeeping"); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
492 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
493 needsReingest = true; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
494 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
495 else |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
496 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
497 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: ingest transcoding has changed but the trigger is disabled"); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
498 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
499 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
500 |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
501 if (!current.dicomWebVersion.empty()) |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
502 { |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
503 if (last.dicomWebVersion.empty()) |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
504 { |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
505 if (triggerOnDicomWebCacheChange_) |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
506 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
507 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: DicomWEB plugin is enabled and the housekeeper has never run, you might miss series metadata cache -> will perform housekeeping"); |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
508 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
509 needsDicomWebCaching = triggerOnDicomWebCacheChange_; |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
510 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
511 else |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
512 { |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
513 const char* lastDicomWebVersion = last.dicomWebVersion.c_str(); |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
514 |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
515 if (!OrthancPlugins::CheckMinimalVersion(lastDicomWebVersion, 1, 15, 0)) |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
516 { |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
517 if (triggerOnDicomWebCacheChange_) |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
518 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
519 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: DicomWEB plugin might miss series metadata cache -> will perform housekeeping"); |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
520 needsDicomWebCaching = true; |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
521 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
522 else |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
523 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
524 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: DicomWEB plugin might miss series metadata cache but the trigger has been disabled"); |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
525 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
526 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
527 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
528 } |
4961 | 529 } |
530 | |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
531 static bool ProcessChanges(bool needsReconstruct, bool needsReingest, bool needsDicomWebCaching, const DbConfiguration& currentDbConfiguration) |
4961 | 532 { |
533 Json::Value changes; | |
534 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
535 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
536 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
4961 | 537 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
538 pluginStatus_.currentlyProcessingConfiguration = currentDbConfiguration; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
539 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
540 OrthancPlugins::RestApiGet(changes, "/changes?since=" + boost::lexical_cast<std::string>(pluginStatus_.lastProcessedChange) + "&limit=100", false); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
541 } |
4961 | 542 |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
543 if (changes["Changes"].size() > 0) |
4961 | 544 { |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
545 for (Json::ArrayIndex i = 0; i < changes["Changes"].size(); i++) |
4961 | 546 { |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
547 const Json::Value& change = changes["Changes"][i]; |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
548 int64_t seq = change["Seq"].asInt64(); |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
549 |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
550 if (!limitToChange_.empty()) // if updating only maindicomtags for a single level |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
551 { |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
552 if (change["ChangeType"] == limitToChange_) |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
553 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
554 Json::Value result; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
555 Json::Value request; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
556 request["ReconstructFiles"] = false; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
557 request["LimitToThisLevelMainDicomTags"] = true; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
558 OrthancPlugins::RestApiPost(result, "/" + limitToUrl_ + "/" + change["ID"].asString() + "/reconstruct", request, false); |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
559 } |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
560 } |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
561 else |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
562 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
563 if (change["ChangeType"] == "NewStudy") // some StableStudy might be missing if orthanc was shutdown during a StableAge -> consider only the NewStudy events that can not be missed |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
564 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
565 Json::Value result; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
566 |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
567 if (needsReconstruct) |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
568 { |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
569 Json::Value request; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
570 if (needsReingest) |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
571 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
572 request["ReconstructFiles"] = true; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
573 } |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
574 OrthancPlugins::RestApiPost(result, "/studies/" + change["ID"].asString() + "/reconstruct", request, false); |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
575 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
576 |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
577 if (needsDicomWebCaching) |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
578 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
579 Json::Value request; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
580 OrthancPlugins::RestApiPost(result, "/studies/" + change["ID"].asString() + "/update-dicomweb-cache", request, true); |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
581 } |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
582 } |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
583 } |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
584 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
585 { |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
586 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
587 |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
588 pluginStatus_.lastProcessedChange = seq; |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
589 |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
590 if (seq >= pluginStatus_.lastChangeToProcess) // we are done ! |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
591 { |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
592 return true; |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
593 } |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
594 } |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
595 |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
596 if (change["ChangeType"] == "NewStudy") |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
597 { |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
598 boost::this_thread::sleep(boost::posix_time::milliseconds(throttleDelay_ * 1000)); |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
599 } |
4961 | 600 } |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
601 } |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
602 else |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
603 { |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
604 // if the change list is empty and Done is true, it means that there is nothing to process anymore |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
605 if (changes["Done"].asBool()) |
4961 | 606 { |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
607 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
608 |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
609 pluginStatus_.lastProcessedChange = changes["Last"].asInt64(); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
610 |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
611 return true; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
612 } |
4961 | 613 } |
614 | |
615 return false; | |
616 } | |
617 | |
618 | |
619 static void WorkerThread() | |
620 { | |
5452
8345267e8de5
Added OrthancPluginSetCurrentThreadName() in the plugin SDK
Alain Mazy <am@osimis.io>
parents:
5395
diff
changeset
|
621 OrthancPluginSetCurrentThreadName(OrthancPlugins::GetGlobalContext(), "HOUSEKEEPER"); |
8345267e8de5
Added OrthancPluginSetCurrentThreadName() in the plugin SDK
Alain Mazy <am@osimis.io>
parents:
5395
diff
changeset
|
622 |
4961 | 623 DbConfiguration currentDbConfiguration; |
624 | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
625 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), "Starting Housekeeper worker thread"); |
4961 | 626 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
627 ReadStatusFromDb(); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
628 |
4961 | 629 GetCurrentDbConfiguration(currentDbConfiguration); |
630 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
631 bool needsReconstruct = false; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
632 bool needsReingest = false; |
5009
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
633 bool needsFullProcessing = false; |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
634 bool needsProcessing = false; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
635 bool needsDicomWebCaching = false; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
636 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
637 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
638 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
5009
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
639 |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
640 // compare with last full processed configuration |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
641 CheckNeedsProcessing(needsReconstruct, needsReingest, needsDicomWebCaching, currentDbConfiguration, pluginStatus_.lastProcessedConfiguration); |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
642 needsFullProcessing = needsReconstruct || needsReingest || needsDicomWebCaching; |
5009
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
643 needsProcessing = needsFullProcessing; |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
644 |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
645 // if a processing was in progress, check if the config has changed since |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
646 if (pluginStatus_.currentlyProcessingConfiguration.IsDefined()) |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
647 { |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
648 needsProcessing = true; // since a processing was in progress, we need at least a partial processing |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
649 |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
650 bool needsReconstruct2 = false; |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
651 bool needsReingest2 = false; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
652 bool needsDicomWebCaching2 = false; |
5009
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
653 |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
654 CheckNeedsProcessing(needsReconstruct2, needsReingest2, needsDicomWebCaching2, currentDbConfiguration, pluginStatus_.currentlyProcessingConfiguration); |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
655 needsFullProcessing = needsReconstruct2 || needsReingest2 || needsDicomWebCaching2; // if the configuration has changed compared to the config being processed, we need a full processing again |
5009
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
656 } |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
657 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
658 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
659 if (!needsProcessing) |
4961 | 660 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
661 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: everything has been processed already !"); |
4961 | 662 return; |
663 } | |
664 | |
5009
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
665 if (force_ || needsFullProcessing) |
4961 | 666 { |
667 if (force_) | |
668 { | |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
669 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: forcing execution -> will perform housekeeping"); |
4961 | 670 } |
671 else | |
672 { | |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
673 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: the DB configuration has changed since last run, will reprocess the whole DB !"); |
4961 | 674 } |
675 | |
676 Json::Value changes; | |
677 OrthancPlugins::RestApiGet(changes, "/changes?last", false); | |
678 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
679 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
680 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
681 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
682 pluginStatus_.lastProcessedChange = 0; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
683 pluginStatus_.lastChangeToProcess = changes["Last"].asInt64(); // the last change is the last change at the time we start. We assume that every new ingested file will be constructed correctly |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
684 pluginStatus_.lastTimeStarted = boost::posix_time::microsec_clock::universal_time(); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
685 } |
4961 | 686 } |
687 else | |
688 { | |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
689 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: the DB configuration has not changed since last run, will continue processing changes"); |
4961 | 690 } |
691 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
692 bool completed = false; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
693 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
694 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
695 completed = pluginStatus_.lastChangeToProcess == 0; // if the DB is empty at start, no need to process anyting |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
696 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
697 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
698 bool loggedNotRightPeriodChangeMessage = false; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
699 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
700 while (!workerThreadShouldStop_ && !completed) |
4961 | 701 { |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
702 if (runningPeriods_.isInPeriod()) |
4961 | 703 { |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
704 completed = ProcessChanges(needsReconstruct, needsReingest, needsDicomWebCaching, currentDbConfiguration); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
705 SaveStatusInDb(); |
4961 | 706 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
707 if (!completed) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
708 { |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
709 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
710 |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
711 ORTHANC_PLUGINS_LOG_INFO("Housekeeper: processed changes " + boost::lexical_cast<std::string>(pluginStatus_.lastProcessedChange) + |
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
712 " / " + boost::lexical_cast<std::string>(pluginStatus_.lastChangeToProcess)); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
713 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
714 boost::this_thread::sleep(boost::posix_time::milliseconds(throttleDelay_ * 100)); // wait 1/10 of the delay between changes |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
715 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
716 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
717 loggedNotRightPeriodChangeMessage = false; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
718 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
719 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
720 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
721 if (!loggedNotRightPeriodChangeMessage) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
722 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
723 ORTHANC_PLUGINS_LOG_INFO("Housekeeper: entering quiet period"); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
724 loggedNotRightPeriodChangeMessage = true; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
725 } |
5395
c1037a755cee
housekeeper: added sleep when idle
Alain Mazy <am@osimis.io>
parents:
5376
diff
changeset
|
726 |
c1037a755cee
housekeeper: added sleep when idle
Alain Mazy <am@osimis.io>
parents:
5376
diff
changeset
|
727 boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); |
4961 | 728 } |
729 } | |
730 | |
731 if (completed) | |
732 { | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
733 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
734 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
735 pluginStatus_.lastProcessedConfiguration = currentDbConfiguration; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
736 pluginStatus_.currentlyProcessingConfiguration.Clear(); |
4961 | 737 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
738 pluginStatus_.lastProcessedChange = -1; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
739 pluginStatus_.lastChangeToProcess = -1; |
4961 | 740 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
741 SaveStatusInDb(); |
4961 | 742 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
743 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), "Housekeeper: finished processing all changes"); |
4961 | 744 } |
745 } | |
746 | |
747 extern "C" | |
748 { | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
749 OrthancPluginErrorCode GetPluginStatus(OrthancPluginRestOutput* output, |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
750 const char* url, |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
751 const OrthancPluginHttpRequest* request) |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
752 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
753 if (request->method != OrthancPluginHttpMethod_Get) |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
754 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
755 OrthancPlugins::AnswerMethodNotAllowed(output, "GET"); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
756 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
757 else |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
758 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
759 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
760 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
761 Json::Value status; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
762 pluginStatus_.ToJson(status); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
763 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
764 OrthancPlugins::AnswerJson(status, output); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
765 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
766 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
767 return OrthancPluginErrorCode_Success; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
768 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
769 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
770 |
4961 | 771 OrthancPluginErrorCode OnChangeCallback(OrthancPluginChangeType changeType, |
772 OrthancPluginResourceType resourceType, | |
773 const char* resourceId) | |
774 { | |
775 switch (changeType) | |
776 { | |
777 case OrthancPluginChangeType_OrthancStarted: | |
778 { | |
779 workerThread_.reset(new boost::thread(WorkerThread)); | |
780 return OrthancPluginErrorCode_Success; | |
781 } | |
782 case OrthancPluginChangeType_OrthancStopped: | |
783 { | |
784 if (workerThread_ && workerThread_->joinable()) | |
785 { | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
786 workerThreadShouldStop_ = true; |
4961 | 787 workerThread_->join(); |
788 } | |
789 } | |
790 default: | |
791 return OrthancPluginErrorCode_Success; | |
792 } | |
793 } | |
794 | |
795 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c) | |
796 { | |
5563 | 797 OrthancPlugins::SetGlobalContext(c, HOUSEKEEPER_NAME); |
4961 | 798 |
799 /* Check the version of the Orthanc core */ | |
800 if (OrthancPluginCheckVersion(c) == 0) | |
801 { | |
802 OrthancPlugins::ReportMinimalOrthancVersion(ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER, | |
803 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, | |
804 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); | |
805 return -1; | |
806 } | |
807 | |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
808 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper plugin is initializing"); |
5538
6ce05f8b5b13
deprecating OrthancPluginSetDescription2(), OrthancPluginExtendOrthancExplorer2() and OrthancPluginSetRootUri2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
809 OrthancPluginSetDescription2(c, HOUSEKEEPER_NAME, "Optimizes your DB and storage."); |
4961 | 810 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
811 OrthancPlugins::OrthancConfiguration orthancConfiguration; |
4961 | 812 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
813 OrthancPlugins::OrthancConfiguration housekeeper; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
814 orthancConfiguration.GetSection(housekeeper, "Housekeeper"); |
4961 | 815 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
816 bool enabled = housekeeper.GetBooleanValue("Enable", false); |
4961 | 817 if (enabled) |
818 { | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
819 /* |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
820 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
821 "Housekeeper": { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
822 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
823 // Enables/disables the plugin |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
824 "Enable": false, |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
825 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
826 // the Global Prooperty ID in which the plugin progress |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
827 // is stored. Must be > 1024 and must not be used by |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
828 // another plugin |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
829 "GlobalPropertyId": 1025, |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
830 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
831 // Forces execution even if the plugin did not detect |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
832 // any changes in configuration |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
833 "Force": false, |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
834 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
835 // Delay (in seconds) between reconstruction of 2 studies |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
836 // This avoids overloading Orthanc with the housekeeping |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
837 // process and leaves room for other operations. |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
838 "ThrottleDelay": 5, |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
839 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
840 // Runs the plugin only at certain period of time. |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
841 // If not specified, the plugin runs all the time |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
842 // Examples: |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
843 // to run between 0AM and 6AM everyday + every night |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
844 // from 8PM to 12PM and 24h a day on the weekend: |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
845 // "Schedule": { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
846 // "Monday": ["0-6", "20-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
847 // "Tuesday": ["0-6", "20-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
848 // "Wednesday": ["0-6", "20-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
849 // "Thursday": ["0-6", "20-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
850 // "Friday": ["0-6", "20-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
851 // "Saturday": ["0-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
852 // "Sunday": ["0-24"] |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
853 // }, |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
854 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
855 // configure events that can trigger a housekeeping processing |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
856 "Triggers" : { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
857 "StorageCompressionChange": true, |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
858 "MainDicomTagsChange": true, |
5376
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
859 "UnnecessaryDicomAsJsonFiles": true, |
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
860 "DicomWebCacheChange": true // new in 1.12.2 |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
861 }, |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
862 |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
863 // When rebuilding MainDicomTags, limit to a single level of resource. |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
864 // Allowed values: "Patient", "Study", "Series", "Instance" |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
865 "LimitMainDicomTagsReconstructLevel": "Study" |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
866 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
867 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
868 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
869 */ |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
870 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
871 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
872 globalPropertyId_ = housekeeper.GetIntegerValue("GlobalPropertyId", 1025); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
873 force_ = housekeeper.GetBooleanValue("Force", false); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
874 throttleDelay_ = housekeeper.GetUnsignedIntegerValue("ThrottleDelay", 5); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
875 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
876 if (housekeeper.GetJson().isMember("Triggers")) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
877 { |
5376
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
878 OrthancPlugins::OrthancConfiguration triggers; |
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
879 housekeeper.GetSection(triggers, "Triggers"); |
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
880 triggerOnStorageCompressionChange_ = triggers.GetBooleanValue("StorageCompressionChange", true); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
881 |
5376
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
882 triggerOnMainDicomTagsChange_ = triggers.GetBooleanValue("MainDicomTagsChange", true); |
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
883 triggerOnUnnecessaryDicomAsJsonFiles_ = triggers.GetBooleanValue("UnnecessaryDicomAsJsonFiles", true); |
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
884 triggerOnIngestTranscodingChange_ = triggers.GetBooleanValue("IngestTranscodingChange", true); |
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
885 triggerOnDicomWebCacheChange_ = triggers.GetBooleanValue("DicomWebCacheChange", true); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
886 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
887 |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
888 limitMainDicomTagsReconstructLevel_ = housekeeper.GetStringValue("LimitMainDicomTagsReconstructLevel", ""); |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
889 if (limitMainDicomTagsReconstructLevel_ != "Patient" && limitMainDicomTagsReconstructLevel_ != "Study" |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
890 && limitMainDicomTagsReconstructLevel_ != "Series" && limitMainDicomTagsReconstructLevel_ != "Instance") |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
891 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
892 ORTHANC_PLUGINS_LOG_ERROR("Housekeeper invalid value for 'LimitMainDicomTagsReconstructLevel': '" + limitMainDicomTagsReconstructLevel_ + "'"); |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
893 } |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
894 else if (limitMainDicomTagsReconstructLevel_ == "Patient") |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
895 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
896 limitToChange_ = "NewPatient"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
897 limitToUrl_ = "patients"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
898 } |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
899 else if (limitMainDicomTagsReconstructLevel_ == "Study") |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
900 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
901 limitToChange_ = "NewStudy"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
902 limitToUrl_ = "studies"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
903 } |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
904 else if (limitMainDicomTagsReconstructLevel_ == "Series") |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
905 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
906 limitToChange_ = "NewSeries"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
907 limitToUrl_ = "series"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
908 } |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
909 else if (limitMainDicomTagsReconstructLevel_ == "Instance") |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
910 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
911 limitToChange_ = "NewInstance"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
912 limitToUrl_ = "instances"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
913 } |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
914 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
915 if (housekeeper.GetJson().isMember("Schedule")) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
916 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
917 runningPeriods_.load(housekeeper.GetJson()["Schedule"]); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
918 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
919 |
4961 | 920 OrthancPluginRegisterOnChangeCallback(c, OnChangeCallback); |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
921 OrthancPluginRegisterRestCallback(c, "/housekeeper/status", GetPluginStatus); // for backward compatiblity with version 1.11.0 |
5035 | 922 OrthancPluginRegisterRestCallback(c, "/plugins/housekeeper/status", GetPluginStatus); |
4961 | 923 } |
924 else | |
925 { | |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
926 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper plugin is disabled by the configuration file"); |
4961 | 927 } |
928 | |
929 return 0; | |
930 } | |
931 | |
932 | |
933 ORTHANC_PLUGINS_API void OrthancPluginFinalize() | |
934 { | |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
935 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper plugin is finalizing"); |
4961 | 936 } |
937 | |
938 | |
939 ORTHANC_PLUGINS_API const char* OrthancPluginGetName() | |
940 { | |
5538
6ce05f8b5b13
deprecating OrthancPluginSetDescription2(), OrthancPluginExtendOrthancExplorer2() and OrthancPluginSetRootUri2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
941 return HOUSEKEEPER_NAME; |
4961 | 942 } |
943 | |
944 | |
945 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion() | |
946 { | |
4981 | 947 return HOUSEKEEPER_VERSION; |
4961 | 948 } |
949 } |