Skip to content

Commit 7cde18d

Browse files
committed
Improve and debug SequenceAnalysisMaintenanceTask
1 parent 1d7785f commit 7cde18d

File tree

1 file changed

+52
-29
lines changed

1 file changed

+52
-29
lines changed

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

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.labkey.api.pipeline.PipeRoot;
1919
import org.labkey.api.pipeline.PipelineJobException;
2020
import org.labkey.api.pipeline.PipelineService;
21+
import org.labkey.api.pipeline.PipelineStatusFile;
2122
import org.labkey.api.query.FieldKey;
2223
import org.labkey.api.security.User;
2324
import org.labkey.api.sequenceanalysis.RefNtSequenceModel;
@@ -234,38 +235,60 @@ else if (!d.getFile().exists())
234235
}
235236
}
236237

237-
if (m.getRunId() != null)
238+
inspectForCoreFiles(m.getRunId(), log);
239+
}
240+
}
241+
242+
private void inspectForCoreFiles(Integer runId, Logger log)
243+
{
244+
if (runId == null)
245+
{
246+
return;
247+
}
248+
249+
ExpRun run = ExperimentService.get().getExpRun(runId);
250+
if (run == null)
251+
{
252+
log.info("Not ExpRun found for runId: " + runId);
253+
return;
254+
}
255+
else if (run.getJobId() == null)
256+
{
257+
log.info("ExpRun lacks jobId: " + runId);
258+
return;
259+
}
260+
261+
PipelineStatusFile sf = PipelineService.get().getStatusFile(run.getJobId());
262+
if (sf == null)
263+
{
264+
log.error("Unknown statusFile: " + run.getJobId() + ", for run: " + runId);
265+
return;
266+
}
267+
else if (sf.getFilePath() == null)
268+
{
269+
log.error("StatusFile filepath is null: " + run.getJobId() + ", for run: " + runId);
270+
return;
271+
}
272+
273+
File root = new File(sf.getFilePath());
274+
if (!root.exists())
275+
{
276+
log.error("Run fileroot does not exist: " + runId + " / " + root.getPath());
277+
return;
278+
}
279+
280+
try (Stream<Path> stream = Files.walk(root.toPath()))
281+
{
282+
List<Path> files = stream.filter(x -> x.getFileName().startsWith("core.")).toList();
283+
if (!files.isEmpty())
238284
{
239-
ExpRun run = ExperimentService.get().getExpRun(m.getRunId());
240-
if (run == null)
241-
{
242-
log.info("Not ExpRun found for runId: " + m.getRunId());
243-
}
244-
else if (run.getFilePathRootPath() == null)
245-
{
246-
log.error("Run fileroot is null for runId: " + m.getRunId());
247-
}
248-
else if (!run.getFilePathRoot().exists())
249-
{
250-
log.error("Run fileroot does not exist: " + m.getRunId() + " / " + run.getFilePathRoot());
251-
}
252-
else
253-
{
254-
try (Stream<Path> stream = Files.walk(run.getFilePathRootPath()))
255-
{
256-
List<Path> files = stream.filter(x -> x.getFileName().startsWith("core.")).toList();
257-
if (!files.isEmpty())
258-
{
259-
files.forEach(x -> log.error("Found core file: " + x.toFile().getPath()));
260-
}
261-
}
262-
catch (IOException e)
263-
{
264-
log.error("Error walking file root: " + run.getFilePathRootPath(), e);
265-
}
266-
}
285+
files.forEach(x -> log.error("Found core file: " + x.toFile().getPath()));
267286
}
268287
}
288+
catch (IOException e)
289+
{
290+
log.error("Error walking file root: " + run.getFilePathRootPath(), e);
291+
}
269292
}
270293

271294
private void processContainer(Container c, Logger log) throws IOException, PipelineJobException

0 commit comments

Comments
 (0)