Skip to content

Commit

Permalink
storage: Do not fail vairant-walker if no output is produced. #TASK-6722
Browse files Browse the repository at this point in the history
  • Loading branch information
j-coll committed Nov 27, 2024
1 parent ccf7438 commit f87686e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ protected void run() throws Exception {
});
step("move-files", () -> {
// Move files to final directory
IOManager ioManager = catalogManager.getIoManagerFactory().get(uris.get(0));
for (URI uri : uris) {
String fileName = UriUtils.fileName(uri);
logger.info("Moving file -- " + fileName);
ioManager.move(uri, getOutDir().resolve(fileName).toUri());
if (!uris.isEmpty()) {
IOManager ioManager = catalogManager.getIoManagerFactory().get(uris.get(0));
for (URI uri : uris) {
String fileName = UriUtils.fileName(uri);
logger.info("Moving file -- " + fileName);
ioManager.move(uri, getOutDir().resolve(fileName).toUri());
}
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.opencb.opencga.storage.core.exceptions.StorageEngineException;
import org.opencb.opencga.storage.core.exceptions.StoragePipelineException;
import org.opencb.opencga.storage.core.exceptions.VariantSearchException;
import org.opencb.opencga.storage.core.io.managers.IOConnector;
import org.opencb.opencga.storage.core.io.managers.IOConnectorProvider;
import org.opencb.opencga.storage.core.metadata.VariantMetadataFactory;
import org.opencb.opencga.storage.core.metadata.VariantStorageMetadataManager;
Expand Down Expand Up @@ -342,7 +343,24 @@ public List<URI> walkData(URI outputFile, VariantWriterFactory.VariantOutputForm
.append(StreamVariantDriver.INPUT_FORMAT_PARAM, format.toString())
.append(StreamVariantDriver.OUTPUT_PARAM, outputFile)
), "Walk data");
return Arrays.asList(outputFile, UriUtils.createUriSafe(outputFile.toString() + StreamVariantDriver.STDERR_TXT_GZ));
List<URI> uris = new ArrayList<>();
URI stderrFile = UriUtils.createUriSafe(outputFile.toString() + StreamVariantDriver.STDERR_TXT_GZ);
try {
IOConnector ioConnector = ioConnectorProvider.get(outputFile);
if (ioConnector.exists(outputFile)) {
uris.add(outputFile);
} else {
logger.warn("Output file not found: {}", outputFile);
}
if (ioConnector.exists(stderrFile)) {
uris.add(stderrFile);
} else {
logger.warn("Stderr file not found: {}", stderrFile);
}
} catch (IOException e) {
throw new StorageEngineException("Error checking output file", e);
}
return uris;
}

@Override
Expand Down

0 comments on commit f87686e

Please sign in to comment.