One less Queue command line requirement: -tempDir now defaults to .queue/tmp.
Also moved queueScatterGather to .queue/scatterGather.
This commit is contained in:
parent
68c5142d2d
commit
2d1ea7124b
|
|
@ -48,14 +48,23 @@ public class IOUtils {
|
||||||
* @param tempDir Temporary directory.
|
* @param tempDir Temporary directory.
|
||||||
*/
|
*/
|
||||||
public static void checkTempDir(File tempDir) {
|
public static void checkTempDir(File tempDir) {
|
||||||
|
if (isDefaultTempDir(tempDir))
|
||||||
|
throw new UserException.BadTmpDir("java.io.tmpdir must be explicitly set");
|
||||||
|
if (!tempDir.exists() && !tempDir.mkdirs())
|
||||||
|
throw new UserException.BadTmpDir("Could not create directory: " + tempDir.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the directory is a default temporary directory.
|
||||||
|
* @param tempDir the directory to check.
|
||||||
|
* @return true if the directory is a default temporary directory.
|
||||||
|
*/
|
||||||
|
public static boolean isDefaultTempDir(File tempDir) {
|
||||||
String tempDirPath = tempDir.getAbsolutePath();
|
String tempDirPath = tempDir.getAbsolutePath();
|
||||||
// Keeps the user from leaving the temp directory as the default, and on Macs from having pluses
|
// Keeps the user from leaving the temp directory as the default, and on Macs from having pluses
|
||||||
// in the path which can cause problems with the Google Reflections library.
|
// in the path which can cause problems with the Google Reflections library.
|
||||||
// see also: http://benjchristensen.com/2009/09/22/mac-osx-10-6-java-java-io-tmpdir/
|
// see also: http://benjchristensen.com/2009/09/22/mac-osx-10-6-java-java-io-tmpdir/
|
||||||
if (tempDirPath.startsWith("/var/folders/") || (tempDirPath.equals("/tmp")) || (tempDirPath.equals("/tmp/")))
|
return (tempDirPath.startsWith("/var/folders/") || (tempDirPath.equals("/tmp")) || (tempDirPath.equals("/tmp/")));
|
||||||
throw new UserException.BadTmpDir("java.io.tmpdir must be explicitly set");
|
|
||||||
if (!tempDir.exists() && !tempDir.mkdirs())
|
|
||||||
throw new UserException.BadTmpDir("Could not create directory: " + tempDir.getAbsolutePath());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,10 @@ object QCommandLine extends Logging {
|
||||||
Runtime.getRuntime.removeShutdownHook(shutdownHook)
|
Runtime.getRuntime.removeShutdownHook(shutdownHook)
|
||||||
qCommandLine.shutdown()
|
qCommandLine.shutdown()
|
||||||
} catch {
|
} catch {
|
||||||
case _ => /* ignore, example 'java.lang.IllegalStateException: Shutdown in progress' */
|
case e: Exception => /* ignore, example 'java.lang.IllegalStateException: Shutdown in progress' */
|
||||||
}
|
}
|
||||||
if (CommandLineProgram.result != 0)
|
if (CommandLineProgram.result != 0)
|
||||||
System.exit(CommandLineProgram.result);
|
System.exit(CommandLineProgram.result)
|
||||||
} catch {
|
} catch {
|
||||||
case e: Exception => CommandLineProgram.exitSystemWithError(e)
|
case e: Exception => CommandLineProgram.exitSystemWithError(e)
|
||||||
}
|
}
|
||||||
|
|
@ -105,9 +105,11 @@ class QCommandLine extends CommandLineProgram with Logging {
|
||||||
def execute = {
|
def execute = {
|
||||||
if (settings.qSettings.runName == null)
|
if (settings.qSettings.runName == null)
|
||||||
settings.qSettings.runName = FilenameUtils.removeExtension(scripts.head.getName)
|
settings.qSettings.runName = FilenameUtils.removeExtension(scripts.head.getName)
|
||||||
|
if (IOUtils.isDefaultTempDir(settings.qSettings.tempDirectory))
|
||||||
|
settings.qSettings.tempDirectory = IOUtils.absolute(settings.qSettings.runDirectory, ".queue/tmp")
|
||||||
qGraph.initializeWithSettings(settings)
|
qGraph.initializeWithSettings(settings)
|
||||||
|
|
||||||
val allQScripts = pluginManager.createAllTypes();
|
val allQScripts = pluginManager.createAllTypes()
|
||||||
for (script <- allQScripts) {
|
for (script <- allQScripts) {
|
||||||
logger.info("Scripting " + pluginManager.getName(script.getClass.asSubclass(classOf[QScript])))
|
logger.info("Scripting " + pluginManager.getName(script.getClass.asSubclass(classOf[QScript])))
|
||||||
loadArgumentsIntoObject(script)
|
loadArgumentsIntoObject(script)
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ trait ScatterGatherableFunction extends CommandLineFunction {
|
||||||
if (qSettings.jobScatterGatherDirectory != null) {
|
if (qSettings.jobScatterGatherDirectory != null) {
|
||||||
this.scatterGatherDirectory = IOUtils.absolute(qSettings.jobScatterGatherDirectory)
|
this.scatterGatherDirectory = IOUtils.absolute(qSettings.jobScatterGatherDirectory)
|
||||||
} else {
|
} else {
|
||||||
this.scatterGatherDirectory = IOUtils.absolute(this.commandDirectory, "queueScatterGather")
|
this.scatterGatherDirectory = IOUtils.absolute(this.commandDirectory, ".queue/scatterGather")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue