Changeset 3136
- Timestamp:
- 07/12/13 14:27:22 (11 years ago)
- Location:
- vlo/trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/trunk/pom.xml
r2976 r3136 16 16 in each module's pom.xml 17 17 --> 18 <version>2.1 4</version>18 <version>2.15</version> 19 19 20 20 <description>Virtual Language Observatory (VLO) parent project</description> -
vlo/trunk/vlo_importer/pom.xml
r2977 r3136 12 12 <packaging>jar</packaging> 13 13 14 <version>2.1 4</version>14 <version>2.15</version> 15 15 <name>vlo_importer</name> 16 16 <description></description> -
vlo/trunk/vlo_importer/src/main/bin/vlo_solr_importer.sh
r2992 r3136 24 24 # take preference over a specification as a property. 25 25 26 $JAVA -Xmx1024M -cp .:vlo_importer-2.1 4-importer.jar eu.clarin.cmdi.vlo.importer.MetadataImporter26 $JAVA -Xmx1024M -cp .:vlo_importer-2.15-importer.jar eu.clarin.cmdi.vlo.importer.MetadataImporter -
vlo/trunk/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/config/VloConfig.java
r2826 r3136 162 162 163 163 @Element 164 private static int maxOnHeap = 0; 164 private static int maxDocsInList = 0; 165 166 @Element 167 private static int maxDocsInSolrQueue = 0; 168 169 @Element 170 private static int solrTimeOut = 0; 165 171 166 172 @Element … … 260 266 261 267 /** 262 * Get the value of the maxOnHeap parameter<br><br> 263 * 264 * For a description of the parameter, refer to the general VLO 265 * documentation. 266 * 267 * @return the value 268 */ 269 public static int getMaxOnHeap (){ 270 return maxOnHeap; 271 } 272 273 /** 274 * Set the value of the maxOnHeap parameter<br><br> 275 * 276 * For a description of the parameter, refer to the general VLO 277 * documentation. 278 * 279 * @param param the value 280 */ 281 public static void setMaxOnHeap (int param){ 282 maxOnHeap = param; 268 * Get the value of the maxDocsInList parameter<br><br> 269 * 270 * The value of the parameter indicates the number of documents the importer 271 * stores in a list before sending them to the queue associated with the 272 * SOLR server. 273 * 274 * @return the value 275 */ 276 public static int getMaxDocsInList (){ 277 return maxDocsInList; 278 } 279 280 /** 281 * Set the value of the maxDocsInList parameter<br><br> 282 * 283 * The value of the parameter indicates the number of documents the importer 284 * stores in a list before sending them to the queue associated with the 285 * SOLR server. 286 * 287 * @param param the value 288 */ 289 public static void setMaxDocsInList (int param){ 290 maxDocsInList = param; 291 } 292 293 /** 294 * Get the value of the maxDocsSolrQueue parameter<br><br> 295 * 296 * The value of the parameter indicates the number of documents in the 297 * SOLR server queue before the threads associated with the server start 298 * emptying the queue. 299 * 300 * @return the value 301 */ 302 public static int getDocsSolrQueue (){ 303 return maxDocsInSolrQueue; 304 } 305 306 /** 307 * Set the value of the maxDocsSolrQueue parameter<br><br> 308 * 309 * The value of the parameter indicates the number of documents in the 310 * SOLR server queue before the threads associated with the server start 311 * emptying the queue. 312 * 313 * @param param the value 314 */ 315 public static void setDocsSolrQueue (int param){ 316 maxDocsInSolrQueue = param; 317 } 318 319 /** 320 * Get the value of the solrTimeOut parameter<br><br> 321 * 322 * The value of the parameter indicates the interval during which the 323 * importer will try to reach the SOLR server. Values are incremented 324 * 1, 2, 4, 8, ... 325 * 326 * @return the value 327 */ 328 public static int getSolrTimeOut (){ 329 return solrTimeOut; 330 } 331 332 /** 333 * Set the value of the solrTimeOut parameter<br><br> 334 * 335 * The value of the parameter indicates the interval during which the 336 * importer will try to reach the SOLR server. Values are incremented 337 * 1, 2, 4, 8, ... 338 * 339 * @param param the value 340 */ 341 public static void setSolrTimeOut (int param){ 342 solrTimeOut = param; 283 343 } 284 344 … … 298 358 * Set the value of the useMaxFileSize parameter<br><br> 299 359 * 300 * For a description of the parameter, refer to the general VLO 301 * documentation. 360 * If true, the importer will reject meta data files whose size exceeds 361 * the value indicated by the maxFileSize parameter. If false, none of 362 * the files encountered will be rejected because of their size. 302 363 * 303 364 * @param param the value … … 310 371 * Get the value of the maxFileSize parameter<br><br> 311 372 * 312 * For a description of the parameter, refer to the general VLO313 * documentation.373 * If the useMaxFileSize parameter equals true, maxFileSize is the upper 374 * limit to the size of meta data files that the importer will consider. 314 375 * 315 376 * @return the value … … 322 383 * Set the value of the maxFileSize parameter<br><br> 323 384 * 324 * For a description of the parameter, refer to the general VLO325 * documentation.385 * If the useMaxFileSize parameter equals true, maxFileSize is the upper 386 * limit to the size of meta data files that the importer will consider. 326 387 * 327 388 * @param param the value … … 334 395 * Get the value of the useHandleResolver parameter<br><br> 335 396 * 336 * For a description of the parameter, refer to the general VLO337 * documentation.397 * The parameter can be used to reject meta data files that exceed some 398 * maximum size. 338 399 * 339 400 * @return the value -
vlo/trunk/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java
r3025 r3136 213 213 String solrUrl = VloConfig.getSolrUrl(); 214 214 LOG.info("Initializing Solr Server on " + solrUrl); 215 solrServer = new StreamingUpdateSolrServer(solrUrl, 1000, 2) {215 solrServer = new StreamingUpdateSolrServer(solrUrl, VloConfig.getMaxDocsInList(), 2) { 216 216 @Override 217 217 public void handleError(Throwable ex) { … … 322 322 addResourceData(solrDocument, cmdiData); 323 323 docs.add(solrDocument); 324 if (docs.size() == VloConfig.getMax OnHeap()) {324 if (docs.size() == VloConfig.getMaxDocsInList()) { 325 325 sendDocs(); 326 326 } … … 358 358 } 359 359 } 360 361 /** 362 * Send current list of SolrImputDocuments to SolrServer and clears list 363 * afterwards 360 361 /** 362 * Send the list of documents prepared to the solr server 364 363 * 365 364 * @throws SolrServerException … … 367 366 */ 368 367 protected void sendDocs() throws SolrServerException, IOException { 369 LOG.info("Sending " + docs.size() + " docs to solr server. Total number of docs updated till now: " + nrOFDocumentsUpdated); 368 int wait = 0; 369 boolean done = false; 370 371 LOG.info("Sending " + docs.size() + 372 " docs to solr server queue. Total number of docs updated till now: " 373 + nrOFDocumentsUpdated); 374 370 375 nrOFDocumentsUpdated += docs.size(); 371 solrServer.add(docs); 372 if (serverError != null) { 376 // add the documents in the list to the solr queue 377 while (! done){ 378 solrServer.add(docs); 379 done = (serverError == null) && (wait <= 120); 380 } 381 382 // turn wait into vlo parameter 383 384 if (done) { 385 // the documents are in the queue now, create a new empty list 386 docs = new ArrayList<SolrInputDocument>(); 387 } else { 388 if (wait > 120) { 389 // timeout 390 LOG.error("Timeout sending list of documents to solr queue"); 391 } 373 392 throw new SolrServerException(serverError); 374 393 } 375 docs = new ArrayList<SolrInputDocument>();376 394 } 377 395 -
vlo/trunk/vlo_importer/src/main/resources/VloConfig.xml
r2841 r3136 3 3 <deleteAllFirst>true</deleteAllFirst> 4 4 5 <maxOnHeap>128</maxOnHeap> 5 <maxDocsInList>128</maxDocsInList> 6 7 <maxDocsInSolrQueue>128</maxDocsInSolrQueue> 8 9 <solrTimeOut>300</solrTimeOut> 6 10 7 11 <useMaxFileSize>true</useMaxFileSize> -
vlo/trunk/vlo_importer/src/main/resources/log4j.properties
r2768 r3136 1 1 log4j.appender.Stdout=org.apache.log4j.ConsoleAppender 2 2 log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout 3 log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n 4 5 log4j.rootLogger=INFO,Stdout 6 7 log4j.logger.org.apache.wicket=INFO 8 log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO 9 log4j.logger.org.apache.wicket.version=INFO 10 log4j.logger.org.apache.wicket.RequestCycle=INFO 3 log4j.appender.Stdout.layout.conversionPattern=%d %p [%c{1}#%M:%L] - %m%n\n 11 4 12 5 6 log4j.appender.Stdout.encoding=UTF-8 7 log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout 8 log4j.appender.ROOT=org.apache.log4j.DailyRollingFileAppender 9 log4j.appender.ROOT.File=vlo-importer.log 10 log4j.rootLogger=INFO, ROOT 11 log4j.logger.org.springframework=ERROR 12 log4j.logger.org.apache.solr.client.solrj.impl.StreamingUpdateSolrServer=ERROR -
vlo/trunk/vlo_importer/src/test/java/eu/clarin/cmdi/vlo/config/VloConfigTest.java
r2841 r3136 88 88 89 89 /** 90 * Test the getMax OnHeapmethod91 */ 92 @Test 93 public void testGetMax OnHeap() {94 95 System.out.println("getMax OnHeap");90 * Test the getMaxDocsInList method 91 */ 92 @Test 93 public void testGetMaxDocsInList() { 94 95 System.out.println("getMaxDocsInList"); 96 96 97 97 int expResult = 128; 98 int result = VloConfig.getMax OnHeap();99 100 assertEquals(expResult, result); 101 } 102 103 /** 104 * Test the setMax OnHeapmethod105 */ 106 @Test 107 public void testSetMax OnHeap() {108 109 System.out.println("setMax OnHeap");98 int result = VloConfig.getMaxDocsInList(); 99 100 assertEquals(expResult, result); 101 } 102 103 /** 104 * Test the setMaxDocsInList method 105 */ 106 @Test 107 public void testSetMaxDocsInList() { 108 109 System.out.println("setMaxDocsInList"); 110 110 111 111 int param = 1000; 112 112 113 VloConfig.setMaxOnHeap(param); 114 115 int result = VloConfig.getMaxOnHeap(); 113 VloConfig.setMaxDocsInList(param); 114 115 int result = VloConfig.getMaxDocsInList(); 116 117 assertEquals(param, result); 118 } 119 120 /** 121 * Test the getMaxDocsInSolrQueue method 122 */ 123 @Test 124 public void testGetMaxDocsInSolrQueue() { 125 126 System.out.println("getMaxDocsInSolrQueue"); 127 128 int expResult = 128; 129 int result = VloConfig.getMaxDocsInList(); 130 131 assertEquals(expResult, result); 132 } 133 134 /** 135 * Test the setMaxDocsInSolrQueue method 136 */ 137 @Test 138 public void testSetMaxDocsInSolrQueue() { 139 140 System.out.println("setMaxDocsInSolrQueue"); 141 142 int param = 1000; 143 144 VloConfig.setMaxDocsInList(param); 145 146 int result = VloConfig.getMaxDocsInList(); 116 147 117 148 assertEquals(param, result); -
vlo/trunk/vlo_web_app/pom.xml
r3023 r3136 12 12 <artifactId>vlo_web_app</artifactId> 13 13 14 <version>2.1 4</version>14 <version>2.15</version> 15 15 16 16 <packaging>war</packaging> … … 34 34 <groupId>eu.clarin.cmdi</groupId> 35 35 <artifactId>vlo_importer</artifactId> 36 <version>2.1 4</version>36 <version>2.15</version> 37 37 <type>jar</type> 38 38 </dependency> … … 60 60 <exclude>**/*.java</exclude> <!-- java not needed in the package --> 61 61 </excludes> 62 </resource> 63 <resource> 64 <directory>../vlo_importer/src/main/resources</directory> 62 65 </resource> 63 66 </resources>
Note: See TracChangeset
for help on using the changeset viewer.