Skip to content

Commit bffca63

Browse files
committed
Fix SRA load when job resumes after failure
1 parent 811f2af commit bffca63

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ public void processFilesRemote(List<Readset> readsets, JobContext ctx) throws Un
209209
try (PrintWriter writer = PrintWriters.getPrintWriter(IOUtil.openFileForWriting(sraLog, sraLog.exists())))
210210
{
211211
ctx.getLogger().info("Copying file to: " + expectedFile1.getPath());
212+
if (expectedFile1.exists())
213+
{
214+
ctx.getLogger().debug("Deleting pre-existing file: " + expectedFile1.getPath());
215+
expectedFile1.delete();
216+
}
212217
Files.copy(files.first.toPath(), expectedFile1.toPath());
213218
ctx.getFileManager().addIntermediateFile(files.first);
214219
writer.println("Downloaded " + expectedFile1.getName() + " from " + accession + " on " + timestamp + ", size: " + FileUtils.byteCountToDisplaySize(FileUtils.sizeOf(expectedFile1)));
@@ -221,6 +226,11 @@ public void processFilesRemote(List<Readset> readsets, JobContext ctx) throws Un
221226
}
222227

223228
ctx.getLogger().info("Copying file to: " + expectedFile2.getPath());
229+
if (expectedFile2.exists())
230+
{
231+
ctx.getLogger().debug("Deleting pre-existing file: " + expectedFile2.getPath());
232+
expectedFile2.delete();
233+
}
224234
Files.copy(files.second.toPath(), expectedFile2.toPath());
225235
ctx.getFileManager().addIntermediateFile(files.second);
226236
writer.println("Downloaded " + expectedFile2.getName() + " from SRA " + accession + " on " + timestamp + ", size: " + FileUtils.byteCountToDisplaySize(FileUtils.sizeOf(expectedFile2)));

0 commit comments

Comments
 (0)