Mercurial > hg > orthanc
annotate OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp @ 5853:4d932683049d get-scu tip
very first implementation of C-Get SCU
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 29 Oct 2024 17:25:49 +0100 |
parents | f7adfb22e20e |
children |
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 | |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5635
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5635
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5452
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4961 | 8 * |
9 * This program is free software: you can redistribute it and/or | |
10 * modify it under the terms of the GNU General Public License as | |
11 * published by the Free Software Foundation, either version 3 of the | |
12 * License, or (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, but | |
15 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 * General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 **/ | |
22 | |
23 | |
5538
6ce05f8b5b13
deprecating OrthancPluginSetDescription2(), OrthancPluginExtendOrthancExplorer2() and OrthancPluginSetRootUri2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
24 #define HOUSEKEEPER_NAME "housekeeper" |
6ce05f8b5b13
deprecating OrthancPluginSetDescription2(), OrthancPluginExtendOrthancExplorer2() and OrthancPluginSetRootUri2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
25 |
4961 | 26 #include "../Common/OrthancPluginCppWrapper.h" |
5576
3a6d6d35193c
fix build of Housekeeper plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5573
diff
changeset
|
27 #include "../../../../OrthancFramework/Sources/Compatibility.h" |
4961 | 28 |
29 #include <boost/thread.hpp> | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
30 #include <boost/algorithm/string.hpp> |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
31 #include <boost/date_time/posix_time/posix_time.hpp> |
4991 | 32 #include <boost/date_time/special_defs.hpp> |
4961 | 33 #include <json/value.h> |
34 #include <json/writer.h> | |
35 #include <string.h> | |
36 #include <iostream> | |
37 #include <algorithm> | |
38 #include <map> | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
39 #include <list> |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
40 #include <time.h> |
4961 | 41 |
42 static int globalPropertyId_ = 0; | |
43 static bool force_ = false; | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
44 static unsigned int throttleDelay_ = 0; |
4961 | 45 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
|
46 static bool workerThreadShouldStop_ = false; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
47 static bool triggerOnStorageCompressionChange_ = true; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
48 static bool triggerOnMainDicomTagsChange_ = true; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
49 static bool triggerOnUnnecessaryDicomAsJsonFiles_ = true; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
50 static bool triggerOnIngestTranscodingChange_ = true; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
51 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
|
52 static std::string limitMainDicomTagsReconstructLevel_ = ""; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
53 static std::string limitToChange_ = ""; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
54 static std::string limitToUrl_ = ""; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
55 |
4979
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 struct RunningPeriod |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
58 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
59 int fromHour_; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
60 int toHour_; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
61 int weekday_; |
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 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
|
64 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
65 if (weekday == "Monday") |
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 weekday_ = 1; |
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 else if (weekday == "Tuesday") |
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 weekday_ = 2; |
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 else if (weekday == "Wednesday") |
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 weekday_ = 3; |
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 else if (weekday == "Thursday") |
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 weekday_ = 4; |
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 else if (weekday == "Friday") |
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 weekday_ = 5; |
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 else if (weekday == "Saturday") |
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 weekday_ = 6; |
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 else if (weekday == "Sunday") |
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 weekday_ = 0; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
92 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
93 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
94 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
95 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
|
96 ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
97 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
98 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
99 std::vector<std::string> hours; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
100 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
|
101 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
102 fromHour_ = boost::lexical_cast<int>(hours[0]); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
103 toHour_ = boost::lexical_cast<int>(hours[1]); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
104 } |
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 bool isInPeriod() const |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
107 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
108 time_t now = time(NULL); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
109 tm* nowLocalTime = localtime(&now); |
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 if (nowLocalTime->tm_wday != weekday_) |
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 return false; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
114 } |
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 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
|
117 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
118 return true; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
119 } |
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 return false; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
122 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
123 }; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
124 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
125 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
126 struct 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 std::list<RunningPeriod> runningPeriods_; |
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 void load(const Json::Value& scheduleConfiguration) |
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 // "Monday": ["0-6", "20-24"], |
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 Json::Value::Members names = scheduleConfiguration.getMemberNames(); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
135 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
136 for (Json::Value::Members::const_iterator it = names.begin(); |
5280 | 137 it != names.end(); ++it) |
4979
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 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
|
140 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
141 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
|
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 } |
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 bool isInPeriod() |
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 if (runningPeriods_.size() == 0) |
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 return true; // if no config: always run |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
151 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
152 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
153 for (std::list<RunningPeriod>::const_iterator it = runningPeriods_.begin(); |
5280 | 154 it != runningPeriods_.end(); ++it) |
4979
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 if (it->isInPeriod()) |
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 return true; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
159 } |
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 return false; |
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 }; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
164 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
165 RunningPeriods runningPeriods_; |
4961 | 166 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
167 |
4961 | 168 struct DbConfiguration |
169 { | |
170 std::string orthancVersion; | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
171 std::string patientsMainDicomTagsSignature; |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
172 std::string studiesMainDicomTagsSignature; |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
173 std::string seriesMainDicomTagsSignature; |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
174 std::string instancesMainDicomTagsSignature; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
175 std::string ingestTranscoding; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
176 std::string dicomWebVersion; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
177 bool storageCompressionEnabled; |
4961 | 178 |
179 DbConfiguration() | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
180 : storageCompressionEnabled(false) |
4961 | 181 { |
182 } | |
183 | |
184 bool IsDefined() const | |
185 { | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
186 return !orthancVersion.empty(); |
4961 | 187 } |
188 | |
189 void Clear() | |
190 { | |
191 orthancVersion.clear(); | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
192 patientsMainDicomTagsSignature.clear(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
193 studiesMainDicomTagsSignature.clear(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
194 seriesMainDicomTagsSignature.clear(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
195 instancesMainDicomTagsSignature.clear(); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
196 ingestTranscoding.clear(); |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
197 dicomWebVersion.clear(); |
4961 | 198 } |
199 | |
200 void ToJson(Json::Value& target) | |
201 { | |
202 if (!IsDefined()) | |
203 { | |
204 target = Json::nullValue; | |
205 } | |
206 else | |
207 { | |
208 Json::Value signatures; | |
209 | |
210 target = Json::objectValue; | |
211 | |
212 // 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
|
213 signatures["Patient"] = patientsMainDicomTagsSignature; |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
214 signatures["Study"] = studiesMainDicomTagsSignature; |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
215 signatures["Series"] = seriesMainDicomTagsSignature; |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
216 signatures["Instance"] = instancesMainDicomTagsSignature; |
4961 | 217 |
218 target["MainDicomTagsSignature"] = signatures; | |
219 target["OrthancVersion"] = orthancVersion; | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
220 target["StorageCompressionEnabled"] = storageCompressionEnabled; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
221 target["IngestTranscoding"] = ingestTranscoding; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
222 target["DicomWebVersion"] = dicomWebVersion; |
4961 | 223 } |
224 } | |
225 | |
226 void FromJson(Json::Value& source) | |
227 { | |
228 if (!source.isNull()) | |
229 { | |
230 orthancVersion = source["OrthancVersion"].asString(); | |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
231 if (source.isMember("DicomWebVersion")) |
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 dicomWebVersion = source["DicomWebVersion"].asString(); |
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 else |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
236 { |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
237 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
|
238 } |
4961 | 239 |
240 const Json::Value& signatures = source["MainDicomTagsSignature"]; | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
241 patientsMainDicomTagsSignature = signatures["Patient"].asString(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
242 studiesMainDicomTagsSignature = signatures["Study"].asString(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
243 seriesMainDicomTagsSignature = signatures["Series"].asString(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
244 instancesMainDicomTagsSignature = signatures["Instance"].asString(); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
245 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
246 storageCompressionEnabled = source["StorageCompressionEnabled"].asBool(); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
247 ingestTranscoding = source["IngestTranscoding"].asString(); |
4961 | 248 } |
249 } | |
250 }; | |
251 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
252 |
4961 | 253 struct PluginStatus |
254 { | |
255 int statusVersion; | |
256 int64_t lastProcessedChange; | |
257 int64_t lastChangeToProcess; | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
258 boost::posix_time::ptime lastTimeStarted; |
4961 | 259 |
260 DbConfiguration currentlyProcessingConfiguration; // last configuration being processed (has not reached last change yet) | |
261 DbConfiguration lastProcessedConfiguration; // last configuration that has been fully processed (till last change) | |
262 | |
263 PluginStatus() | |
264 : statusVersion(1), | |
265 lastProcessedChange(-1), | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
266 lastChangeToProcess(-1), |
4993 | 267 lastTimeStarted(boost::date_time::not_a_date_time) |
4961 | 268 { |
269 } | |
270 | |
271 void ToJson(Json::Value& target) | |
272 { | |
273 target = Json::objectValue; | |
274 | |
275 target["Version"] = statusVersion; | |
276 target["LastProcessedChange"] = Json::Value::Int64(lastProcessedChange); | |
277 target["LastChangeToProcess"] = Json::Value::Int64(lastChangeToProcess); | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
278 |
4993 | 279 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
|
280 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
281 target["LastTimeStarted"] = Json::Value::null; |
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 else |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
284 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
285 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
|
286 } |
4961 | 287 |
288 currentlyProcessingConfiguration.ToJson(target["CurrentlyProcessingConfiguration"]); | |
289 lastProcessedConfiguration.ToJson(target["LastProcessedConfiguration"]); | |
290 } | |
291 | |
292 void FromJson(Json::Value& source) | |
293 { | |
294 statusVersion = source["Version"].asInt(); | |
295 lastProcessedChange = source["LastProcessedChange"].asInt64(); | |
296 lastChangeToProcess = source["LastChangeToProcess"].asInt64(); | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
297 if (source["LastTimeStarted"].isNull()) |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
298 { |
4993 | 299 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
|
300 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
301 else |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
302 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
303 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
|
304 } |
4961 | 305 |
306 Json::Value& current = source["CurrentlyProcessingConfiguration"]; | |
307 Json::Value& last = source["LastProcessedConfiguration"]; | |
308 | |
309 currentlyProcessingConfiguration.FromJson(current); | |
310 lastProcessedConfiguration.FromJson(last); | |
311 } | |
312 }; | |
313 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
314 static PluginStatus pluginStatus_; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
315 static boost::recursive_mutex pluginStatusMutex_; |
4961 | 316 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
317 static void ReadStatusFromDb() |
4961 | 318 { |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
319 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
320 |
4961 | 321 OrthancPlugins::OrthancString globalPropertyContent; |
322 | |
323 globalPropertyContent.Assign(OrthancPluginGetGlobalProperty(OrthancPlugins::GetGlobalContext(), | |
324 globalPropertyId_, | |
325 "")); | |
326 | |
327 if (!globalPropertyContent.IsNullOrEmpty()) | |
328 { | |
329 Json::Value jsonStatus; | |
330 globalPropertyContent.ToJson(jsonStatus); | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
331 pluginStatus_.FromJson(jsonStatus); |
4961 | 332 } |
333 else | |
334 { | |
335 // default config | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
336 pluginStatus_.statusVersion = 1; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
337 pluginStatus_.lastProcessedChange = -1; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
338 pluginStatus_.lastChangeToProcess = -1; |
4993 | 339 pluginStatus_.lastTimeStarted = boost::date_time::not_a_date_time; |
4961 | 340 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
341 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
|
342 pluginStatus_.lastProcessedConfiguration.dicomWebVersion = "1.14"; // the first change that requires processing has been introduced between 1.14 & 1.15 |
4961 | 343 |
344 // 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
|
345 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
|
346 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
|
347 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
|
348 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 | 349 } |
350 } | |
351 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
352 static void SaveStatusInDb() |
4961 | 353 { |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
354 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
355 |
4961 | 356 Json::Value jsonStatus; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
357 pluginStatus_.ToJson(jsonStatus); |
4961 | 358 |
359 Json::StreamWriterBuilder builder; | |
360 builder.settings_["indentation"] = " "; | |
361 std::string serializedStatus = Json::writeString(builder, jsonStatus); | |
362 | |
363 OrthancPluginSetGlobalProperty(OrthancPlugins::GetGlobalContext(), | |
364 globalPropertyId_, | |
365 serializedStatus.c_str()); | |
366 } | |
367 | |
368 static void GetCurrentDbConfiguration(DbConfiguration& configuration) | |
369 { | |
370 Json::Value signatures; | |
371 Json::Value systemInfo; | |
372 | |
373 OrthancPlugins::RestApiGet(systemInfo, "/system", false); | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
374 configuration.patientsMainDicomTagsSignature = systemInfo["MainDicomTags"]["Patient"].asString(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
375 configuration.studiesMainDicomTagsSignature = systemInfo["MainDicomTags"]["Study"].asString(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
376 configuration.seriesMainDicomTagsSignature = systemInfo["MainDicomTags"]["Series"].asString(); |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
377 configuration.instancesMainDicomTagsSignature = systemInfo["MainDicomTags"]["Instance"].asString(); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
378 configuration.storageCompressionEnabled = systemInfo["StorageCompression"].asBool(); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
379 configuration.ingestTranscoding = systemInfo["IngestTranscoding"].asString(); |
4961 | 380 |
381 configuration.orthancVersion = OrthancPlugins::GetGlobalContext()->orthancVersion; | |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
382 |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
383 Json::Value pluginInfo; |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
384 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
|
385 { |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
386 configuration.dicomWebVersion = pluginInfo["Version"].asString(); |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
387 } |
4961 | 388 } |
389 | |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
390 static void CheckNeedsProcessing(bool& needsReconstruct, bool& needsReingest, bool& needsDicomWebCaching, const DbConfiguration& current, const DbConfiguration& last) |
4961 | 391 { |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
392 needsReconstruct = false; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
393 needsReingest = false; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
394 needsDicomWebCaching = false; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
395 |
4961 | 396 if (!last.IsDefined()) |
397 { | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
398 return; |
4961 | 399 } |
400 | |
401 const char* lastVersion = last.orthancVersion.c_str(); | |
402 | |
403 if (!OrthancPlugins::CheckMinimalVersion(lastVersion, 1, 9, 1)) | |
404 { | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
405 if (triggerOnUnnecessaryDicomAsJsonFiles_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
406 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
407 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
|
408 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
|
409 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
410 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
411 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
412 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
|
413 } |
4961 | 414 } |
415 | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
416 if (last.patientsMainDicomTagsSignature != current.patientsMainDicomTagsSignature) |
4961 | 417 { |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
418 if (triggerOnMainDicomTagsChange_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
419 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
420 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
|
421 needsReconstruct = true; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
422 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
423 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
424 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
425 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
|
426 } |
4961 | 427 } |
428 | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
429 if (last.studiesMainDicomTagsSignature != current.studiesMainDicomTagsSignature) |
4961 | 430 { |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
431 if (triggerOnMainDicomTagsChange_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
432 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
433 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
|
434 needsReconstruct = true; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
435 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
436 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
437 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
438 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
|
439 } |
4961 | 440 } |
441 | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
442 if (last.seriesMainDicomTagsSignature != current.seriesMainDicomTagsSignature) |
4961 | 443 { |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
444 if (triggerOnMainDicomTagsChange_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
445 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
446 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
|
447 needsReconstruct = true; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
448 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
449 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
450 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
451 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
|
452 } |
4961 | 453 } |
454 | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
455 if (last.instancesMainDicomTagsSignature != current.instancesMainDicomTagsSignature) |
4961 | 456 { |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
457 if (triggerOnMainDicomTagsChange_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
458 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
459 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
|
460 needsReconstruct = true; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
461 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
462 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
463 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
464 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
|
465 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
466 } |
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 (current.storageCompressionEnabled != last.storageCompressionEnabled) |
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 (triggerOnStorageCompressionChange_) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
471 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
472 if (current.storageCompressionEnabled) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
473 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
474 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
|
475 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
476 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
477 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
478 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
|
479 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
480 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
481 needsReingest = true; |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
482 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
483 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
484 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
485 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
|
486 } |
4961 | 487 } |
488 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
489 if (current.ingestTranscoding != last.ingestTranscoding) |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
490 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
491 if (triggerOnIngestTranscodingChange_) |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
492 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
493 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
|
494 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
495 needsReingest = true; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
496 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
497 else |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
498 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
499 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
|
500 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
501 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
502 |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
503 if (!current.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 (last.dicomWebVersion.empty()) |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
506 { |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
507 if (triggerOnDicomWebCacheChange_) |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
508 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
509 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
|
510 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
511 needsDicomWebCaching = triggerOnDicomWebCacheChange_; |
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 else |
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 const char* lastDicomWebVersion = last.dicomWebVersion.c_str(); |
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 (!OrthancPlugins::CheckMinimalVersion(lastDicomWebVersion, 1, 15, 0)) |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
518 { |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
519 if (triggerOnDicomWebCacheChange_) |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
520 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
521 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
|
522 needsDicomWebCaching = true; |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
523 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
524 else |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
525 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
526 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
|
527 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
528 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
529 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
530 } |
4961 | 531 } |
532 | |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
533 static bool ProcessChanges(bool needsReconstruct, bool needsReingest, bool needsDicomWebCaching, const DbConfiguration& currentDbConfiguration) |
4961 | 534 { |
535 Json::Value changes; | |
536 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
537 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
538 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
4961 | 539 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
540 pluginStatus_.currentlyProcessingConfiguration = currentDbConfiguration; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
541 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
542 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
|
543 } |
4961 | 544 |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
545 if (changes["Changes"].size() > 0) |
4961 | 546 { |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
547 for (Json::ArrayIndex i = 0; i < changes["Changes"].size(); i++) |
4961 | 548 { |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
549 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
|
550 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
|
551 |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
552 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
|
553 { |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
554 if (change["ChangeType"] == limitToChange_) |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
555 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
556 Json::Value result; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
557 Json::Value request; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
558 request["ReconstructFiles"] = false; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
559 request["LimitToThisLevelMainDicomTags"] = true; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
560 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
|
561 } |
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 else |
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 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
|
566 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
567 Json::Value result; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
568 |
5635
0e16e677fe64
fixed broken /instances/../tags after reconstructing studies when IngestTranscoding has changed
Alain Mazy <am@orthanc.team>
parents:
5576
diff
changeset
|
569 if (needsReconstruct || needsReingest) |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
570 { |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
571 Json::Value request; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
572 if (needsReingest) |
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 request["ReconstructFiles"] = true; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
575 } |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
576 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
|
577 } |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
578 |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
579 if (needsDicomWebCaching) |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
580 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
581 Json::Value request; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
582 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
|
583 } |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
584 } |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
585 } |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
586 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
587 { |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
588 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
|
589 |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
590 pluginStatus_.lastProcessedChange = seq; |
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 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
|
593 { |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
594 return true; |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
595 } |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
596 } |
5223
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 if (change["ChangeType"] == "NewStudy") |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
599 { |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
600 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
|
601 } |
4961 | 602 } |
5223
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 else |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
605 { |
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
606 // 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
|
607 if (changes["Done"].asBool()) |
4961 | 608 { |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
609 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
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 pluginStatus_.lastProcessedChange = changes["Last"].asInt64(); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
612 |
5223
a47b24f231d0
Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
613 return true; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
614 } |
4961 | 615 } |
616 | |
617 return false; | |
618 } | |
619 | |
620 | |
621 static void WorkerThread() | |
622 { | |
5452
8345267e8de5
Added OrthancPluginSetCurrentThreadName() in the plugin SDK
Alain Mazy <am@osimis.io>
parents:
5395
diff
changeset
|
623 OrthancPluginSetCurrentThreadName(OrthancPlugins::GetGlobalContext(), "HOUSEKEEPER"); |
8345267e8de5
Added OrthancPluginSetCurrentThreadName() in the plugin SDK
Alain Mazy <am@osimis.io>
parents:
5395
diff
changeset
|
624 |
4961 | 625 DbConfiguration currentDbConfiguration; |
626 | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
627 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), "Starting Housekeeper worker thread"); |
4961 | 628 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
629 ReadStatusFromDb(); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
630 |
4961 | 631 GetCurrentDbConfiguration(currentDbConfiguration); |
632 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
633 bool needsReconstruct = false; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
634 bool needsReingest = false; |
5009
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
635 bool needsFullProcessing = false; |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
636 bool needsProcessing = false; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
637 bool needsDicomWebCaching = false; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
638 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
639 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
640 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
|
641 |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
642 // compare with last full processed configuration |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
643 CheckNeedsProcessing(needsReconstruct, needsReingest, needsDicomWebCaching, currentDbConfiguration, pluginStatus_.lastProcessedConfiguration); |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
644 needsFullProcessing = needsReconstruct || needsReingest || needsDicomWebCaching; |
5009
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
645 needsProcessing = needsFullProcessing; |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
646 |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
647 // 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
|
648 if (pluginStatus_.currentlyProcessingConfiguration.IsDefined()) |
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 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
|
651 |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
652 bool needsReconstruct2 = false; |
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
653 bool needsReingest2 = false; |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
654 bool needsDicomWebCaching2 = false; |
5009
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
655 |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
656 CheckNeedsProcessing(needsReconstruct2, needsReingest2, needsDicomWebCaching2, currentDbConfiguration, pluginStatus_.currentlyProcessingConfiguration); |
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
657 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
|
658 } |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
659 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
660 |
5635
0e16e677fe64
fixed broken /instances/../tags after reconstructing studies when IngestTranscoding has changed
Alain Mazy <am@orthanc.team>
parents:
5576
diff
changeset
|
661 if (!needsProcessing && !force_) |
4961 | 662 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
663 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: everything has been processed already !"); |
4961 | 664 return; |
665 } | |
666 | |
5009
ed4ceb31bcf8
Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents:
4993
diff
changeset
|
667 if (force_ || needsFullProcessing) |
4961 | 668 { |
669 if (force_) | |
670 { | |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
671 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: forcing execution -> will perform housekeeping"); |
4961 | 672 } |
673 else | |
674 { | |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
675 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: the DB configuration has changed since last run, will reprocess the whole DB !"); |
4961 | 676 } |
677 | |
678 Json::Value changes; | |
679 OrthancPlugins::RestApiGet(changes, "/changes?last", false); | |
680 | |
4988
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 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
683 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
684 pluginStatus_.lastProcessedChange = 0; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
685 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
|
686 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
|
687 } |
4961 | 688 } |
689 else | |
690 { | |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
691 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: the DB configuration has not changed since last run, will continue processing changes"); |
4961 | 692 } |
693 | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
694 bool completed = false; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
695 { |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
696 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
697 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
|
698 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
699 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
700 bool loggedNotRightPeriodChangeMessage = false; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
701 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
702 while (!workerThreadShouldStop_ && !completed) |
4961 | 703 { |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
704 if (runningPeriods_.isInPeriod()) |
4961 | 705 { |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
706 completed = ProcessChanges(needsReconstruct, needsReingest, needsDicomWebCaching, currentDbConfiguration); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
707 SaveStatusInDb(); |
4961 | 708 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
709 if (!completed) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
710 { |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
711 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
712 |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
713 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
|
714 " / " + 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
|
715 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
716 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
|
717 } |
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 loggedNotRightPeriodChangeMessage = false; |
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 else |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
722 { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
723 if (!loggedNotRightPeriodChangeMessage) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
724 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
725 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
|
726 loggedNotRightPeriodChangeMessage = true; |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
727 } |
5395
c1037a755cee
housekeeper: added sleep when idle
Alain Mazy <am@osimis.io>
parents:
5376
diff
changeset
|
728 |
c1037a755cee
housekeeper: added sleep when idle
Alain Mazy <am@osimis.io>
parents:
5376
diff
changeset
|
729 boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); |
4961 | 730 } |
731 } | |
732 | |
733 if (completed) | |
734 { | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
735 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
736 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
737 pluginStatus_.lastProcessedConfiguration = currentDbConfiguration; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
738 pluginStatus_.currentlyProcessingConfiguration.Clear(); |
4961 | 739 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
740 pluginStatus_.lastProcessedChange = -1; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
741 pluginStatus_.lastChangeToProcess = -1; |
4961 | 742 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
743 SaveStatusInDb(); |
4961 | 744 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
745 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), "Housekeeper: finished processing all changes"); |
4961 | 746 } |
747 } | |
748 | |
749 extern "C" | |
750 { | |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
751 OrthancPluginErrorCode GetPluginStatus(OrthancPluginRestOutput* output, |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
752 const char* url, |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
753 const OrthancPluginHttpRequest* request) |
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 if (request->method != OrthancPluginHttpMethod_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 OrthancPlugins::AnswerMethodNotAllowed(output, "GET"); |
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 else |
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 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
762 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
763 Json::Value status; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
764 pluginStatus_.ToJson(status); |
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 OrthancPlugins::AnswerJson(status, output); |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
767 } |
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 return OrthancPluginErrorCode_Success; |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
770 } |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
771 |
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
772 |
4961 | 773 OrthancPluginErrorCode OnChangeCallback(OrthancPluginChangeType changeType, |
774 OrthancPluginResourceType resourceType, | |
775 const char* resourceId) | |
776 { | |
777 switch (changeType) | |
778 { | |
779 case OrthancPluginChangeType_OrthancStarted: | |
780 { | |
781 workerThread_.reset(new boost::thread(WorkerThread)); | |
782 return OrthancPluginErrorCode_Success; | |
783 } | |
784 case OrthancPluginChangeType_OrthancStopped: | |
785 { | |
786 if (workerThread_ && workerThread_->joinable()) | |
787 { | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
788 workerThreadShouldStop_ = true; |
4961 | 789 workerThread_->join(); |
790 } | |
791 } | |
792 default: | |
793 return OrthancPluginErrorCode_Success; | |
794 } | |
795 } | |
796 | |
797 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c) | |
798 { | |
5563 | 799 OrthancPlugins::SetGlobalContext(c, HOUSEKEEPER_NAME); |
4961 | 800 |
801 /* Check the version of the Orthanc core */ | |
802 if (OrthancPluginCheckVersion(c) == 0) | |
803 { | |
804 OrthancPlugins::ReportMinimalOrthancVersion(ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER, | |
805 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, | |
806 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); | |
807 return -1; | |
808 } | |
809 | |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
810 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
|
811 OrthancPluginSetDescription2(c, HOUSEKEEPER_NAME, "Optimizes your DB and storage."); |
4961 | 812 |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
813 OrthancPlugins::OrthancConfiguration orthancConfiguration; |
4961 | 814 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
815 OrthancPlugins::OrthancConfiguration housekeeper; |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
816 orthancConfiguration.GetSection(housekeeper, "Housekeeper"); |
4961 | 817 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
818 bool enabled = housekeeper.GetBooleanValue("Enable", false); |
4961 | 819 if (enabled) |
820 { | |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
821 /* |
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 "Housekeeper": { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
824 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
825 // Enables/disables the plugin |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
826 "Enable": false, |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
827 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
828 // 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
|
829 // 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
|
830 // another plugin |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
831 "GlobalPropertyId": 1025, |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
832 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
833 // 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
|
834 // any changes in configuration |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
835 "Force": false, |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
836 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
837 // 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
|
838 // This avoids overloading Orthanc with the housekeeping |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
839 // process and leaves room for other operations. |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
840 "ThrottleDelay": 5, |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
841 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
842 // 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
|
843 // 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
|
844 // Examples: |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
845 // 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
|
846 // 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
|
847 // "Schedule": { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
848 // "Monday": ["0-6", "20-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
849 // "Tuesday": ["0-6", "20-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
850 // "Wednesday": ["0-6", "20-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
851 // "Thursday": ["0-6", "20-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
852 // "Friday": ["0-6", "20-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
853 // "Saturday": ["0-24"], |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
854 // "Sunday": ["0-24"] |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
855 // }, |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
856 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
857 // 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
|
858 "Triggers" : { |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
859 "StorageCompressionChange": true, |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
860 "MainDicomTagsChange": true, |
5376
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
861 "UnnecessaryDicomAsJsonFiles": true, |
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
862 "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
|
863 }, |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
864 |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
865 // 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
|
866 // 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
|
867 "LimitMainDicomTagsReconstructLevel": "Study" |
4979
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 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
873 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
874 globalPropertyId_ = housekeeper.GetIntegerValue("GlobalPropertyId", 1025); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
875 force_ = housekeeper.GetBooleanValue("Force", false); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
876 throttleDelay_ = housekeeper.GetUnsignedIntegerValue("ThrottleDelay", 5); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
877 |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
878 if (housekeeper.GetJson().isMember("Triggers")) |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
879 { |
5376
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
880 OrthancPlugins::OrthancConfiguration triggers; |
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
881 housekeeper.GetSection(triggers, "Triggers"); |
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
882 triggerOnStorageCompressionChange_ = triggers.GetBooleanValue("StorageCompressionChange", true); |
4988
8fba26292a9f
Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
883 |
5376
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
884 triggerOnMainDicomTagsChange_ = triggers.GetBooleanValue("MainDicomTagsChange", true); |
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
885 triggerOnUnnecessaryDicomAsJsonFiles_ = triggers.GetBooleanValue("UnnecessaryDicomAsJsonFiles", true); |
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
886 triggerOnIngestTranscodingChange_ = triggers.GetBooleanValue("IngestTranscodingChange", true); |
4ab905749aed
fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents:
5375
diff
changeset
|
887 triggerOnDicomWebCacheChange_ = triggers.GetBooleanValue("DicomWebCacheChange", true); |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
888 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
889 |
5558
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
890 limitMainDicomTagsReconstructLevel_ = housekeeper.GetStringValue("LimitMainDicomTagsReconstructLevel", ""); |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
891 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
|
892 && limitMainDicomTagsReconstructLevel_ != "Series" && limitMainDicomTagsReconstructLevel_ != "Instance") |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
893 { |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
894 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
|
895 } |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
896 else if (limitMainDicomTagsReconstructLevel_ == "Patient") |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
897 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
898 limitToChange_ = "NewPatient"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
899 limitToUrl_ = "patients"; |
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 else if (limitMainDicomTagsReconstructLevel_ == "Study") |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
902 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
903 limitToChange_ = "NewStudy"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
904 limitToUrl_ = "studies"; |
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 else if (limitMainDicomTagsReconstructLevel_ == "Series") |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
907 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
908 limitToChange_ = "NewSeries"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
909 limitToUrl_ = "series"; |
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 else if (limitMainDicomTagsReconstructLevel_ == "Instance") |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
912 { |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
913 limitToChange_ = "NewInstance"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
914 limitToUrl_ = "instances"; |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
915 } |
c1ed59a5bdc2
new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents:
5538
diff
changeset
|
916 |
4979
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
917 if (housekeeper.GetJson().isMember("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 runningPeriods_.load(housekeeper.GetJson()["Schedule"]); |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
920 } |
f316413027fd
renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents:
4961
diff
changeset
|
921 |
4961 | 922 OrthancPluginRegisterOnChangeCallback(c, OnChangeCallback); |
5375
984300e70069
updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents:
5280
diff
changeset
|
923 OrthancPluginRegisterRestCallback(c, "/housekeeper/status", GetPluginStatus); // for backward compatiblity with version 1.11.0 |
5035 | 924 OrthancPluginRegisterRestCallback(c, "/plugins/housekeeper/status", GetPluginStatus); |
4961 | 925 } |
926 else | |
927 { | |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
928 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper plugin is disabled by the configuration file"); |
4961 | 929 } |
930 | |
931 return 0; | |
932 } | |
933 | |
934 | |
935 ORTHANC_PLUGINS_API void OrthancPluginFinalize() | |
936 { | |
5573
823aae1ea72a
removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5563
diff
changeset
|
937 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper plugin is finalizing"); |
4961 | 938 } |
939 | |
940 | |
941 ORTHANC_PLUGINS_API const char* OrthancPluginGetName() | |
942 { | |
5538
6ce05f8b5b13
deprecating OrthancPluginSetDescription2(), OrthancPluginExtendOrthancExplorer2() and OrthancPluginSetRootUri2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
943 return HOUSEKEEPER_NAME; |
4961 | 944 } |
945 | |
946 | |
947 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion() | |
948 { | |
4981 | 949 return HOUSEKEEPER_VERSION; |
4961 | 950 } |
951 } |