Skip to content

Commit d4d6f0c

Browse files
committed
Merge discvr-23.3 to develop
2 parents 5c2ada6 + cb4330a commit d4d6f0c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisMaintenanceTask.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.apache.commons.io.FileUtils;
44
import org.apache.commons.lang3.SystemUtils;
5+
import org.apache.logging.log4j.Level;
56
import org.apache.logging.log4j.Logger;
67
import org.labkey.api.data.CompareType;
78
import org.labkey.api.data.Container;
@@ -36,6 +37,7 @@
3637
import java.util.ArrayList;
3738
import java.util.Arrays;
3839
import java.util.Collections;
40+
import java.util.Date;
3941
import java.util.HashMap;
4042
import java.util.HashSet;
4143
import java.util.List;
@@ -327,7 +329,15 @@ private void processContainer(Container c, Logger log) throws IOException, Pipel
327329
if (!gz.exists())
328330
{
329331
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());
331341

332342
if (SystemUtils.IS_OS_WINDOWS)
333343
{

0 commit comments

Comments
 (0)