Skip to content

Commit e9121a6

Browse files
committed
Bugfixes around JBrowse and lucene indexes
1 parent 77d08dc commit e9121a6

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/RestoreSraDataHandler.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,15 +307,18 @@ public void complete(PipelineJob job, List<Readset> readsets, List<SequenceOutpu
307307
boolean hasMetrics = new TableSelector(SequenceAnalysisSchema.getTable(SequenceAnalysisSchema.TABLE_QUALITY_METRICS), PageFlowUtil.set("RowId"), filter, null).exists();
308308
if (!hasMetrics)
309309
{
310+
job.getLogger().debug("No existing metrics found for: " + rd.getFileId1());
310311
List<Integer> toAdd = new ArrayList<>(rd.getFileId1());
311312
if (rd.getFileId2() != null)
312313
{
313314
toAdd.add(rd.getFileId2());
314315
}
315316

317+
job.getLogger().debug("adding metrics for " + toAdd.size() + " total fastq files");
316318
for (int dataId : toAdd)
317319
{
318320
//then delete/add:
321+
job.getLogger().debug("adding metrics for: " + dataId);
319322
ReadsetCreationTask.addQualityMetricsForReadset(rs, dataId, job, true);
320323
}
321324
}
@@ -332,15 +335,22 @@ public void complete(PipelineJob job, List<Readset> readsets, List<SequenceOutpu
332335
}
333336
}
334337

335-
Container target = job.getContainer().isWorkbook() ? job.getContainer().getParent() : job.getContainer();
336-
TableInfo ti = QueryService.get().getUserSchema(job.getUser(), target, SequenceAnalysisSchema.SCHEMA_NAME).getTable(SequenceAnalysisSchema.TABLE_READ_DATA);
337-
try
338+
if (!rows.isEmpty())
338339
{
339-
ti.getUpdateService().updateRows(job.getUser(), target, rows, rows, null, null);
340+
Container target = job.getContainer().isWorkbook() ? job.getContainer().getParent() : job.getContainer();
341+
TableInfo ti = QueryService.get().getUserSchema(job.getUser(), target, SequenceAnalysisSchema.SCHEMA_NAME).getTable(SequenceAnalysisSchema.TABLE_READ_DATA);
342+
try
343+
{
344+
ti.getUpdateService().updateRows(job.getUser(), target, rows, rows, null, null);
345+
}
346+
catch (InvalidKeyException | BatchValidationException | QueryUpdateServiceException | SQLException e)
347+
{
348+
throw new PipelineJobException(e);
349+
}
340350
}
341-
catch (InvalidKeyException | BatchValidationException | QueryUpdateServiceException | SQLException e)
351+
else
342352
{
343-
throw new PipelineJobException(e);
353+
job.getLogger().debug("There were no readdata rows to update");
344354
}
345355
}
346356

jbrowse/src/org/labkey/jbrowse/model/JsonFile.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,8 @@ public File prepareResource(User u, Logger log, boolean throwIfNotPrepared, bool
964964
}
965965
else if (existingLuceneDir != null && existingLuceneDir.exists())
966966
{
967-
if (doesLuceneIndexExist())
967+
// Note: this could exist, but be an empty folder:
968+
if (luceneDir.exists())
968969
{
969970
log.info("Deleting existing lucene index dir: " + luceneDir.getPath());
970971
try
@@ -978,8 +979,16 @@ else if (existingLuceneDir != null && existingLuceneDir.exists())
978979
}
979980

980981
log.debug("Creating symlink to existing index: " + existingLuceneDir.getPath());
982+
log.debug("Symlink target: " + luceneDir.getPath());
983+
981984
try
982985
{
986+
if (!luceneDir.getParentFile().exists())
987+
{
988+
log.debug("Creating parent directories: " + luceneDir.getParentFile().getPath());
989+
FileUtil.mkdirs(luceneDir.getParentFile());
990+
}
991+
983992
Files.createSymbolicLink(luceneDir.toPath(), existingLuceneDir.toPath());
984993
}
985994
catch (IOException e)

0 commit comments

Comments
 (0)