Ref: configuration class shouldn't create and handle directory, DirectoryManager should do it
This commit is contained in:
@@ -80,6 +80,8 @@ import static com.sheepit.client.RenderSettings.UPDATE_METHOD_BY_TILE;
|
||||
private Configuration configuration;
|
||||
private Log log;
|
||||
|
||||
private DirectoryManager directoryManager;
|
||||
|
||||
public Job(Configuration config_, Gui gui_, Log log_, String id_, String frame_, String path_, boolean use_gpu, String command_, String validationUrl_,
|
||||
String script_, DownloadItem projectDownload_, DownloadItem rendererDownload_, String name_, char[] password_, boolean synchronous_upload_,
|
||||
String update_method_) {
|
||||
@@ -94,6 +96,7 @@ import static com.sheepit.client.RenderSettings.UPDATE_METHOD_BY_TILE;
|
||||
synchronousUpload = synchronous_upload_;
|
||||
gui = gui_;
|
||||
log = log_;
|
||||
directoryManager = new DirectoryManager(configuration);
|
||||
renderProcess = new RenderProcess(log_);
|
||||
renderState = new RenderState();
|
||||
renderOutput = new RenderOutput();
|
||||
@@ -259,7 +262,7 @@ import static com.sheepit.client.RenderSettings.UPDATE_METHOD_BY_TILE;
|
||||
catch (IOException e) {
|
||||
StringWriter sw = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(sw));
|
||||
for (String logline : configuration.filesystemHealthCheck()) {
|
||||
for (String logline : directoryManager.filesystemHealthCheck()) {
|
||||
log.debug(logline);
|
||||
}
|
||||
log.error("Job::render exception on script generation, will return UNKNOWN " + e + " stacktrace " + sw.toString());
|
||||
@@ -293,7 +296,7 @@ import static com.sheepit.client.RenderSettings.UPDATE_METHOD_BY_TILE;
|
||||
catch (IOException e) {
|
||||
StringWriter sw = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(sw));
|
||||
for (String logline : configuration.filesystemHealthCheck()) {
|
||||
for (String logline : directoryManager.filesystemHealthCheck()) {
|
||||
log.debug(logline);
|
||||
}
|
||||
log.error("Job::render exception on script generation, will return UNKNOWN " + e + " stacktrace " + sw.toString());
|
||||
@@ -474,7 +477,7 @@ import static com.sheepit.client.RenderSettings.UPDATE_METHOD_BY_TILE;
|
||||
gui.updateTrayIcon(SHOW_BASE_ICON);
|
||||
process.kill();
|
||||
maybeCleanWorkingDir(error);
|
||||
for (String logline : configuration.filesystemHealthCheck()) {
|
||||
for (String logline : directoryManager.filesystemHealthCheck()) {
|
||||
log.debug(logline);
|
||||
}
|
||||
|
||||
@@ -536,7 +539,7 @@ import static com.sheepit.client.RenderSettings.UPDATE_METHOD_BY_TILE;
|
||||
}
|
||||
StringWriter sw = new StringWriter();
|
||||
err.printStackTrace(new PrintWriter(sw));
|
||||
for (String logline : configuration.filesystemHealthCheck()) {
|
||||
for (String logline : directoryManager.filesystemHealthCheck()) {
|
||||
log.debug(logline);
|
||||
}
|
||||
log.error("Job::render exception(A) " + err + " stacktrace " + sw.toString());
|
||||
@@ -591,7 +594,7 @@ import static com.sheepit.client.RenderSettings.UPDATE_METHOD_BY_TILE;
|
||||
}
|
||||
|
||||
if (files.length == 0) {
|
||||
for (String logline : configuration.filesystemHealthCheck()) {
|
||||
for (String logline : directoryManager.filesystemHealthCheck()) {
|
||||
log.debug(logline);
|
||||
}
|
||||
log.error("Job::render no picture file found (after finished render (filename_without_extension " + filename_without_extension + ")");
|
||||
@@ -605,7 +608,7 @@ import static com.sheepit.client.RenderSettings.UPDATE_METHOD_BY_TILE;
|
||||
}
|
||||
File crash_file = new File(configuration.getWorkingDirectory() + File.separator + basename + ".crash.txt");
|
||||
if (crash_file.exists()) {
|
||||
for (String logline : configuration.filesystemHealthCheck()) {
|
||||
for (String logline : directoryManager.filesystemHealthCheck()) {
|
||||
log.debug(logline);
|
||||
}
|
||||
log.error("Job::render crash file found => the renderer crashed");
|
||||
@@ -614,7 +617,7 @@ import static com.sheepit.client.RenderSettings.UPDATE_METHOD_BY_TILE;
|
||||
}
|
||||
|
||||
if (exit_value == 127 && process.getDuration() < 10) {
|
||||
for (String logline : configuration.filesystemHealthCheck()) {
|
||||
for (String logline : directoryManager.filesystemHealthCheck()) {
|
||||
log.debug(logline);
|
||||
}
|
||||
log.error("Job::render renderer returned 127 and took " + process.getDuration() + "s, some libraries may be missing");
|
||||
@@ -771,7 +774,7 @@ import static com.sheepit.client.RenderSettings.UPDATE_METHOD_BY_TILE;
|
||||
|| Type.ENGINE_NOT_AVAILABLE == error
|
||||
|| Type.DETECT_DEVICE_ERROR == error;
|
||||
if (cleanup) {
|
||||
configuration.cleanWorkingDirectory();
|
||||
directoryManager.cleanWorkingDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user