|
2 | 2 |
|
3 | 3 | import org.apache.commons.io.FileUtils; |
4 | 4 | import org.apache.commons.lang3.SystemUtils; |
| 5 | +import org.apache.logging.log4j.Level; |
5 | 6 | import org.apache.logging.log4j.Logger; |
6 | 7 | import org.labkey.api.data.CompareType; |
7 | 8 | import org.labkey.api.data.Container; |
|
36 | 37 | import java.util.ArrayList; |
37 | 38 | import java.util.Arrays; |
38 | 39 | import java.util.Collections; |
| 40 | +import java.util.Date; |
39 | 41 | import java.util.HashMap; |
40 | 42 | import java.util.HashSet; |
41 | 43 | import java.util.List; |
@@ -327,7 +329,15 @@ private void processContainer(Container c, Logger log) throws IOException, Pipel |
327 | 329 | if (!gz.exists()) |
328 | 330 | { |
329 | 331 | ReferenceGenomeImpl genome = new ReferenceGenomeImpl(fasta, fastaData, libraryId, null); |
330 | | - log.error("GZipped genome missing for: " + genome.getGenomeId()); |
| 332 | + |
| 333 | + // NOTE: we can hit a race condition in automated testing where a genome is newly created during a test, and the maintenance task runs concurrent with that test. |
| 334 | + // This is a check to reduce the log level, which thereby prevents the test from erroring |
| 335 | + Date created = new TableSelector(SequenceAnalysisSchema.getTable(SequenceAnalysisSchema.TABLE_REF_LIBRARIES), PageFlowUtil.set("created"), new SimpleFilter(FieldKey.fromString("rowId"), libraryId), null).getObject(Date.class); |
| 336 | + long timeSinceCreated = new Date().getTime() - created.getTime(); |
| 337 | + // 1000*60*20 = 20 minutes |
| 338 | + Level l = timeSinceCreated > 1200000 ? Level.ERROR : Level.WARN; |
| 339 | + |
| 340 | + log.log(l, "GZipped genome missing for: " + genome.getGenomeId()); |
331 | 341 |
|
332 | 342 | if (SystemUtils.IS_OS_WINDOWS) |
333 | 343 | { |
|
0 commit comments