Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GATKPathSpecifier for tmpDir arg. #5832

Merged
merged 1 commit into from
Apr 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.broadinstitute.barclay.argparser.*;
import org.broadinstitute.hellbender.engine.GATKPathSpecifier;
import org.broadinstitute.hellbender.exceptions.UserException;
import org.broadinstitute.hellbender.utils.LoggingUtils;
import org.broadinstitute.hellbender.utils.Utils;
Expand Down Expand Up @@ -61,7 +62,7 @@ public abstract class CommandLineProgram implements CommandLinePluginProvider {
private static final String DEFAULT_TOOLKIT_SHORT_NAME = "GATK";

@Argument(fullName = StandardArgumentDefinitions.TMP_DIR_NAME, common=true, optional=true, doc = "Temp directory to use.")
public String tmpDir;
public GATKPathSpecifier tmpDir;

@ArgumentCollection(doc="Special Arguments that have meaning to the argument parsing system. " +
"It is unlikely these will ever need to be accessed by the command line program")
Expand Down Expand Up @@ -144,9 +145,8 @@ public final Object runTool(){

public Object instanceMainPostParseArgs() {
// Provide one temp directory if the caller didn't
// TODO - this should use the HTSJDK IOUtil.getDefaultTmpDirPath, which is somehow broken in the current HTSJDK version
if (tmpDir == null || tmpDir.isEmpty()) {
tmpDir = IOUtils.getAbsolutePathWithoutFileProtocol(IOUtils.getPath(System.getProperty("java.io.tmpdir")));
if (tmpDir == null) {
tmpDir = new GATKPathSpecifier(System.getProperty("java.io.tmpdir"));
}

// Build the default headers
Expand All @@ -157,7 +157,7 @@ public Object instanceMainPostParseArgs() {
LoggingUtils.setLoggingLevel(VERBOSITY); // propagate the VERBOSITY level to logging frameworks

// set the temp directory as a java property, checking for existence and read/write access
final Path p = IOUtils.getPath(tmpDir);
final Path p = tmpDir.toPath();
try {
p.getFileSystem().provider().checkAccess(p, AccessMode.READ, AccessMode.WRITE);
System.setProperty("java.io.tmpdir", IOUtils.getAbsolutePathWithoutFileProtocol(p));
Expand Down