|
|
|
@@ -44,6 +44,8 @@ import lombok.Data;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@AllArgsConstructor
|
|
|
|
@AllArgsConstructor
|
|
|
|
@Data public class Configuration {
|
|
|
|
@Data public class Configuration {
|
|
|
|
|
|
|
|
public static final String WORKING_DIRNAME = "sheepit";
|
|
|
|
|
|
|
|
public static final String WOOL_CACHE_DIRNAME = "sheepit_wool_cache";
|
|
|
|
|
|
|
|
|
|
|
|
public static final String jarVersion = getJarVersion();
|
|
|
|
public static final String jarVersion = getJarVersion();
|
|
|
|
|
|
|
|
|
|
|
|
@@ -55,9 +57,8 @@ import lombok.Data;
|
|
|
|
private String logDirectory;
|
|
|
|
private String logDirectory;
|
|
|
|
private File workingDirectory;
|
|
|
|
private File workingDirectory;
|
|
|
|
private File sharedDownloadsDirectory;
|
|
|
|
private File sharedDownloadsDirectory;
|
|
|
|
private File storageDirectory; // for permanent storage (binary archive)
|
|
|
|
private File woolCacheDirectory; // store all the chunks (and binary for now)
|
|
|
|
private boolean userHasSpecifiedACacheDir;
|
|
|
|
private boolean userHasSpecifiedACacheDir;
|
|
|
|
private String static_exeDirName;
|
|
|
|
|
|
|
|
private String login;
|
|
|
|
private String login;
|
|
|
|
private String password;
|
|
|
|
private String password;
|
|
|
|
private String proxy;
|
|
|
|
private String proxy;
|
|
|
|
@@ -91,7 +92,6 @@ import lombok.Data;
|
|
|
|
this.password = password_;
|
|
|
|
this.password = password_;
|
|
|
|
this.proxy = null;
|
|
|
|
this.proxy = null;
|
|
|
|
this.hostname = this.getDefaultHostname();
|
|
|
|
this.hostname = this.getDefaultHostname();
|
|
|
|
this.static_exeDirName = "exe";
|
|
|
|
|
|
|
|
this.maxUploadingJob = 1;
|
|
|
|
this.maxUploadingJob = 1;
|
|
|
|
this.nbCores = -1; // ie not set
|
|
|
|
this.nbCores = -1; // ie not set
|
|
|
|
this.maxAllowedMemory = -1; // ie not set
|
|
|
|
this.maxAllowedMemory = -1; // ie not set
|
|
|
|
@@ -103,7 +103,7 @@ import lombok.Data;
|
|
|
|
this.detectGPUs = true;
|
|
|
|
this.detectGPUs = true;
|
|
|
|
this.workingDirectory = null;
|
|
|
|
this.workingDirectory = null;
|
|
|
|
this.sharedDownloadsDirectory = null;
|
|
|
|
this.sharedDownloadsDirectory = null;
|
|
|
|
this.storageDirectory = null;
|
|
|
|
this.woolCacheDirectory = null;
|
|
|
|
this.setCacheDir(cache_dir_);
|
|
|
|
this.setCacheDir(cache_dir_);
|
|
|
|
this.printLog = false;
|
|
|
|
this.printLog = false;
|
|
|
|
this.debugLevel = false;
|
|
|
|
this.debugLevel = false;
|
|
|
|
@@ -132,9 +132,8 @@ import lombok.Data;
|
|
|
|
c + "logDir: " + (logDirectory == null ? "NULL" : logDirectory) + n +
|
|
|
|
c + "logDir: " + (logDirectory == null ? "NULL" : logDirectory) + n +
|
|
|
|
c + "workingDirectory: " + workingDirectory + n +
|
|
|
|
c + "workingDirectory: " + workingDirectory + n +
|
|
|
|
c + "sharedDownloadsDirectory: " + sharedDownloadsDirectory + n +
|
|
|
|
c + "sharedDownloadsDirectory: " + sharedDownloadsDirectory + n +
|
|
|
|
c + "storageDirectory: " + storageDirectory + n +
|
|
|
|
c + "woolCacheDirectory: " + woolCacheDirectory + n +
|
|
|
|
c + "userHasSpecifiedACacheDir: " + userHasSpecifiedACacheDir + n +
|
|
|
|
c + "userHasSpecifiedACacheDir: " + userHasSpecifiedACacheDir + n +
|
|
|
|
c + "static_exeDirName: " + static_exeDirName + n +
|
|
|
|
|
|
|
|
c + "login: " + login + n +
|
|
|
|
c + "login: " + login + n +
|
|
|
|
c + "proxy: " + proxy + n +
|
|
|
|
c + "proxy: " + proxy + n +
|
|
|
|
c + "maxUploadingJob: " + maxUploadingJob + n +
|
|
|
|
c + "maxUploadingJob: " + maxUploadingJob + n +
|
|
|
|
@@ -201,8 +200,8 @@ import lombok.Data;
|
|
|
|
// since there is no working directory and the client will be working in the system temp directory,
|
|
|
|
// since there is no working directory and the client will be working in the system temp directory,
|
|
|
|
// we can also set up a 'permanent' directory for immutable files (like renderer binary)
|
|
|
|
// we can also set up a 'permanent' directory for immutable files (like renderer binary)
|
|
|
|
|
|
|
|
|
|
|
|
this.storageDirectory = new File(this.workingDirectory.getParent() + File.separator + "sheepit_binary_cache");
|
|
|
|
this.woolCacheDirectory = new File(this.workingDirectory.getParent() + File.separator + WOOL_CACHE_DIRNAME);
|
|
|
|
this.storageDirectory.mkdir();
|
|
|
|
this.woolCacheDirectory.mkdir();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (IOException e) {
|
|
|
|
catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
@@ -210,10 +209,10 @@ import lombok.Data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
this.userHasSpecifiedACacheDir = true;
|
|
|
|
this.userHasSpecifiedACacheDir = true;
|
|
|
|
this.workingDirectory = new File(cache_dir_.getAbsolutePath() + File.separator + "sheepit");
|
|
|
|
this.workingDirectory = new File(cache_dir_.getAbsolutePath() + File.separator + WORKING_DIRNAME);
|
|
|
|
this.storageDirectory = new File(cache_dir_.getAbsolutePath() + File.separator + "sheepit_binary_cache");
|
|
|
|
this.woolCacheDirectory = new File(cache_dir_.getAbsolutePath() + File.separator + WOOL_CACHE_DIRNAME);
|
|
|
|
this.workingDirectory.mkdirs();
|
|
|
|
this.workingDirectory.mkdirs();
|
|
|
|
this.storageDirectory.mkdirs();
|
|
|
|
this.woolCacheDirectory.mkdirs();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.sharedDownloadsDirectory != null) {
|
|
|
|
if (this.sharedDownloadsDirectory != null) {
|
|
|
|
@@ -225,19 +224,12 @@ import lombok.Data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @return the storage directory or the working directory if the former is not defined
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public File getStorageDir() {
|
|
|
|
|
|
|
|
return this.storageDirectory == null ? this.workingDirectory : this.storageDirectory;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @return the user specified cache directory or null if it hasn't been specified
|
|
|
|
* @return the user specified cache directory or null if it hasn't been specified
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public File getCacheDirForSettings() {
|
|
|
|
public File getCacheDirForSettings() {
|
|
|
|
// when the user has a cache directory specified,
|
|
|
|
// when the user has a cache directory specified,
|
|
|
|
// a "sheepit" and "sheepit_binary_cache" directory is to be automatically created
|
|
|
|
// a "sheepit" and "wool_cache" directory is to be automatically created
|
|
|
|
return this.userHasSpecifiedACacheDir == false ? null : this.workingDirectory.getParentFile();
|
|
|
|
return this.userHasSpecifiedACacheDir == false ? null : this.workingDirectory.getParentFile();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -258,7 +250,7 @@ import lombok.Data;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void cleanWorkingDirectory() {
|
|
|
|
public void cleanWorkingDirectory() {
|
|
|
|
this.cleanDirectory(this.workingDirectory);
|
|
|
|
this.cleanDirectory(this.workingDirectory);
|
|
|
|
this.cleanDirectory(this.storageDirectory);
|
|
|
|
this.cleanDirectory(this.woolCacheDirectory);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@@ -329,8 +321,8 @@ import lombok.Data;
|
|
|
|
files.addAll(Arrays.asList(filesInDirectory));
|
|
|
|
files.addAll(Arrays.asList(filesInDirectory));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this.storageDirectory != null) {
|
|
|
|
if (this.woolCacheDirectory != null) {
|
|
|
|
File[] filesInDirectory = this.storageDirectory.listFiles();
|
|
|
|
File[] filesInDirectory = this.woolCacheDirectory.listFiles();
|
|
|
|
if (filesInDirectory != null) {
|
|
|
|
if (filesInDirectory != null) {
|
|
|
|
files.addAll(Arrays.asList(filesInDirectory));
|
|
|
|
files.addAll(Arrays.asList(filesInDirectory));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -379,8 +371,8 @@ import lombok.Data;
|
|
|
|
if (sharedDownloadsDirectory != null && dirsToCheck.contains(sharedDownloadsDirectory.getAbsoluteFile()) == false) {
|
|
|
|
if (sharedDownloadsDirectory != null && dirsToCheck.contains(sharedDownloadsDirectory.getAbsoluteFile()) == false) {
|
|
|
|
dirsToCheck.add(sharedDownloadsDirectory.getAbsoluteFile());
|
|
|
|
dirsToCheck.add(sharedDownloadsDirectory.getAbsoluteFile());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (storageDirectory != null && dirsToCheck.contains(storageDirectory.getAbsoluteFile()) == false) {
|
|
|
|
if (woolCacheDirectory != null && dirsToCheck.contains(woolCacheDirectory.getAbsoluteFile()) == false) {
|
|
|
|
dirsToCheck.add(storageDirectory.getAbsoluteFile());
|
|
|
|
dirsToCheck.add(woolCacheDirectory.getAbsoluteFile());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ListIterator<File> dirs = dirsToCheck.listIterator();
|
|
|
|
ListIterator<File> dirs = dirsToCheck.listIterator();
|
|
|
|
while (dirs.hasNext()) {
|
|
|
|
while (dirs.hasNext()) {
|
|
|
|
|