Skip to content

Commit 504846c

Browse files
committed
Improve resume for ReadsetInitTask
1 parent 14ffbcf commit 504846c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/ReadsetInitTask.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,23 +454,35 @@ private static void moveInputToAnalysisDir(File input, SequenceJob job, Collecti
454454
File outputDir = job.getAnalysisDirectory();
455455
File output = new File(outputDir, input.getName());
456456
job.getLogger().debug("Destination: " + output.getPath());
457+
boolean alreadyMoved = false;
457458
if (output.exists())
458459
{
459460
job.getLogger().debug("output already exists");
460461
if (unalteredInputs != null && unalteredInputs.contains(output))
461462
{
462463
job.getLogger().debug("\tThis input was unaltered during normalization and a copy already exists in the analysis folder so the original will be discarded");
463464
input.delete();
464-
TaskFileManagerImpl.swapFilesInRecordedActions(job.getLogger(), input, output, actions, job, null);
465-
return;
465+
alreadyMoved = true;
466466
}
467467
else
468468
{
469-
throw new PipelineJobException("A file with the expected output name already exists: " + output.getPath());
469+
if (input.length() == output.length() && input.lastModified() == output.lastModified())
470+
{
471+
job.getLogger().info("Output exists, but has the same size/modified timestamp. Deleting original");
472+
input.delete();
473+
alreadyMoved = true;
474+
}
475+
else
476+
{
477+
throw new PipelineJobException("A file with the expected output name already exists: " + output.getPath());
478+
}
470479
}
471480
}
472481

473-
FileUtils.moveFile(input, output);
482+
if (!alreadyMoved)
483+
{
484+
FileUtils.moveFile(input, output);
485+
}
474486
if (!output.exists())
475487
{
476488
throw new PipelineJobException("Unable to move file: " + input.getPath());

0 commit comments

Comments
 (0)