|
21 | 21 | ;; helpers |
22 | 22 |
|
23 | 23 | (defn bulk-index-msg-general |
24 | | - "Message to return when indexing" |
| 24 | + "General Message to return when indexing, will format message according to this logging standard." |
25 | 25 | [msg] |
26 | 26 | (str msg/bulk-index-prefix-general msg)) |
27 | 27 |
|
28 | | -(defn bulk-index-queue-msg |
29 | | - "Message to return when indexing all providers from the SQS queue, not from the channels." |
30 | | - [msg] |
31 | | - (str bulk-index-prefix-queue msg)) |
| 28 | +;; ***************************************************************************80 |
| 29 | +;; called in data/bulk_index.clj |
32 | 30 |
|
33 | | -(defn bulk-index-channel-load-msg |
34 | | - "Message to return when indexing all providers from the core.async channels, during channel load." |
35 | | - [msg] |
36 | | - (str bulk-index-prefix-channel-load msg)) |
| 31 | +;; ***********************************40 |
| 32 | +;; channel read messages from handle-bulk-index-requests |
37 | 33 |
|
38 | | -(defn bulk-index-channel-read-msg |
39 | | - "Message to return when indexing all providers from the core.async channels, not from the SQS queue." |
40 | | - [msg] |
41 | | - (str bulk-index-prefix-channel-read msg)) |
| 34 | +(defn index-granules-for-collection-start |
| 35 | + [collection-id] |
| 36 | + (format "%s Indexing granule data for collection [%s]." bulk-index-prefix-channel-read collection-id)) |
42 | 37 |
|
43 | | -;; ***************************************************************************80 |
44 | | -;; called in data/bulk_index.clj |
| 38 | +(defn index-granules-for-collection-indexed |
| 39 | + [num-granules provider-id collection-id] |
| 40 | + (format "%s Indexed %d granule(s) for provider [%s] collection [%s]." |
| 41 | + bulk-index-prefix-channel-read |
| 42 | + num-granules |
| 43 | + provider-id |
| 44 | + collection-id)) |
| 45 | + |
| 46 | +(defn index-system-concepts |
| 47 | + [total] |
| 48 | + (format "%s Indexed %d system concepts." bulk-index-prefix-channel-read total)) |
| 49 | + |
| 50 | +(defn delete-concepts-by-id |
| 51 | + [total] |
| 52 | + (format "%s Deleted %d concepts." bulk-index-prefix-channel-read total)) |
| 53 | + |
| 54 | +(defn index-concepts-by-id |
| 55 | + [total] |
| 56 | + (format "%s Indexed %d concepts." bulk-index-prefix-channel-read total)) |
| 57 | + |
| 58 | +(defn migrate-index-start |
| 59 | + [source-index target-index elastic-name] |
| 60 | + (format "%s Migrating from index [%s] to index [%s] in es cluster [%s]" |
| 61 | + bulk-index-prefix-channel-read |
| 62 | + source-index |
| 63 | + target-index |
| 64 | + elastic-name)) |
| 65 | + |
| 66 | +(defn migrate-index-error |
| 67 | + [source-index target-index reason] |
| 68 | + (format "%s Migration from [%s] to [%s] failed: %s" |
| 69 | + bulk-index-prefix-channel-read |
| 70 | + source-index |
| 71 | + target-index |
| 72 | + reason)) |
| 73 | + |
| 74 | +;; ***********************************40 |
| 75 | +;; queue functions |
45 | 76 |
|
46 | 77 | (defn index-provider-data-later-than-date-time |
47 | 78 | [date-time provider-id] |
48 | | - (bulk-index-queue-msg |
49 | | - (format "Indexing concepts with revision-date later than [%s] for provider [%s] started." |
50 | | - date-time |
51 | | - provider-id))) |
| 79 | + (format "%s Indexing concepts with revision-date later than [%s] for provider [%s] started." |
| 80 | + bulk-index-prefix-queue |
| 81 | + date-time |
| 82 | + provider-id)) |
52 | 83 |
|
53 | 84 | (defn index-provider-data-later-than-date-time-sys-concepts |
54 | 85 | [num-indexed] |
55 | | - (bulk-index-queue-msg (format "Indexed %d system concepts." num-indexed))) |
| 86 | + (format "%s Indexed %d system concepts." bulk-index-prefix-queue num-indexed)) |
56 | 87 |
|
57 | 88 | (defn index-provider-data-later-than-date-post |
58 | 89 | [provider-concept-count] |
59 | | - (bulk-index-queue-msg (format "Indexed %d provider concepts." provider-concept-count))) |
| 90 | + (format "%s Indexed %d provider concepts." bulk-index-prefix-queue provider-concept-count)) |
60 | 91 |
|
61 | 92 | (defn index-provider-data-later-than-date-time-completed |
62 | 93 | [date-time provider-id] |
63 | | - (bulk-index-queue-msg |
64 | | - (format "Indexing concepts with revision-date later than [%s] for provider [%s] completed." |
65 | | - date-time |
66 | | - provider-id))) |
| 94 | + (format "%s Indexing concepts with revision-date later than [%s] for provider [%s] completed." |
| 95 | + bulk-index-prefix-queue |
| 96 | + date-time |
| 97 | + provider-id)) |
67 | 98 |
|
68 | 99 | (defn index-provider-data-later-than-date-time-failed |
69 | | - [date-time provider-id] |
70 | | - (bulk-index-queue-msg |
71 | | - (format "Indexing concepts with revision-date later than [%s] for provider [%s] failed!" |
72 | | - date-time |
73 | | - provider-id))) |
| 100 | + [date-time provider-id reason] |
| 101 | + (format |
| 102 | + "%s Indexing concepts with revision-date later than [%s] for provider [%s] completed but failed because << %s >>!" |
| 103 | + bulk-index-prefix-queue |
| 104 | + date-time |
| 105 | + provider-id |
| 106 | + reason)) |
74 | 107 |
|
75 | 108 | (defn index-concepts-by-provider-start |
76 | | - [concept-type provider-id] |
77 | | - (bulk-index-queue-msg (format "Indexing %ss for provider %s" concept-type provider-id))) |
| 109 | + [concept-type provider-id] |
| 110 | + (format "%s Indexing %ss for provider %s" bulk-index-prefix-queue concept-type provider-id)) |
78 | 111 |
|
79 | 112 | (defn index-concepts-by-provider-completed |
80 | 113 | [concept-type provider-id num-concepts] |
81 | | - (bulk-index-queue-msg |
82 | | - (format "Indexed %d %s(s) for provider %s." num-concepts concept-type provider-id))) |
| 114 | + (format "%s Indexed %d %s(s) for provider %s." |
| 115 | + bulk-index-prefix-queue |
| 116 | + num-concepts |
| 117 | + concept-type |
| 118 | + provider-id)) |
83 | 119 |
|
84 | 120 | (defn index-all-concepts-start |
85 | 121 | [concept-type] |
86 | | - (bulk-index-queue-msg (format "Indexing all %ss" concept-type))) |
| 122 | + (format "%s Indexing all %ss" bulk-index-prefix-queue concept-type)) |
87 | 123 |
|
88 | 124 | (defn index-all-concepts-complete |
89 | 125 | [concept-type] |
90 | | - (bulk-index-queue-msg (format "Indexing of all %ss completed." concept-type))) |
| 126 | + (format "%s Indexing of all %ss completed." bulk-index-prefix-queue concept-type)) |
91 | 127 |
|
92 | 128 | (defn fetch-and-index-new-concepts-batches-before |
93 | 129 | [provider concept-type params] |
94 | | - (bulk-index-queue-msg |
95 | | - (format "About to fetch %s concepts in batches for [%s] with options %s." |
96 | | - concept-type |
97 | | - provider |
98 | | - (pr-str params)))) |
| 130 | + (format "%s About to fetch %s concepts in batches for [%s] with options %s." |
| 131 | + bulk-index-prefix-queue |
| 132 | + concept-type |
| 133 | + provider |
| 134 | + (pr-str params))) |
99 | 135 |
|
100 | 136 | (defn fetch-and-index-new-concepts-batches-after |
101 | 137 | [provider concept-type count-of-items] |
102 | | - (bulk-index-queue-msg |
103 | | - (format "Finished finding all (%d) %s concepts for provider [%s] in db for fetch and index new concepts." |
104 | | - count-of-items |
105 | | - concept-type |
106 | | - provider))) |
| 138 | + (format |
| 139 | + "%s Finished finding all (%d) %s concepts for provider [%s] in db for fetch and index new concepts." |
| 140 | + bulk-index-prefix-queue |
| 141 | + count-of-items |
| 142 | + concept-type |
| 143 | + provider)) |
107 | 144 |
|
108 | 145 | ;; ***************************************************************************80 |
109 | 146 | ;; called in bootstrap_service.clj |
110 | 147 |
|
111 | 148 | (defn index-all-providers-start |
112 | 149 | [] |
113 | 150 | ;; added the word started to the log message, check splunk reports |
114 | | - (bulk-index-channel-load-msg "Indexing all providers started.")) |
| 151 | + (format "%s Indexing all providers started." bulk-index-prefix-queue)) |
115 | 152 |
|
116 | 153 | (defn index-all-providers-loop |
117 | 154 | [provider-id] |
118 | | - (bulk-index-channel-load-msg |
119 | | - (format "Processing provider [%s] for bulk indexing" provider-id))) |
| 155 | + (format "%s Processing provider [%s] for bulk indexing" bulk-index-prefix-queue provider-id)) |
120 | 156 |
|
121 | 157 | (defn index-all-providers-complete |
122 | 158 | [] |
123 | | - (bulk-index-channel-load-msg "Indexing of all providers scheduled/completed.")) |
| 159 | + (format "%s Indexing of all providers scheduled/completed." bulk-index-prefix-queue)) |
124 | 160 |
|
125 | 161 | ;; ***************************************************************************80 |
126 | 162 | ;; called in fingerprint.clj |
127 | 163 |
|
128 | 164 | (defn fingerprint-updating |
129 | 165 | [provider] |
130 | | - (bulk-index-queue-msg (format "Updating fingerprints for provider [%s]" provider))) |
| 166 | + (format "%s Updating fingerprints for provider [%s]." bulk-index-prefix-queue provider)) |
131 | 167 |
|
132 | 168 | (defn fingerprint-variables |
133 | 169 | [variable-count provider] |
134 | | - (bulk-index-queue-msg |
135 | | - (format "Updated fingerprints of %d variable(s) for provider %s" variable-count provider))) |
| 170 | + (format "%s Updated fingerprints of %d variable(s) for provider %s." |
| 171 | + bulk-index-prefix-queue |
| 172 | + variable-count |
| 173 | + provider)) |
136 | 174 |
|
137 | 175 | (defn fingerprint-complete |
138 | 176 | [provider] |
139 | | - (bulk-index-queue-msg (format "Updating fingerprints for provider %s completed." provider))) |
| 177 | + (format "%s Updating fingerprints for provider %s completed." bulk-index-prefix-queue provider)) |
140 | 178 |
|
141 | 179 | (defn fingerprint-all-updating |
142 | 180 | [] |
143 | | - (bulk-index-queue-msg "Updating fingerprints for all variables.")) |
| 181 | + (format "%s Updating fingerprints for all variables." bulk-index-prefix-queue)) |
144 | 182 |
|
145 | 183 | (defn fingerprint-all-complete |
146 | 184 | [] |
147 | | - (bulk-index-queue-msg "Updating fingerprints for all variables completed.")) |
| 185 | + (format "%s Updating fingerprints for all variables completed." bulk-index-prefix-queue)) |
148 | 186 |
|
149 | 187 | ;; ***************************************************************************80 |
150 | 188 | ;; data/message_queue.clj |
151 | 189 |
|
152 | 190 | (defn publish-bootstrap-provider-event |
153 | 191 | [message] |
154 | | - (bulk-index-queue-msg (format "Publishing bootstrap message: %s" message))) |
| 192 | + (format "%sPublishing bootstrap message: %s" bulk-index-prefix-queue message)) |
155 | 193 |
|
156 | 194 | ;; ***************************************************************************80 |
157 | | -;; async.clj |
| 195 | +;; async.clj - puts items into the channels |
158 | 196 |
|
159 | 197 | (defn async-not-implemented |
160 | 198 | [action] |
161 | | - (bulk-index-channel-load-msg (format "Async Dispatcher does not support %s action." action))) |
| 199 | + (format "%s Async Dispatcher does not support %s action." bulk-index-prefix-channel-load action)) |
162 | 200 |
|
163 | 201 | (defn async-migrate-provider |
164 | 202 | [provider-id] |
165 | | - (bulk-index-channel-load-msg (format "Adding provider %s to provider channel" provider-id))) |
| 203 | + (format "%s Adding provider %s to provider channel." bulk-index-prefix-channel-load provider-id)) |
166 | 204 |
|
167 | 205 | (defn async-migrate-collection |
168 | 206 | [provider-id collection-id] |
169 | | - (bulk-index-channel-load-msg |
170 | | - (format "Adding collection %s for provider %s to collection channel" collection-id provider-id))) |
| 207 | + (format "%s Adding collection %s for provider %s to collection channel." |
| 208 | + bulk-index-prefix-channel-load |
| 209 | + collection-id |
| 210 | + provider-id)) |
171 | 211 |
|
172 | 212 | (defn async-index-provider |
173 | 213 | [provider-id start-index] |
174 | 214 | ;; Added start index to log message, check splunk reports |
175 | | - (bulk-index-channel-load-msg |
176 | | - (format "Adding provider %s to index channel starting at %d" provider-id start-index))) |
| 215 | + (format "%s Adding provider %s to index channel starting at %d." |
| 216 | + bulk-index-prefix-channel-load provider-id start-index)) |
177 | 217 |
|
178 | 218 | (defn async-index-collection |
179 | 219 | [collection-id provider-id] |
180 | | - ;; Added provider-id to log message, check splunk reports |
181 | | - (bulk-index-channel-load-msg |
182 | | - (format "Adding collection %s to collection index channel to provider %s" |
183 | | - collection-id |
184 | | - provider-id))) |
| 220 | + ;; Added provider-id to log message, check splunk reports |
| 221 | + (format "%s Adding collection %s to collection index channel to provider %s." |
| 222 | + bulk-index-prefix-channel-load |
| 223 | + collection-id |
| 224 | + provider-id)) |
185 | 225 |
|
186 | 226 | (defn async-index-system-concepts |
187 | 227 | [start-index] |
188 | | - (bulk-index-channel-load-msg |
189 | | - ;; added start index to log message, check splunk reports |
190 | | - (format "Adding bulk index request to system concepts channel with start-index %s." |
191 | | - start-index))) |
| 228 | + ;; added start index to log message, check splunk reports |
| 229 | + (format "%s Adding bulk index request to system concepts channel with start-index %s." |
| 230 | + bulk-index-prefix-channel-load |
| 231 | + start-index)) |
192 | 232 |
|
193 | 233 | (defn async-index-concepts-by-id |
194 | 234 | [provider-id concept-type concept-ids] |
195 | | - (bulk-index-channel-load-msg |
196 | | - ;; added concept details to log message, check splunk reports |
197 | | - (format "Adding bulk index request to concept-id channel for provider %s, concept-type %s, concept-ids %s..." |
198 | | - provider-id |
199 | | - concept-type |
200 | | - (pr-str (take 10 concept-ids))))) |
| 235 | + ;; added concept details to log message, check splunk reports |
| 236 | + (format "%s Adding bulk index request to concept-id channel for provider %s, concept-type %s, concept-ids %s..." |
| 237 | + bulk-index-prefix-channel-load |
| 238 | + provider-id |
| 239 | + concept-type |
| 240 | + (pr-str (take 10 concept-ids)))) |
201 | 241 |
|
202 | 242 | (defn async-migrate-index |
203 | 243 | [source-index target-index elastic-name] |
204 | | - (bulk-index-channel-load-msg |
205 | | - ;; added elastic name, check splunk reports |
206 | | - (format "Migrating from index [%s] to index [%s] in [%s]" |
207 | | - source-index |
208 | | - target-index |
209 | | - elastic-name))) |
| 244 | + ;; added elastic name, check splunk reports |
| 245 | + (format "%s Migrating from index [%s] to index [%s] in [%s]." |
| 246 | + bulk-index-prefix-channel-load |
| 247 | + source-index |
| 248 | + target-index |
| 249 | + elastic-name)) |
210 | 250 |
|
211 | 251 | (defn async-delete-concepts-from-index-by-id |
212 | 252 | [provider-id concept-type concept-ids] |
213 | 253 | ;; added concept details to log message, check splunk reports |
214 | | - (bulk-index-channel-load-msg |
215 | | - (format "Adding bulk delete request to concept-id channel. %s %s %s..." |
216 | | - provider-id |
217 | | - concept-type |
218 | | - (pr-str (take 10 concept-ids))))) |
| 254 | + (format "%s Adding bulk delete request to concept-id channel. %s %s %s..." |
| 255 | + bulk-index-prefix-channel-load |
| 256 | + provider-id |
| 257 | + concept-type |
| 258 | + (pr-str (take 10 concept-ids)))) |
219 | 259 |
|
220 | 260 | (defn async-bootstrap-virtual-products |
221 | 261 | [provider-id entry-title] |
222 | 262 | ;; added provider id and entry title to log message, check splunk reports |
223 | | - (bulk-index-channel-load-msg |
224 | | - (format "Adding message to virtual products channel. %s %s" provider-id entry-title))) |
| 263 | + (format "%s Adding message to virtual products channel. %s %s." |
| 264 | + bulk-index-prefix-channel-load |
| 265 | + provider-id |
| 266 | + entry-title)) |
0 commit comments