Mercurial > hg > orthanc-book
comparison Sphinx/source/plugins/housekeeper.rst @ 837:66ff2f30afcc
added new features from next upcoming Orthanc release
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 03 May 2022 15:09:54 +0200 |
parents | |
children | c29ac12e3160 |
comparison
equal
deleted
inserted
replaced
836:a9c35bf108fa | 837:66ff2f30afcc |
---|---|
1 .. _housekeeper-plugin: | |
2 | |
3 | |
4 Housekeeper plugin (not released yet) | |
5 ========================= | |
6 | |
7 This page describes the **official sample plugin** that performs | |
8 housekeeping in the Database and Storage. | |
9 | |
10 When changing some configuration or when upgrading Orthanc, it | |
11 might be usefull to perform housekeeping operations to optmize | |
12 the DB or clean/compress/uncompress the storage. This can happen e.g: | |
13 | |
14 * when changing the list of indexed :ref:`MainDicomTags <_main-dicom-tags>` | |
15 * when changing the ``StorageCompression`` configuration | |
16 * when changing the ``IngestTranscoding`` configuration | |
17 * to remove unnecessary attachments like the ``dicom-as-json`` that were | |
18 used in Orthanc prior to 1.9.1. | |
19 | |
20 Note that these housekeeping operations are not mandatory. Orthanc will | |
21 continue to work without these cleanups. However, running the plugin | |
22 might improve performances and storage usage. | |
23 | |
24 The plugin detects any configuration changes that can trigger a cleanup | |
25 and will start process the studies one by one (in the order they have | |
26 been ingested in Orthanc). If Orthanc is stopped and restarted, the plugin | |
27 will resume where it stopped. | |
28 | |
29 | |
30 Configuration | |
31 ------------- | |
32 | |
33 .. highlight:: json | |
34 | |
35 Here's a sample configuration section for this plugin with its default values:: | |
36 | |
37 { | |
38 "Housekeeper": { | |
39 | |
40 // Enables/disables the plugin | |
41 "Enable": false, | |
42 | |
43 // the Global Prooperty ID in which the plugin progress | |
44 // is stored. Must be > 1024 and must not be used by | |
45 // another plugin | |
46 "GlobalPropertyId": 1025, | |
47 | |
48 // Forces execution even if the plugin did not detect | |
49 // any changes in configuration | |
50 "Force": false, | |
51 | |
52 // Delay (in seconds) between reconstruction of 2 studies | |
53 // This avoids overloading Orthanc with the housekeeping | |
54 // process and leaves room for other operations. | |
55 "ThrottleDelay": 5, | |
56 | |
57 // Runs the plugin only at certain period of time. | |
58 // If not specified, the plugin runs all the time | |
59 // Examples: | |
60 // to run between 0AM and 6AM everyday + every night | |
61 // from 8PM to 12PM and 24h a day on the weekend: | |
62 // "Schedule": { | |
63 // "Monday": ["0-6", "20-24"], | |
64 // "Tuesday": ["0-6", "20-24"], | |
65 // "Wednesday": ["0-6", "20-24"], | |
66 // "Thursday": ["0-6", "20-24"], | |
67 // "Friday": ["0-6", "20-24"], | |
68 // "Saturday": ["0-24"], | |
69 // "Sunday": ["0-24"] | |
70 // }, | |
71 | |
72 // configure events that can trigger a housekeeping processing | |
73 "Triggers" : { | |
74 "StorageCompressionChange": true, | |
75 "MainDicomTagsChange": true, | |
76 "UnnecessaryDicomAsJsonFiles": true, | |
77 "IngestTranscodingChange": true | |
78 } | |
79 } | |
80 } | |
81 | |
82 Scheduling/throttling | |
83 --------------------- | |
84 | |
85 Processing a whole database/storage might take a very long time (days, weeks | |
86 or even months) and can be I/O & CPU intensive. Therefore, the configuration offers | |
87 options to schedule and/or throttle the housekeeping operations. E.g, you can | |
88 run only the plugin during the night and week-end and, you can introduce a delay | |
89 between each processed study. | |
90 | |
91 Triggers & internals | |
92 -------------------- | |
93 | |
94 By default, all triggers are enabled. Depending on the detected change, | |
95 various operations will happen: | |
96 | |
97 * if ``MainDicomTagsChange`` or ``UnnecessaryDicomAsJsonFiles`` is triggered, | |
98 the plugin will call the ``/studies/.../reconstruct`` route on every study | |
99 one by one. Orthanc will read the DICOM tags from the DICOM files again and update | |
100 their value in the DB. | |
101 | |
102 * if any other change is detected, the plugin will again call the ``reconstruct`` route | |
103 but, this time, with the ``ReconstructFiles`` option enabled. Orthanc will then, | |
104 read the DICOM file from the storage, compress/uncompress/transcode it and it will | |
105 save it again to disk. The new file will be stored using the new Storage settings | |
106 (``StorageCompression`` and ``IngestTranscoding``). | |
107 Note that, Orthanc will create a new ``Attachment`` that will be saved at a different | |
108 place as the previous one. | |
109 | |
110 | |
111 Status | |
112 ------ | |
113 | |
114 You can get a progress status of the plugin by calling the ``/housekeeper/status`` API route. | |
115 | |
116 | |
117 Compilation | |
118 ----------- | |
119 | |
120 This plugin is part of the Orthanc core repository and is included in the Orthanc makefile. | |
121 It is compiled with Orthanc itself and is distributed together with Orthanc binaries. | |
122 | |
123 | |
124 |