9
.editorconfig
Normal file
9
.editorconfig
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
# Unix-style newlines with a newline ending every file
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
charset = utf-8
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = tab
|
||||||
37
.idea/codeStyles/Project.xml
generated
37
.idea/codeStyles/Project.xml
generated
@@ -1,7 +1,44 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
|
<option name="RIGHT_MARGIN" value="1800" />
|
||||||
|
<JavaCodeStyleSettings>
|
||||||
|
<option name="ENABLE_JAVADOC_FORMATTING" value="false" />
|
||||||
|
</JavaCodeStyleSettings>
|
||||||
<codeStyleSettings language="JAVA">
|
<codeStyleSettings language="JAVA">
|
||||||
<option name="RIGHT_MARGIN" value="160" />
|
<option name="RIGHT_MARGIN" value="160" />
|
||||||
|
<option name="KEEP_LINE_BREAKS" value="false" />
|
||||||
|
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
||||||
|
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
|
||||||
|
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
|
||||||
|
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
||||||
|
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
|
||||||
|
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||||
|
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||||
|
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||||
|
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||||
|
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||||
|
<option name="ALIGN_MULTILINE_RESOURCES" value="false" />
|
||||||
|
<option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACES" value="true" />
|
||||||
|
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
|
||||||
|
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||||
|
<option name="METHOD_PARAMETERS_WRAP" value="1" />
|
||||||
|
<option name="RESOURCE_LIST_WRAP" value="5" />
|
||||||
|
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||||
|
<option name="THROWS_LIST_WRAP" value="1" />
|
||||||
|
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||||
|
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||||
|
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
|
||||||
|
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||||
|
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
|
||||||
|
<option name="TERNARY_OPERATION_WRAP" value="5" />
|
||||||
|
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||||
|
<option name="METHOD_ANNOTATION_WRAP" value="0" />
|
||||||
|
<option name="CLASS_ANNOTATION_WRAP" value="0" />
|
||||||
|
<option name="FIELD_ANNOTATION_WRAP" value="0" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="USE_TAB_CHARACTER" value="true" />
|
||||||
|
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||||
|
</indentOptions>
|
||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
</code_scheme>
|
</code_scheme>
|
||||||
</component>
|
</component>
|
||||||
2
.idea/codeStyles/codeStyleConfig.xml
generated
2
.idea/codeStyles/codeStyleConfig.xml
generated
@@ -1,5 +1,5 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<state>
|
<state>
|
||||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="SheepitJava" />
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
</state>
|
</state>
|
||||||
</component>
|
</component>
|
||||||
@@ -49,8 +49,7 @@ import com.sheepit.client.os.OS;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data public class Client {
|
||||||
public class Client {
|
|
||||||
private Gui gui;
|
private Gui gui;
|
||||||
private Server server;
|
private Server server;
|
||||||
private Configuration configuration;
|
private Configuration configuration;
|
||||||
@@ -273,8 +272,7 @@ public class Client {
|
|||||||
catch (FermeExceptionBadResponseFromServer e) {
|
catch (FermeExceptionBadResponseFromServer e) {
|
||||||
int wait = ThreadLocalRandom.current().nextInt(15, 30 + 1); // max is exclusive
|
int wait = ThreadLocalRandom.current().nextInt(15, 30 + 1); // max is exclusive
|
||||||
int time_sleep = 1000 * 60 * wait;
|
int time_sleep = 1000 * 60 * wait;
|
||||||
this.gui.status(String.format("Bad answer from the server. Will try again at %tR",
|
this.gui.status(String.format("Bad answer from the server. Will try again at %tR", new Date(new Date().getTime() + time_sleep)));
|
||||||
new Date(new Date().getTime() + time_sleep)));
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(time_sleep);
|
Thread.sleep(time_sleep);
|
||||||
}
|
}
|
||||||
@@ -294,11 +292,12 @@ public class Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.renderingJob == null) { // no job
|
if (this.renderingJob == null) { // no job
|
||||||
int[] retrySchemeInSeconds = {300000, 480000, 720000, 900000, 1200000}; // 5, 8, 12, 15 and 20 minutes
|
int[] retrySchemeInSeconds = { 300000, 480000, 720000, 900000, 1200000 }; // 5, 8, 12, 15 and 20 minutes
|
||||||
|
|
||||||
int time_sleep = retrySchemeInSeconds[(this.noJobRetryIter < retrySchemeInSeconds.length) ? this.noJobRetryIter++ : (retrySchemeInSeconds.length - 1)];
|
int time_sleep = retrySchemeInSeconds[(this.noJobRetryIter < retrySchemeInSeconds.length) ?
|
||||||
this.gui.status(String.format("No job available. Will try again at %tR",
|
this.noJobRetryIter++ :
|
||||||
new Date(new Date().getTime() + time_sleep)));
|
(retrySchemeInSeconds.length - 1)];
|
||||||
|
this.gui.status(String.format("No job available. Will try again at %tR", new Date(new Date().getTime() + time_sleep)));
|
||||||
this.suspended = true;
|
this.suspended = true;
|
||||||
int time_slept = 0;
|
int time_slept = 0;
|
||||||
while (time_slept < time_sleep && this.running == true) {
|
while (time_slept < time_sleep && this.running == true) {
|
||||||
@@ -344,9 +343,7 @@ public class Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.renderingJob.isSynchronousUpload() == true) { // power or compute_method job, need to upload right away
|
if (this.renderingJob.isSynchronousUpload() == true) { // power or compute_method job, need to upload right away
|
||||||
this.gui.status(String.format("Uploading frame (%.2fMB)",
|
this.gui.status(String.format("Uploading frame (%.2fMB)", (this.renderingJob.getOutputImageSize() / 1024.0 / 1024.0)));
|
||||||
(this.renderingJob.getOutputImageSize() / 1024.0 / 1024.0)
|
|
||||||
));
|
|
||||||
|
|
||||||
ret = confirmJob(this.renderingJob);
|
ret = confirmJob(this.renderingJob);
|
||||||
if (ret != Error.Type.OK) {
|
if (ret != Error.Type.OK) {
|
||||||
@@ -355,9 +352,7 @@ public class Client {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.gui.status(String.format("Queuing frame for upload (%.2fMB)",
|
this.gui.status(String.format("Queuing frame for upload (%.2fMB)", (this.renderingJob.getOutputImageSize() / 1024.0 / 1024.0)));
|
||||||
(this.renderingJob.getOutputImageSize() / 1024.0 / 1024.0)
|
|
||||||
));
|
|
||||||
|
|
||||||
this.jobsToValidate.add(this.renderingJob);
|
this.jobsToValidate.add(this.renderingJob);
|
||||||
|
|
||||||
@@ -395,7 +390,8 @@ public class Client {
|
|||||||
|
|
||||||
// This loop will remain valid until all the background uploads have
|
// This loop will remain valid until all the background uploads have
|
||||||
// finished (unless the stop() method has been triggered)
|
// finished (unless the stop() method has been triggered)
|
||||||
} while (this.uploadQueueSize > 0);
|
}
|
||||||
|
while (this.uploadQueueSize > 0);
|
||||||
}
|
}
|
||||||
catch (Exception e1) {
|
catch (Exception e1) {
|
||||||
// no exception should be raised in the actual launcher (applet or standalone)
|
// no exception should be raised in the actual launcher (applet or standalone)
|
||||||
@@ -527,7 +523,8 @@ public class Client {
|
|||||||
writer.close();
|
writer.close();
|
||||||
String args = "?type=" + (error == null ? "" : error.getValue());
|
String args = "?type=" + (error == null ? "" : error.getValue());
|
||||||
if (job_to_reset_ != null) {
|
if (job_to_reset_ != null) {
|
||||||
args += "&frame=" + job_to_reset_.getFrameNumber() + "&job=" + job_to_reset_.getId() + "&render_time=" + job_to_reset_.getProcessRender().getDuration() + "&memoryused=" + job_to_reset_.getProcessRender().getMemoryUsed();
|
args += "&frame=" + job_to_reset_.getFrameNumber() + "&job=" + job_to_reset_.getId() + "&render_time=" + job_to_reset_.getProcessRender()
|
||||||
|
.getDuration() + "&memoryused=" + job_to_reset_.getProcessRender().getMemoryUsed();
|
||||||
if (job_to_reset_.getExtras() != null && job_to_reset_.getExtras().isEmpty() == false) {
|
if (job_to_reset_.getExtras() != null && job_to_reset_.getExtras().isEmpty() == false) {
|
||||||
args += "&extras=" + job_to_reset_.getExtras();
|
args += "&extras=" + job_to_reset_.getExtras();
|
||||||
}
|
}
|
||||||
@@ -543,7 +540,8 @@ public class Client {
|
|||||||
// no exception should be raised to actual launcher (applet or standalone)
|
// no exception should be raised to actual launcher (applet or standalone)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error != null && (error == Error.Type.RENDERER_CRASHED || error == Error.Type.RENDERER_KILLED_BY_USER || error == Error.Type.RENDERER_KILLED_BY_SERVER)) {
|
if (error != null && (error == Error.Type.RENDERER_CRASHED || error == Error.Type.RENDERER_KILLED_BY_USER
|
||||||
|
|| error == Error.Type.RENDERER_KILLED_BY_SERVER)) {
|
||||||
// do nothing, we can ask for a job right away
|
// do nothing, we can ask for a job right away
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -625,21 +623,22 @@ public class Client {
|
|||||||
|
|
||||||
if (scene_file.exists() == false) {
|
if (scene_file.exists() == false) {
|
||||||
gui.setRenderingProjectName("");
|
gui.setRenderingProjectName("");
|
||||||
this.log.error("Client::work job preparation failed (scene file '" + scene_file.getAbsolutePath() + "' does not exist), cleaning directory in hope to recover");
|
this.log.error("Client::work job preparation failed (scene file '" + scene_file.getAbsolutePath()
|
||||||
|
+ "' does not exist), cleaning directory in hope to recover");
|
||||||
this.configuration.cleanWorkingDirectory();
|
this.configuration.cleanWorkingDirectory();
|
||||||
return Error.Type.MISSING_SCENE;
|
return Error.Type.MISSING_SCENE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderer_file.exists() == false) {
|
if (renderer_file.exists() == false) {
|
||||||
gui.setRenderingProjectName("");
|
gui.setRenderingProjectName("");
|
||||||
this.log.error("Client::work job preparation failed (renderer file '" + renderer_file.getAbsolutePath() + "' does not exist), cleaning directory in hope to recover");
|
this.log.error("Client::work job preparation failed (renderer file '" + renderer_file.getAbsolutePath()
|
||||||
|
+ "' does not exist), cleaning directory in hope to recover");
|
||||||
this.configuration.cleanWorkingDirectory();
|
this.configuration.cleanWorkingDirectory();
|
||||||
return Error.Type.MISSING_RENDERER;
|
return Error.Type.MISSING_RENDERER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Observer removeSceneDirectoryOnceRenderHasStartedObserver = new Observer() {
|
Observer removeSceneDirectoryOnceRenderHasStartedObserver = new Observer() {
|
||||||
@Override
|
@Override public void update(Observable observable, Object o) {
|
||||||
public void update(Observable observable, Object o) {
|
|
||||||
// only remove the .blend since it's most important data
|
// only remove the .blend since it's most important data
|
||||||
// and it's the only file we are sure will not be needed anymore
|
// and it's the only file we are sure will not be needed anymore
|
||||||
scene_file.delete();
|
scene_file.delete();
|
||||||
@@ -666,11 +665,13 @@ public class Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected int downloadSceneFile(Job ajob_) throws FermeExceptionNoSpaceLeftOnDevice {
|
protected int downloadSceneFile(Job ajob_) throws FermeExceptionNoSpaceLeftOnDevice {
|
||||||
return this.downloadFile(ajob_, ajob_.getSceneArchivePath(), ajob_.getSceneMD5(), String.format("%s?type=job&job=%s", this.server.getPage("download-archive"), ajob_.getId()), "project");
|
return this.downloadFile(ajob_, ajob_.getSceneArchivePath(), ajob_.getSceneMD5(),
|
||||||
|
String.format("%s?type=job&job=%s", this.server.getPage("download-archive"), ajob_.getId()), "project");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int downloadExecutable(Job ajob) throws FermeExceptionNoSpaceLeftOnDevice {
|
protected int downloadExecutable(Job ajob) throws FermeExceptionNoSpaceLeftOnDevice {
|
||||||
return this.downloadFile(ajob, ajob.getRendererArchivePath(), ajob.getRendererMD5(), String.format("%s?type=binary&job=%s", this.server.getPage("download-archive"), ajob.getId()), "renderer");
|
return this.downloadFile(ajob, ajob.getRendererArchivePath(), ajob.getRendererMD5(),
|
||||||
|
String.format("%s?type=binary&job=%s", this.server.getPage("download-archive"), ajob.getId()), "renderer");
|
||||||
}
|
}
|
||||||
|
|
||||||
private int downloadFile(Job ajob, String local_path, String md5_server, String url, String download_type) throws FermeExceptionNoSpaceLeftOnDevice {
|
private int downloadFile(Job ajob, String local_path, String md5_server, String url, String download_type) throws FermeExceptionNoSpaceLeftOnDevice {
|
||||||
@@ -707,7 +708,8 @@ public class Client {
|
|||||||
attempts++;
|
attempts++;
|
||||||
|
|
||||||
if ((ret != 0 || md5_check == false) && attempts >= this.maxDownloadFileAttempts) {
|
if ((ret != 0 || md5_check == false) && attempts >= this.maxDownloadFileAttempts) {
|
||||||
this.log.debug("Client::downloadFile failed after " + this.maxDownloadFileAttempts + " attempts, removing local file (path: " + local_path + "), stopping...");
|
this.log.debug("Client::downloadFile failed after " + this.maxDownloadFileAttempts + " attempts, removing local file (path: " + local_path
|
||||||
|
+ "), stopping...");
|
||||||
local_path_file.delete();
|
local_path_file.delete();
|
||||||
return -9;
|
return -9;
|
||||||
}
|
}
|
||||||
@@ -727,7 +729,9 @@ public class Client {
|
|||||||
String md5_local = Utils.md5(local_path);
|
String md5_local = Utils.md5(local_path);
|
||||||
|
|
||||||
if (md5_local.equals(md5_server) == false) {
|
if (md5_local.equals(md5_server) == false) {
|
||||||
this.log.error("Client::checkFile mismatch on md5 local: '" + md5_local + "' server: '" + md5_server + "' (local size: " + new File(local_path).length() + ")");
|
this.log.error(
|
||||||
|
"Client::checkFile mismatch on md5 local: '" + md5_local + "' server: '" + md5_server + "' (local size: " + new File(local_path).length()
|
||||||
|
+ ")");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -755,7 +759,9 @@ public class Client {
|
|||||||
// unzip the archive
|
// unzip the archive
|
||||||
ret = Utils.unzipFileIntoDirectory(renderer_archive, renderer_path, null, log);
|
ret = Utils.unzipFileIntoDirectory(renderer_archive, renderer_path, null, log);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
this.log.error("Client::prepareWorkingDirectory, error(1) with Utils.unzipFileIntoDirectory(" + renderer_archive + ", " + renderer_path + ") returned " + ret);
|
this.log.error(
|
||||||
|
"Client::prepareWorkingDirectory, error(1) with Utils.unzipFileIntoDirectory(" + renderer_archive + ", " + renderer_path + ") returned "
|
||||||
|
+ ret);
|
||||||
this.gui.error(String.format("Unable to extract the renderer (error %d)", ret));
|
this.gui.error(String.format("Unable to extract the renderer (error %d)", ret));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -783,7 +789,9 @@ public class Client {
|
|||||||
// unzip the archive
|
// unzip the archive
|
||||||
ret = Utils.unzipFileIntoDirectory(scene_archive, scene_path, ajob.getPassword(), log);
|
ret = Utils.unzipFileIntoDirectory(scene_archive, scene_path, ajob.getPassword(), log);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
this.log.error("Client::prepareWorkingDirectory, error(2) with Utils.unzipFileIntoDirectory(" + scene_archive + ", " + scene_path + ") returned " + ret);
|
this.log.error(
|
||||||
|
"Client::prepareWorkingDirectory, error(2) with Utils.unzipFileIntoDirectory(" + scene_archive + ", " + scene_path + ") returned "
|
||||||
|
+ ret);
|
||||||
this.gui.error(String.format("Unable to extract the scene (error %d)", ret));
|
this.gui.error(String.format("Unable to extract the scene (error %d)", ret));
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@@ -793,7 +801,8 @@ public class Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Error.Type confirmJob(Job ajob) {
|
protected Error.Type confirmJob(Job ajob) {
|
||||||
String url_real = String.format("%s&rendertime=%d&memoryused=%s", ajob.getValidationUrl(), ajob.getProcessRender().getDuration(), ajob.getProcessRender().getMemoryUsed());
|
String url_real = String.format("%s&rendertime=%d&memoryused=%s", ajob.getValidationUrl(), ajob.getProcessRender().getDuration(),
|
||||||
|
ajob.getProcessRender().getMemoryUsed());
|
||||||
this.log.debug("Client::confirmeJob url " + url_real);
|
this.log.debug("Client::confirmeJob url " + url_real);
|
||||||
this.log.debug("path frame " + ajob.getOutputImagePath());
|
this.log.debug("path frame " + ajob.getOutputImagePath());
|
||||||
|
|
||||||
@@ -802,7 +811,8 @@ public class Client {
|
|||||||
int max_try = 3;
|
int max_try = 3;
|
||||||
ServerCode ret = ServerCode.UNKNOWN;
|
ServerCode ret = ServerCode.UNKNOWN;
|
||||||
Type confirmJobReturnCode = Error.Type.OK;
|
Type confirmJobReturnCode = Error.Type.OK;
|
||||||
retryLoop: while (nb_try < max_try && ret != ServerCode.OK) {
|
retryLoop:
|
||||||
|
while (nb_try < max_try && ret != ServerCode.OK) {
|
||||||
ret = this.server.HTTPSendFile(url_real, ajob.getOutputImagePath());
|
ret = this.server.HTTPSendFile(url_real, ajob.getOutputImagePath());
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case OK:
|
case OK:
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ import com.sheepit.client.hardware.gpu.GPUDevice;
|
|||||||
import com.sheepit.client.os.OS;
|
import com.sheepit.client.os.OS;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data public class Configuration {
|
||||||
public class Configuration {
|
|
||||||
public enum ComputeType {
|
public enum ComputeType {
|
||||||
CPU_GPU, CPU, GPU
|
CPU_GPU, CPU, GPU
|
||||||
} // accept job for ...
|
} // accept job for ...
|
||||||
@@ -95,7 +94,6 @@ public class Configuration {
|
|||||||
this.theme = null;
|
this.theme = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("Configuration (workingDirectory '%s')", this.workingDirectory.getAbsolutePath());
|
return String.format("Configuration (workingDirectory '%s')", this.workingDirectory.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,37 +22,14 @@ package com.sheepit.client;
|
|||||||
public class Error {
|
public class Error {
|
||||||
public enum Type {
|
public enum Type {
|
||||||
// id have to be kept synchronised with the server side.
|
// id have to be kept synchronised with the server side.
|
||||||
OK(0),
|
OK(0), UNKNOWN(99), WRONG_CONFIGURATION(1), AUTHENTICATION_FAILED(2), TOO_OLD_CLIENT(3), SESSION_DISABLED(4), RENDERER_NOT_AVAILABLE(
|
||||||
UNKNOWN(99),
|
5), MISSING_RENDERER(6), MISSING_SCENE(7), NOOUTPUTFILE(8), DOWNLOAD_FILE(9), CAN_NOT_CREATE_DIRECTORY(10), NETWORK_ISSUE(11), RENDERER_CRASHED(
|
||||||
WRONG_CONFIGURATION(1),
|
12), RENDERER_CRASHED_PYTHON_ERROR(24), RENDERER_OUT_OF_VIDEO_MEMORY(13), RENDERER_OUT_OF_MEMORY(21), RENDERER_KILLED(
|
||||||
AUTHENTICATION_FAILED(2),
|
14), RENDERER_KILLED_BY_USER(20), RENDERER_KILLED_BY_USER_OVER_TIME(23), RENDERER_KILLED_BY_SERVER(22), RENDERER_MISSING_LIBRARIES(
|
||||||
TOO_OLD_CLIENT(3),
|
15), FAILED_TO_EXECUTE(16), OS_NOT_SUPPORTED(17), CPU_NOT_SUPPORTED(18), GPU_NOT_SUPPORTED(19), VALIDATION_FAILED(25),
|
||||||
SESSION_DISABLED(4),
|
|
||||||
RENDERER_NOT_AVAILABLE(5),
|
|
||||||
MISSING_RENDERER(6),
|
|
||||||
MISSING_SCENE(7),
|
|
||||||
NOOUTPUTFILE(8),
|
|
||||||
DOWNLOAD_FILE(9),
|
|
||||||
CAN_NOT_CREATE_DIRECTORY(10),
|
|
||||||
NETWORK_ISSUE(11),
|
|
||||||
RENDERER_CRASHED(12),
|
|
||||||
RENDERER_CRASHED_PYTHON_ERROR(24),
|
|
||||||
RENDERER_OUT_OF_VIDEO_MEMORY(13),
|
|
||||||
RENDERER_OUT_OF_MEMORY(21),
|
|
||||||
RENDERER_KILLED(14),
|
|
||||||
RENDERER_KILLED_BY_USER(20),
|
|
||||||
RENDERER_KILLED_BY_USER_OVER_TIME(23),
|
|
||||||
RENDERER_KILLED_BY_SERVER(22),
|
|
||||||
RENDERER_MISSING_LIBRARIES(15),
|
|
||||||
FAILED_TO_EXECUTE(16),
|
|
||||||
OS_NOT_SUPPORTED(17),
|
|
||||||
CPU_NOT_SUPPORTED(18),
|
|
||||||
GPU_NOT_SUPPORTED(19),
|
|
||||||
VALIDATION_FAILED(25),
|
|
||||||
|
|
||||||
// internal error handling
|
// internal error handling
|
||||||
NO_SPACE_LEFT_ON_DEVICE(100),
|
NO_SPACE_LEFT_ON_DEVICE(100), ERROR_BAD_RESPONSE(101),
|
||||||
ERROR_BAD_RESPONSE(101),
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final int id;
|
private final int id;
|
||||||
@@ -67,36 +44,23 @@ public class Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum ServerCode {
|
public enum ServerCode {
|
||||||
OK(0),
|
OK(0), UNKNOWN(999),
|
||||||
UNKNOWN(999),
|
|
||||||
|
|
||||||
CONFIGURATION_ERROR_NO_CLIENT_VERSION_GIVEN(100),
|
CONFIGURATION_ERROR_NO_CLIENT_VERSION_GIVEN(100), CONFIGURATION_ERROR_CLIENT_TOO_OLD(101), CONFIGURATION_ERROR_AUTH_FAILED(
|
||||||
CONFIGURATION_ERROR_CLIENT_TOO_OLD(101),
|
102), CONFIGURATION_ERROR_WEB_SESSION_EXPIRED(103), CONFIGURATION_ERROR_MISSING_PARAMETER(104),
|
||||||
CONFIGURATION_ERROR_AUTH_FAILED(102),
|
|
||||||
CONFIGURATION_ERROR_WEB_SESSION_EXPIRED(103),
|
|
||||||
CONFIGURATION_ERROR_MISSING_PARAMETER(104),
|
|
||||||
|
|
||||||
JOB_REQUEST_NOJOB(200),
|
JOB_REQUEST_NOJOB(200), JOB_REQUEST_ERROR_NO_RENDERING_RIGHT(201), JOB_REQUEST_ERROR_DEAD_SESSION(202), JOB_REQUEST_ERROR_SESSION_DISABLED(
|
||||||
JOB_REQUEST_ERROR_NO_RENDERING_RIGHT(201),
|
203), JOB_REQUEST_ERROR_INTERNAL_ERROR(204), JOB_REQUEST_ERROR_RENDERER_NOT_AVAILABLE(205), JOB_REQUEST_SERVER_IN_MAINTENANCE(
|
||||||
JOB_REQUEST_ERROR_DEAD_SESSION(202),
|
206), JOB_REQUEST_SERVER_OVERLOADED(207),
|
||||||
JOB_REQUEST_ERROR_SESSION_DISABLED(203),
|
|
||||||
JOB_REQUEST_ERROR_INTERNAL_ERROR(204),
|
|
||||||
JOB_REQUEST_ERROR_RENDERER_NOT_AVAILABLE(205),
|
|
||||||
JOB_REQUEST_SERVER_IN_MAINTENANCE(206),
|
|
||||||
JOB_REQUEST_SERVER_OVERLOADED(207),
|
|
||||||
|
|
||||||
JOB_VALIDATION_ERROR_MISSING_PARAMETER(300),
|
JOB_VALIDATION_ERROR_MISSING_PARAMETER(300), JOB_VALIDATION_ERROR_BROKEN_MACHINE(301), // in GPU the generated frame is black
|
||||||
JOB_VALIDATION_ERROR_BROKEN_MACHINE(301), // in GPU the generated frame is black
|
JOB_VALIDATION_ERROR_FRAME_IS_NOT_IMAGE(302), JOB_VALIDATION_ERROR_UPLOAD_FAILED(303), JOB_VALIDATION_ERROR_SESSION_DISABLED(
|
||||||
JOB_VALIDATION_ERROR_FRAME_IS_NOT_IMAGE(302),
|
304), // missing heartbeat or broken machine
|
||||||
JOB_VALIDATION_ERROR_UPLOAD_FAILED(303),
|
|
||||||
JOB_VALIDATION_ERROR_SESSION_DISABLED(304), // missing heartbeat or broken machine
|
|
||||||
|
|
||||||
KEEPMEALIVE_STOP_RENDERING(400),
|
KEEPMEALIVE_STOP_RENDERING(400),
|
||||||
|
|
||||||
// internal error handling
|
// internal error handling
|
||||||
ERROR_NO_ROOT(2),
|
ERROR_NO_ROOT(2), ERROR_BAD_RESPONSE(3), ERROR_REQUEST_FAILED(5);
|
||||||
ERROR_BAD_RESPONSE(3),
|
|
||||||
ERROR_REQUEST_FAILED(5);
|
|
||||||
|
|
||||||
private final int id;
|
private final int id;
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ import com.sheepit.client.os.OS;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Data
|
@Data public class Job {
|
||||||
public class Job {
|
|
||||||
public static final String UPDATE_METHOD_BY_REMAINING_TIME = "remainingtime";
|
public static final String UPDATE_METHOD_BY_REMAINING_TIME = "remainingtime";
|
||||||
public static final String UPDATE_METHOD_BLENDER_INTERNAL_BY_PART = "blenderinternal";
|
public static final String UPDATE_METHOD_BLENDER_INTERNAL_BY_PART = "blenderinternal";
|
||||||
public static final String UPDATE_METHOD_BY_TILE = "by_tile";
|
public static final String UPDATE_METHOD_BY_TILE = "by_tile";
|
||||||
@@ -64,7 +63,7 @@ public class Job {
|
|||||||
private String rendererMD5;
|
private String rendererMD5;
|
||||||
private String id;
|
private String id;
|
||||||
private String outputImagePath;
|
private String outputImagePath;
|
||||||
private long outputImageSize;
|
private long outputImageSize;
|
||||||
private String path; // path inside of the archive
|
private String path; // path inside of the archive
|
||||||
private String rendererCommand;
|
private String rendererCommand;
|
||||||
private String validationUrl;
|
private String validationUrl;
|
||||||
@@ -83,7 +82,9 @@ public class Job {
|
|||||||
private Configuration configuration;
|
private Configuration configuration;
|
||||||
private Log log;
|
private Log log;
|
||||||
|
|
||||||
public Job(Configuration config_, Gui gui_, Log log_, String id_, String frame_, String path_, boolean use_gpu, String command_, String validationUrl_, String script_, String sceneMd5_, String rendererMd5_, String name_, String password_, String extras_, boolean synchronous_upload_, String update_method_) {
|
public Job(Configuration config_, Gui gui_, Log log_, String id_, String frame_, String path_, boolean use_gpu, String command_, String validationUrl_,
|
||||||
|
String script_, String sceneMd5_, String rendererMd5_, String name_, String password_, String extras_, boolean synchronous_upload_,
|
||||||
|
String update_method_) {
|
||||||
configuration = config_;
|
configuration = config_;
|
||||||
id = id_;
|
id = id_;
|
||||||
frameNumber = frame_;
|
frameNumber = frame_;
|
||||||
@@ -123,7 +124,9 @@ public class Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("Job (numFrame '%s' sceneMD5 '%s' rendererMD5 '%s' ID '%s' pictureFilename '%s' jobPath '%s' gpu %s name '%s' extras '%s' updateRenderingStatusMethod '%s' render %s)", frameNumber, sceneMD5, rendererMD5, id, outputImagePath, path, useGPU, name, extras, updateRenderingStatusMethod, render);
|
return String
|
||||||
|
.format("Job (numFrame '%s' sceneMD5 '%s' rendererMD5 '%s' ID '%s' pictureFilename '%s' jobPath '%s' gpu %s name '%s' extras '%s' updateRenderingStatusMethod '%s' render %s)",
|
||||||
|
frameNumber, sceneMD5, rendererMD5, id, outputImagePath, path, useGPU, name, extras, updateRenderingStatusMethod, render);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrefixOutputImage() {
|
public String getPrefixOutputImage() {
|
||||||
@@ -162,17 +165,14 @@ public class Job {
|
|||||||
// When sending Ctrl+C to the terminal it also get's sent to all subprocesses e.g. also the render process.
|
// When sending Ctrl+C to the terminal it also get's sent to all subprocesses e.g. also the render process.
|
||||||
// The java program handles Ctrl+C but the renderer quits on Ctrl+C.
|
// The java program handles Ctrl+C but the renderer quits on Ctrl+C.
|
||||||
// This script causes the renderer to ignore Ctrl+C.
|
// This script causes the renderer to ignore Ctrl+C.
|
||||||
String ignore_signal_script= "import signal\n"
|
String ignore_signal_script = "import signal\n" + "def hndl(signum, frame):\n" + " pass\n" + "signal.signal(signal.SIGINT, hndl)\n";
|
||||||
+ "def hndl(signum, frame):\n"
|
|
||||||
+ " pass\n"
|
|
||||||
+ "signal.signal(signal.SIGINT, hndl)\n";
|
|
||||||
if (isUseGPU() && configuration.getGPUDevice() != null && configuration.getComputeMethod() != ComputeType.CPU) {
|
if (isUseGPU() && configuration.getGPUDevice() != null && configuration.getComputeMethod() != ComputeType.CPU) {
|
||||||
// If using a GPU, check the proper tile size
|
// If using a GPU, check the proper tile size
|
||||||
int tileSize = configuration.getGPUDevice().getRenderbucketSize();
|
int tileSize = configuration.getGPUDevice().getRenderbucketSize();
|
||||||
|
|
||||||
core_script = "sheepit_set_compute_device(\"" + configuration.getGPUDevice().getType() + "\", \"GPU\", \"" + configuration.getGPUDevice().getId() + "\")\n";
|
core_script = "sheepit_set_compute_device(\"" + configuration.getGPUDevice().getType() + "\", \"GPU\", \"" + configuration.getGPUDevice().getId()
|
||||||
core_script += String.format("bpy.context.scene.render.tile_x = %1$d\nbpy.context.scene.render.tile_y = %1$d\n",
|
+ "\")\n";
|
||||||
tileSize);
|
core_script += String.format("bpy.context.scene.render.tile_x = %1$d\nbpy.context.scene.render.tile_y = %1$d\n", tileSize);
|
||||||
|
|
||||||
log.debug(String.format("Rendering bucket size set to %1$dx%1$d pixels", tileSize));
|
log.debug(String.format("Rendering bucket size set to %1$dx%1$d pixels", tileSize));
|
||||||
gui.setComputeMethod("GPU");
|
gui.setComputeMethod("GPU");
|
||||||
@@ -203,7 +203,8 @@ public class Job {
|
|||||||
new_env.put("PYTHONPATH", ""); // make sure blender is using the embedded python, if not it could create "Fatal Python error: Py_Initialize"
|
new_env.put("PYTHONPATH", ""); // make sure blender is using the embedded python, if not it could create "Fatal Python error: Py_Initialize"
|
||||||
new_env.put("PYTHONHOME", "");// make sure blender is using the embedded python, if not it could create "Fatal Python error: Py_Initialize"
|
new_env.put("PYTHONHOME", "");// make sure blender is using the embedded python, if not it could create "Fatal Python error: Py_Initialize"
|
||||||
|
|
||||||
if (isUseGPU() && configuration.getGPUDevice() != null && configuration.getComputeMethod() != ComputeType.CPU && OpenCL.TYPE.equals(configuration.getGPUDevice().getType())) {
|
if (isUseGPU() && configuration.getGPUDevice() != null && configuration.getComputeMethod() != ComputeType.CPU && OpenCL.TYPE
|
||||||
|
.equals(configuration.getGPUDevice().getType())) {
|
||||||
new_env.put("CYCLES_OPENCL_SPLIT_KERNEL_TEST", "1");
|
new_env.put("CYCLES_OPENCL_SPLIT_KERNEL_TEST", "1");
|
||||||
this.updateRenderingStatusMethod = UPDATE_METHOD_BY_TILE; // don't display remaining time
|
this.updateRenderingStatusMethod = UPDATE_METHOD_BY_TILE; // don't display remaining time
|
||||||
}
|
}
|
||||||
@@ -270,12 +271,11 @@ public class Job {
|
|||||||
if (configuration.getMaxRenderTime() > 0) {
|
if (configuration.getMaxRenderTime() > 0) {
|
||||||
timerOfMaxRenderTime = new Timer();
|
timerOfMaxRenderTime = new Timer();
|
||||||
timerOfMaxRenderTime.schedule(new TimerTask() {
|
timerOfMaxRenderTime.schedule(new TimerTask() {
|
||||||
@Override
|
@Override public void run() {
|
||||||
public void run() {
|
|
||||||
RenderProcess process = getProcessRender();
|
RenderProcess process = getProcessRender();
|
||||||
if (process != null) {
|
if (process != null) {
|
||||||
long duration = (new Date().getTime() - process.getStartTime() ) / 1000; // in seconds
|
long duration = (new Date().getTime() - process.getStartTime()) / 1000; // in seconds
|
||||||
if (configuration.getMaxRenderTime() > 0 && duration > configuration.getMaxRenderTime()) {
|
if (configuration.getMaxRenderTime() > 0 && duration > configuration.getMaxRenderTime()) {
|
||||||
log.debug("Killing render because process duration");
|
log.debug("Killing render because process duration");
|
||||||
OS.getOS().kill(process.getProcess());
|
OS.getOS().kill(process.getProcess());
|
||||||
setAskForRendererKill(true);
|
setAskForRendererKill(true);
|
||||||
@@ -289,7 +289,7 @@ public class Job {
|
|||||||
try {
|
try {
|
||||||
int progress = -1;
|
int progress = -1;
|
||||||
|
|
||||||
Pattern tilePattern = Pattern.compile(" ([0-9]+)\\s?\\/\\s?([0-9]+) ");
|
Pattern tilePattern = Pattern.compile(" ([0-9]+)\\s?\\/\\s?([0-9]+) ");
|
||||||
|
|
||||||
// Initialise the progress bar in the icon (0% completed at this time)
|
// Initialise the progress bar in the icon (0% completed at this time)
|
||||||
gui.updateTrayIcon(0);
|
gui.updateTrayIcon(0);
|
||||||
@@ -301,7 +301,8 @@ public class Job {
|
|||||||
|
|
||||||
updateRenderingMemoryPeak(line);
|
updateRenderingMemoryPeak(line);
|
||||||
if (configuration.getMaxMemory() != -1 && process.getMemoryUsed() > configuration.getMaxMemory()) {
|
if (configuration.getMaxMemory() != -1 && process.getMemoryUsed() > configuration.getMaxMemory()) {
|
||||||
log.debug("Blocking render because process ram used (" + process.getMemoryUsed() + "k) is over user setting (" + configuration.getMaxMemory() + "k)");
|
log.debug("Blocking render because process ram used (" + process.getMemoryUsed() + "k) is over user setting (" + configuration
|
||||||
|
.getMaxMemory() + "k)");
|
||||||
OS.getOS().kill(process.getProcess());
|
OS.getOS().kill(process.getProcess());
|
||||||
process.finish();
|
process.finish();
|
||||||
if (script_file != null) {
|
if (script_file != null) {
|
||||||
@@ -378,7 +379,7 @@ public class Job {
|
|||||||
if (isAskForRendererKill()) {
|
if (isAskForRendererKill()) {
|
||||||
log.debug("Job::render been asked to end render");
|
log.debug("Job::render been asked to end render");
|
||||||
|
|
||||||
long duration = (new Date().getTime() - process.getStartTime() ) / 1000; // in seconds
|
long duration = (new Date().getTime() - process.getStartTime()) / 1000; // in seconds
|
||||||
if (configuration.getMaxRenderTime() > 0 && duration > configuration.getMaxRenderTime()) {
|
if (configuration.getMaxRenderTime() > 0 && duration > configuration.getMaxRenderTime()) {
|
||||||
log.debug("Render killed because process duration (" + duration + "s) is over user setting (" + configuration.getMaxRenderTime() + "s)");
|
log.debug("Render killed because process duration (" + duration + "s) is over user setting (" + configuration.getMaxRenderTime() + "s)");
|
||||||
return Error.Type.RENDERER_KILLED_BY_USER_OVER_TIME;
|
return Error.Type.RENDERER_KILLED_BY_USER_OVER_TIME;
|
||||||
@@ -423,7 +424,7 @@ public class Job {
|
|||||||
else {
|
else {
|
||||||
setOutputImagePath(files[0].getAbsolutePath());
|
setOutputImagePath(files[0].getAbsolutePath());
|
||||||
this.outputImageSize = new File(getOutputImagePath()).length();
|
this.outputImageSize = new File(getOutputImagePath()).length();
|
||||||
log.debug(String.format("Job::render pictureFilename: %s, size: %d'",getOutputImagePath(), this.outputImageSize));
|
log.debug(String.format("Job::render pictureFilename: %s, size: %d'", getOutputImagePath(), this.outputImageSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
File scene_dir = new File(getSceneDirectory());
|
File scene_dir = new File(getSceneDirectory());
|
||||||
@@ -443,7 +444,7 @@ public class Job {
|
|||||||
|
|
||||||
if (standardTileInfo.find()) {
|
if (standardTileInfo.find()) {
|
||||||
int tileJustProcessed = Integer.parseInt(standardTileInfo.group(1));
|
int tileJustProcessed = Integer.parseInt(standardTileInfo.group(1));
|
||||||
int totalTilesInJob = Integer.parseInt(standardTileInfo.group(2));
|
int totalTilesInJob = Integer.parseInt(standardTileInfo.group(2));
|
||||||
|
|
||||||
newProgress = Math.abs((tileJustProcessed * 100) / totalTilesInJob);
|
newProgress = Math.abs((tileJustProcessed * 100) / totalTilesInJob);
|
||||||
}
|
}
|
||||||
@@ -822,8 +823,7 @@ public class Job {
|
|||||||
|
|
||||||
public static class renderStartedObservable extends Observable {
|
public static class renderStartedObservable extends Observable {
|
||||||
|
|
||||||
@Getter
|
@Getter private boolean isStarted;
|
||||||
private boolean isStarted;
|
|
||||||
|
|
||||||
public renderStartedObservable(Observer observer) {
|
public renderStartedObservable(Observer observer) {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@@ -19,35 +19,34 @@ package com.sheepit.client;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container to ease passing around a pair of two objects. This object provides a sensible
|
* Container to ease passing around a pair of two objects. This object provides a sensible
|
||||||
* implementation of equals(), returning true if equals() is true on each of the contained
|
* implementation of equals(), returning true if equals() is true on each of the contained
|
||||||
* objects.
|
* objects.
|
||||||
*/
|
*/
|
||||||
public class Pair<F, S> {
|
public class Pair<F, S> {
|
||||||
public final F first;
|
public final F first;
|
||||||
public final S second;
|
public final S second;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a Pair.
|
* Constructor for a Pair.
|
||||||
*
|
*
|
||||||
* @param first the first object in the Pair
|
* @param first the first object in the Pair
|
||||||
* @param second the second object in the pair
|
* @param second the second object in the pair
|
||||||
*/
|
*/
|
||||||
public Pair(F first, S second) {
|
public Pair(F first, S second) {
|
||||||
this.first = first;
|
this.first = first;
|
||||||
this.second = second;
|
this.second = second;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the two objects for equality by delegating to their respective
|
* Checks the two objects for equality by delegating to their respective
|
||||||
* {@link Object#equals(Object)} methods.
|
* {@link Object#equals(Object)} methods.
|
||||||
*
|
*
|
||||||
* @param o the {@link Pair} to which this one is to be checked for equality
|
* @param o the {@link Pair} to which this one is to be checked for equality
|
||||||
* @return true if the underlying objects of the Pair are both considered
|
* @return true if the underlying objects of the Pair are both considered
|
||||||
* equal
|
* equal
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override public boolean equals(Object o) {
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (!(o instanceof Pair)) {
|
if (!(o instanceof Pair)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -56,22 +55,21 @@ public class Pair<F, S> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute a hash code using the hash codes of the underlying objects
|
* Compute a hash code using the hash codes of the underlying objects
|
||||||
*
|
*
|
||||||
* @return a hashcode of the Pair
|
* @return a hashcode of the Pair
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override public int hashCode() {
|
||||||
public int hashCode() {
|
|
||||||
return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode());
|
return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method for creating an appropriately typed pair.
|
* Convenience method for creating an appropriately typed pair.
|
||||||
*
|
*
|
||||||
* @param a the first object in the Pair
|
* @param a the first object in the Pair
|
||||||
* @param b the second object in the pair
|
* @param b the second object in the pair
|
||||||
* @return a Pair that is templatized with the types of a and b
|
* @return a Pair that is templatized with the types of a and b
|
||||||
*/
|
*/
|
||||||
public static <A, B> Pair<A, B> create(A a, B b) {
|
public static <A, B> Pair<A, B> create(A a, B b) {
|
||||||
return new Pair<A, B>(a, b);
|
return new Pair<A, B>(a, b);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data public class RenderProcess {
|
||||||
public class RenderProcess {
|
|
||||||
private long startTime;
|
private long startTime;
|
||||||
private long endTime;
|
private long endTime;
|
||||||
private int remainingDuration; // in seconds
|
private int remainingDuration; // in seconds
|
||||||
@@ -42,7 +41,6 @@ public class RenderProcess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @return duration in seconds
|
* @return duration in seconds
|
||||||
*/
|
*/
|
||||||
public int getDuration() {
|
public int getDuration() {
|
||||||
|
|||||||
@@ -85,8 +85,7 @@ import com.sheepit.client.os.OS;
|
|||||||
public class Server extends Thread implements HostnameVerifier, X509TrustManager {
|
public class Server extends Thread implements HostnameVerifier, X509TrustManager {
|
||||||
private String base_url;
|
private String base_url;
|
||||||
|
|
||||||
@Getter
|
@Getter private ServerConfig serverConfig;
|
||||||
private ServerConfig serverConfig;
|
|
||||||
|
|
||||||
private Configuration user_config;
|
private Configuration user_config;
|
||||||
private Client client;
|
private Client client;
|
||||||
@@ -138,7 +137,8 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
if (serverCode == ServerCode.KEEPMEALIVE_STOP_RENDERING) {
|
if (serverCode == ServerCode.KEEPMEALIVE_STOP_RENDERING) {
|
||||||
this.log.debug("Server::stayAlive server asked to kill local render process");
|
this.log.debug("Server::stayAlive server asked to kill local render process");
|
||||||
// kill the current process, it will generate an error but it's okay
|
// kill the current process, it will generate an error but it's okay
|
||||||
if (this.client != null && this.client.getRenderingJob() != null && this.client.getRenderingJob().getProcessRender().getProcess() != null) {
|
if (this.client != null && this.client.getRenderingJob() != null
|
||||||
|
&& this.client.getRenderingJob().getProcessRender().getProcess() != null) {
|
||||||
this.client.getRenderingJob().setServerBlockJob(true);
|
this.client.getRenderingJob().setServerBlockJob(true);
|
||||||
this.client.getRenderingJob().setAskForRendererKill(true);
|
this.client.getRenderingJob().setAskForRendererKill(true);
|
||||||
OS.getOS().kill(this.client.getRenderingJob().getProcessRender().getProcess());
|
OS.getOS().kill(this.client.getRenderingJob().getProcessRender().getProcess());
|
||||||
@@ -185,20 +185,15 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
String publickey = null;
|
String publickey = null;
|
||||||
try {
|
try {
|
||||||
String url_remote = this.base_url + "/server/config.php";
|
String url_remote = this.base_url + "/server/config.php";
|
||||||
String parameters = String.format("login=%s&password=%s&cpu_family=%s&cpu_model=%s&cpu_model_name=%s&cpu_cores=%s&os=%s&ram=%s&bits=%s&version=%s&hostname=%s&ui=%s&extras=%s",
|
String parameters = String
|
||||||
URLEncoder.encode(this.user_config.getLogin(), "UTF-8"),
|
.format("login=%s&password=%s&cpu_family=%s&cpu_model=%s&cpu_model_name=%s&cpu_cores=%s&os=%s&ram=%s&bits=%s&version=%s&hostname=%s&ui=%s&extras=%s",
|
||||||
URLEncoder.encode(this.user_config.getPassword(), "UTF-8"),
|
URLEncoder.encode(this.user_config.getLogin(), "UTF-8"), URLEncoder.encode(this.user_config.getPassword(), "UTF-8"),
|
||||||
URLEncoder.encode(os.getCPU().family(), "UTF-8"),
|
URLEncoder.encode(os.getCPU().family(), "UTF-8"), URLEncoder.encode(os.getCPU().model(), "UTF-8"),
|
||||||
URLEncoder.encode(os.getCPU().model(), "UTF-8"),
|
URLEncoder.encode(os.getCPU().name(), "UTF-8"),
|
||||||
URLEncoder.encode(os.getCPU().name(), "UTF-8"),
|
((this.user_config.getNbCores() == -1) ? os.getCPU().cores() : this.user_config.getNbCores()),
|
||||||
((this.user_config.getNbCores() == -1) ? os.getCPU().cores() : this.user_config.getNbCores()),
|
URLEncoder.encode(os.name(), "UTF-8"), os.getMemory(), URLEncoder.encode(os.getCPU().arch(), "UTF-8"),
|
||||||
URLEncoder.encode(os.name(), "UTF-8"),
|
this.user_config.getJarVersion(), URLEncoder.encode(this.user_config.getHostname(), "UTF-8"),
|
||||||
os.getMemory(),
|
this.client.getGui().getClass().getSimpleName(), this.user_config.getExtras());
|
||||||
URLEncoder.encode(os.getCPU().arch(), "UTF-8"),
|
|
||||||
this.user_config.getJarVersion(),
|
|
||||||
URLEncoder.encode(this.user_config.getHostname(), "UTF-8"),
|
|
||||||
this.client.getGui().getClass().getSimpleName(),
|
|
||||||
this.user_config.getExtras());
|
|
||||||
this.log.debug("Server::getConfiguration url " + url_remote);
|
this.log.debug("Server::getConfiguration url " + url_remote);
|
||||||
|
|
||||||
connection = this.HTTPRequest(url_remote, parameters);
|
connection = this.HTTPRequest(url_remote, parameters);
|
||||||
@@ -268,7 +263,10 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
else if (freeMemory > 0 && maxMemory > 0) {
|
else if (freeMemory > 0 && maxMemory > 0) {
|
||||||
maxMemory = Math.min(maxMemory, freeMemory);
|
maxMemory = Math.min(maxMemory, freeMemory);
|
||||||
}
|
}
|
||||||
String url = String.format("%s?computemethod=%s&cpu_cores=%s&ram_max=%s&rendertime_max=%s", this.getPage("request-job"), this.user_config.computeMethodToInt(), ((this.user_config.getNbCores() == -1) ? os.getCPU().cores() : this.user_config.getNbCores()), maxMemory, this.user_config.getMaxRenderTime());
|
String url = String
|
||||||
|
.format("%s?computemethod=%s&cpu_cores=%s&ram_max=%s&rendertime_max=%s", this.getPage("request-job"), this.user_config.computeMethodToInt(),
|
||||||
|
((this.user_config.getNbCores() == -1) ? os.getCPU().cores() : this.user_config.getNbCores()), maxMemory,
|
||||||
|
this.user_config.getMaxRenderTime());
|
||||||
if (this.user_config.getComputeMethod() != ComputeType.CPU && this.user_config.getGPUDevice() != null) {
|
if (this.user_config.getComputeMethod() != ComputeType.CPU && this.user_config.getGPUDevice() != null) {
|
||||||
String gpu_model = "";
|
String gpu_model = "";
|
||||||
try {
|
try {
|
||||||
@@ -276,7 +274,8 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException e) {
|
catch (UnsupportedEncodingException e) {
|
||||||
}
|
}
|
||||||
url += "&gpu_model=" + gpu_model + "&gpu_ram=" + this.user_config.getGPUDevice().getMemory() + "&gpu_type=" + this.user_config.getGPUDevice().getType();
|
url += "&gpu_model=" + gpu_model + "&gpu_ram=" + this.user_config.getGPUDevice().getMemory() + "&gpu_type=" + this.user_config.getGPUDevice()
|
||||||
|
.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
connection = this.HTTPRequest(url, this.generateXMLForMD5cache());
|
connection = this.HTTPRequest(url, this.generateXMLForMD5cache());
|
||||||
@@ -292,13 +291,10 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
handleFileMD5DeleteDocument(jobData.getFileMD5s());
|
handleFileMD5DeleteDocument(jobData.getFileMD5s());
|
||||||
|
|
||||||
if (jobData.getSessionStats() != null) {
|
if (jobData.getSessionStats() != null) {
|
||||||
this.client.getGui().displayStats(new Stats(
|
this.client.getGui().displayStats(
|
||||||
jobData.getSessionStats().getRemainingFrames(),
|
new Stats(jobData.getSessionStats().getRemainingFrames(), jobData.getSessionStats().getPointsEarnedByUser(),
|
||||||
jobData.getSessionStats().getPointsEarnedByUser(),
|
jobData.getSessionStats().getPointsEarnedOnSession(), jobData.getSessionStats().getRenderableProjects(),
|
||||||
jobData.getSessionStats().getPointsEarnedOnSession(),
|
jobData.getSessionStats().getWaitingProjects(), jobData.getSessionStats().getConnectedMachines()));
|
||||||
jobData.getSessionStats().getRenderableProjects(),
|
|
||||||
jobData.getSessionStats().getWaitingProjects(),
|
|
||||||
jobData.getSessionStats().getConnectedMachines()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerCode serverCode = ServerCode.fromInt(jobData.getStatus());
|
ServerCode serverCode = ServerCode.fromInt(jobData.getStatus());
|
||||||
@@ -328,13 +324,15 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
String script = "import bpy\n";
|
String script = "import bpy\n";
|
||||||
// blender 2.7x
|
// blender 2.7x
|
||||||
script += "try:\n";
|
script += "try:\n";
|
||||||
script += "\tbpy.context.user_preferences.filepaths.temporary_directory = \"" + this.user_config.getWorkingDirectory().getAbsolutePath().replace("\\", "\\\\") + "\"\n";
|
script += "\tbpy.context.user_preferences.filepaths.temporary_directory = \"" + this.user_config.getWorkingDirectory().getAbsolutePath()
|
||||||
|
.replace("\\", "\\\\") + "\"\n";
|
||||||
script += "except AttributeError:\n";
|
script += "except AttributeError:\n";
|
||||||
script += "\tpass\n";
|
script += "\tpass\n";
|
||||||
|
|
||||||
// blender 2.80
|
// blender 2.80
|
||||||
script += "try:\n";
|
script += "try:\n";
|
||||||
script += "\tbpy.context.preferences.filepaths.temporary_directory = \"" + this.user_config.getWorkingDirectory().getAbsolutePath().replace("\\", "\\\\") + "\"\n";
|
script += "\tbpy.context.preferences.filepaths.temporary_directory = \"" + this.user_config.getWorkingDirectory().getAbsolutePath()
|
||||||
|
.replace("\\", "\\\\") + "\"\n";
|
||||||
script += "except AttributeError:\n";
|
script += "except AttributeError:\n";
|
||||||
script += "\tpass\n";
|
script += "\tpass\n";
|
||||||
|
|
||||||
@@ -342,31 +340,18 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
|
|
||||||
String validationUrl = URLDecoder.decode(jobData.getRenderTask().getValidationUrl(), "UTF-8");
|
String validationUrl = URLDecoder.decode(jobData.getRenderTask().getValidationUrl(), "UTF-8");
|
||||||
|
|
||||||
Job a_job = new Job(
|
Job a_job = new Job(this.user_config, this.client.getGui(), this.client.getLog(), jobData.getRenderTask().getId(),
|
||||||
this.user_config,
|
jobData.getRenderTask().getFrame(), jobData.getRenderTask().getPath().replace("/", File.separator),
|
||||||
this.client.getGui(),
|
jobData.getRenderTask().getUseGpu() == 1, jobData.getRenderTask().getRendererInfos().getCommandline(), validationUrl, script,
|
||||||
this.client.getLog(),
|
jobData.getRenderTask().getArchive_md5(), jobData.getRenderTask().getRendererInfos().getMd5(), jobData.getRenderTask().getName(),
|
||||||
jobData.getRenderTask().getId(),
|
jobData.getRenderTask().getPassword(), jobData.getRenderTask().getExtras(), jobData.getRenderTask().getSynchronous_upload().equals("1"),
|
||||||
jobData.getRenderTask().getFrame(),
|
jobData.getRenderTask().getRendererInfos().getUpdate_method());
|
||||||
jobData.getRenderTask().getPath().replace("/", File.separator),
|
|
||||||
jobData.getRenderTask().getUseGpu() == 1,
|
|
||||||
jobData.getRenderTask().getRendererInfos().getCommandline(),
|
|
||||||
validationUrl,
|
|
||||||
script,
|
|
||||||
jobData.getRenderTask().getArchive_md5(),
|
|
||||||
jobData.getRenderTask().getRendererInfos().getMd5(),
|
|
||||||
jobData.getRenderTask().getName(),
|
|
||||||
jobData.getRenderTask().getPassword(),
|
|
||||||
jobData.getRenderTask().getExtras(),
|
|
||||||
jobData.getRenderTask().getSynchronous_upload().equals("1"),
|
|
||||||
jobData.getRenderTask().getRendererInfos().getUpdate_method()
|
|
||||||
);
|
|
||||||
|
|
||||||
return a_job;
|
return a_job;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Server::requestJob url " + url_contents + " r " + r + " contentType " + contentType);
|
System.out.println("Server::requestJob url " + url_contents + " r " + r + " contentType " + contentType);
|
||||||
if (r == HttpURLConnection.HTTP_UNAVAILABLE || r == HttpURLConnection. HTTP_CLIENT_TIMEOUT) {
|
if (r == HttpURLConnection.HTTP_UNAVAILABLE || r == HttpURLConnection.HTTP_CLIENT_TIMEOUT) {
|
||||||
// most likely varnish is up but apache down
|
// most likely varnish is up but apache down
|
||||||
throw new FermeServerDown();
|
throw new FermeServerDown();
|
||||||
}
|
}
|
||||||
@@ -724,7 +709,7 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
|
|
||||||
private void handleFileMD5DeleteDocument(List<FileMD5> fileMD5s) {
|
private void handleFileMD5DeleteDocument(List<FileMD5> fileMD5s) {
|
||||||
if (fileMD5s != null && fileMD5s.isEmpty() == false) {
|
if (fileMD5s != null && fileMD5s.isEmpty() == false) {
|
||||||
for(FileMD5 fileMD5 : fileMD5s) {
|
for (FileMD5 fileMD5 : fileMD5s) {
|
||||||
if ("delete".equals(fileMD5.getAction()) && fileMD5.getMd5() != null && fileMD5.getMd5().isEmpty() == false) {
|
if ("delete".equals(fileMD5.getAction()) && fileMD5.getMd5() != null && fileMD5.getMd5().isEmpty() == false) {
|
||||||
String path = this.user_config.getWorkingDirectory().getAbsolutePath() + File.separatorChar + fileMD5.getMd5();
|
String path = this.user_config.getWorkingDirectory().getAbsolutePath() + File.separatorChar + fileMD5.getMd5();
|
||||||
this.log.debug("Server::handleFileMD5DeleteDocument delete old file " + path);
|
this.log.debug("Server::handleFileMD5DeleteDocument delete old file " + path);
|
||||||
@@ -746,21 +731,17 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
|
||||||
public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
|
||||||
public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public X509Certificate[] getAcceptedIssuers() {
|
||||||
public X509Certificate[] getAcceptedIssuers() {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public boolean verify(String arg0, SSLSession arg1) {
|
||||||
public boolean verify(String arg0, SSLSession arg1) {
|
|
||||||
return true; // trust every ssl certificate
|
return true; // trust every ssl certificate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,7 @@ public class SettingsLoader {
|
|||||||
|
|
||||||
private String login;
|
private String login;
|
||||||
|
|
||||||
@Setter
|
@Setter private String password;
|
||||||
private String password;
|
|
||||||
|
|
||||||
private String proxy;
|
private String proxy;
|
||||||
private String hostname;
|
private String hostname;
|
||||||
@@ -58,7 +57,7 @@ public class SettingsLoader {
|
|||||||
private String autoSignIn;
|
private String autoSignIn;
|
||||||
private String ui;
|
private String ui;
|
||||||
private String theme;
|
private String theme;
|
||||||
private int priority;
|
private int priority;
|
||||||
|
|
||||||
public SettingsLoader(String path_) {
|
public SettingsLoader(String path_) {
|
||||||
if (path_ == null) {
|
if (path_ == null) {
|
||||||
@@ -69,7 +68,9 @@ public class SettingsLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SettingsLoader(String path_, String login_, String password_, String proxy_, String hostname_, ComputeType computeMethod_, GPUDevice gpu_, int renderbucketSize_, int cores_, long maxRam_, int maxRenderTime_, String cacheDir_, boolean autoSignIn_, String ui_, String theme_, int priority_) {
|
public SettingsLoader(String path_, String login_, String password_, String proxy_, String hostname_, ComputeType computeMethod_, GPUDevice gpu_,
|
||||||
|
int renderbucketSize_, int cores_, long maxRam_, int maxRenderTime_, String cacheDir_, boolean autoSignIn_, String ui_, String theme_,
|
||||||
|
int priority_) {
|
||||||
if (path_ == null) {
|
if (path_ == null) {
|
||||||
path = getDefaultFilePath();
|
path = getDefaultFilePath();
|
||||||
}
|
}
|
||||||
@@ -350,7 +351,8 @@ public class SettingsLoader {
|
|||||||
config.setUsePriority(priority);
|
config.setUsePriority(priority);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if ((config.getComputeMethod() == null && computeMethod != null) || (computeMethod != null && config.getComputeMethod() != ComputeType.valueOf(computeMethod))) {
|
if ((config.getComputeMethod() == null && computeMethod != null) || (computeMethod != null && config.getComputeMethod() != ComputeType
|
||||||
|
.valueOf(computeMethod))) {
|
||||||
config.setComputeMethod(ComputeType.valueOf(computeMethod));
|
config.setComputeMethod(ComputeType.valueOf(computeMethod));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -406,7 +408,8 @@ public class SettingsLoader {
|
|||||||
if (config.getTheme() == null) {
|
if (config.getTheme() == null) {
|
||||||
if (this.theme != null) {
|
if (this.theme != null) {
|
||||||
config.setTheme(this.theme);
|
config.setTheme(this.theme);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
config.setTheme("light");
|
config.setTheme("light");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -414,8 +417,8 @@ public class SettingsLoader {
|
|||||||
config.setAutoSignIn(Boolean.valueOf(autoSignIn));
|
config.setAutoSignIn(Boolean.valueOf(autoSignIn));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String toString() {
|
||||||
public String toString() {
|
return "SettingsLoader [path=" + path + ", login=" + login + ", password=" + password + ", computeMethod=" + computeMethod + ", gpu=" + gpu
|
||||||
return "SettingsLoader [path=" + path + ", login=" + login + ", password=" + password + ", computeMethod=" + computeMethod + ", gpu=" + gpu + ", renderbucket-size=" + renderbucketSize + ", cacheDir=" + cacheDir + ", theme=" + theme + ", priority=" + priority + "]";
|
+ ", renderbucket-size=" + renderbucketSize + ", cacheDir=" + cacheDir + ", theme=" + theme + ", priority=" + priority + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ public class ShutdownHook {
|
|||||||
|
|
||||||
public void attachShutDownHook() {
|
public void attachShutDownHook() {
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||||
@Override
|
@Override public void run() {
|
||||||
public void run() {
|
|
||||||
_client.stop();
|
_client.stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ public class Stats {
|
|||||||
return connectedMachine;
|
return connectedMachine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String toString() {
|
||||||
public String toString() {
|
return "Stats [remainingFrame=" + remainingFrame + ", creditsEarned=" + creditsEarned + ", creditsEarnedSession=" + creditsEarnedSession
|
||||||
return "Stats [remainingFrame=" + remainingFrame + ", creditsEarned=" + creditsEarned + ", creditsEarnedSession=" + creditsEarnedSession + ", renderableProject=" + renderableProject + ", waitingProject=" + waitingProject + ", connectedMachine=" + connectedMachine + "]";
|
+ ", renderableProject=" + renderableProject + ", waitingProject=" + waitingProject + ", connectedMachine=" + connectedMachine + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ import com.sheepit.client.Error.ServerCode;
|
|||||||
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
|
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
public static int unzipFileIntoDirectory(String zipFileName_, String destinationDirectory, String password, Log log) throws FermeExceptionNoSpaceLeftOnDevice {
|
public static int unzipFileIntoDirectory(String zipFileName_, String destinationDirectory, String password, Log log)
|
||||||
|
throws FermeExceptionNoSpaceLeftOnDevice {
|
||||||
try {
|
try {
|
||||||
ZipFile zipFile = new ZipFile(zipFileName_);
|
ZipFile zipFile = new ZipFile(zipFileName_);
|
||||||
UnzipParameters unzipParameters = new UnzipParameters();
|
UnzipParameters unzipParameters = new UnzipParameters();
|
||||||
|
|||||||
@@ -7,13 +7,9 @@ import org.simpleframework.xml.Root;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Root(strict = false, name = "cache")
|
@Root(strict = false, name = "cache") @Data @ToString public class CacheFileMD5 {
|
||||||
@Data
|
|
||||||
@ToString
|
|
||||||
public class CacheFileMD5 {
|
|
||||||
|
|
||||||
@ElementList(inline = true)
|
@ElementList(inline = true) private List<FileMD5> md5s;
|
||||||
private List<FileMD5> md5s;
|
|
||||||
|
|
||||||
public CacheFileMD5() {
|
public CacheFileMD5() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,11 @@ import lombok.ToString;
|
|||||||
import org.simpleframework.xml.Attribute;
|
import org.simpleframework.xml.Attribute;
|
||||||
import org.simpleframework.xml.Root;
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
@Root(strict = false, name = "file")
|
@Root(strict = false, name = "file") @Data @ToString public class FileMD5 {
|
||||||
@Data
|
|
||||||
@ToString
|
|
||||||
public class FileMD5 {
|
|
||||||
|
|
||||||
@Attribute
|
@Attribute private String md5;
|
||||||
private String md5;
|
|
||||||
|
|
||||||
@Attribute(required = false)
|
@Attribute(required = false) private String action;
|
||||||
private String action;
|
|
||||||
|
|
||||||
public FileMD5() {
|
public FileMD5() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,6 @@ import lombok.ToString;
|
|||||||
import org.simpleframework.xml.Attribute;
|
import org.simpleframework.xml.Attribute;
|
||||||
import org.simpleframework.xml.Root;
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
@Root(strict = false, name = "keepmealive")
|
@Root(strict = false, name = "keepmealive") @ToString public class HeartBeatInfos {
|
||||||
@ToString
|
@Attribute @Getter private int status;
|
||||||
public class HeartBeatInfos {
|
|
||||||
@Attribute
|
|
||||||
@Getter
|
|
||||||
private int status;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,25 +9,15 @@ import org.simpleframework.xml.Root;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Root(strict = false, name = "jobrequest")
|
@Root(strict = false, name = "jobrequest") @ToString public class JobInfos {
|
||||||
@ToString
|
|
||||||
public class JobInfos {
|
|
||||||
|
|
||||||
@Attribute
|
@Attribute @Getter private int status;
|
||||||
@Getter
|
|
||||||
private int status;
|
|
||||||
|
|
||||||
@Element(name = "stats", required = false)
|
@Element(name = "stats", required = false) @Getter private SessionStats sessionStats;
|
||||||
@Getter
|
|
||||||
private SessionStats sessionStats;
|
|
||||||
|
|
||||||
@Element(name = "job", required = false)
|
@Element(name = "job", required = false) @Getter() private RenderTask renderTask;
|
||||||
@Getter()
|
|
||||||
private RenderTask renderTask;
|
|
||||||
|
|
||||||
@ElementList(name = "file", inline = true, required = false)
|
@ElementList(name = "file", inline = true, required = false) @Getter private List<FileMD5> fileMD5s;
|
||||||
@Getter
|
|
||||||
private List<FileMD5> fileMD5s;
|
|
||||||
|
|
||||||
public JobInfos() {
|
public JobInfos() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,9 @@ import lombok.ToString;
|
|||||||
import org.simpleframework.xml.Attribute;
|
import org.simpleframework.xml.Attribute;
|
||||||
import org.simpleframework.xml.Root;
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
@Root(strict = false, name = "jobvalidate")
|
@Root(strict = false, name = "jobvalidate") @ToString public class JobValidation {
|
||||||
@ToString
|
|
||||||
public class JobValidation {
|
|
||||||
|
|
||||||
@Attribute
|
@Attribute @Getter private int status;
|
||||||
@Getter
|
|
||||||
private int status;
|
|
||||||
|
|
||||||
public JobValidation() {
|
public JobValidation() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,57 +6,31 @@ import org.simpleframework.xml.Attribute;
|
|||||||
import org.simpleframework.xml.Element;
|
import org.simpleframework.xml.Element;
|
||||||
import org.simpleframework.xml.Root;
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
@Root(strict = false, name = "job")
|
@Root(strict = false, name = "job") @ToString public class RenderTask {
|
||||||
@ToString
|
|
||||||
public class RenderTask {
|
|
||||||
|
|
||||||
@Attribute(name = "id")
|
@Attribute(name = "id") @Getter private String id;
|
||||||
@Getter
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@Attribute(name = "use_gpu")
|
@Attribute(name = "use_gpu") @Getter private int useGpu;
|
||||||
@Getter
|
|
||||||
private int useGpu;
|
|
||||||
|
|
||||||
@Attribute(name = "archive_md5")
|
@Attribute(name = "archive_md5") @Getter private String archive_md5;
|
||||||
@Getter
|
|
||||||
private String archive_md5;
|
|
||||||
|
|
||||||
@Attribute(name = "path")
|
@Attribute(name = "path") @Getter private String path;
|
||||||
@Getter
|
|
||||||
private String path;
|
|
||||||
|
|
||||||
@Attribute(name = "frame")
|
@Attribute(name = "frame") @Getter private String frame;
|
||||||
@Getter
|
|
||||||
private String frame;
|
|
||||||
|
|
||||||
@Attribute(name = "synchronous_upload")
|
@Attribute(name = "synchronous_upload") @Getter private String synchronous_upload;
|
||||||
@Getter
|
|
||||||
private String synchronous_upload;
|
|
||||||
|
|
||||||
@Attribute(name = "extras")
|
@Attribute(name = "extras") @Getter private String extras;
|
||||||
@Getter
|
|
||||||
private String extras;
|
|
||||||
|
|
||||||
@Attribute(name = "validation_url")
|
@Attribute(name = "validation_url") @Getter private String validationUrl;
|
||||||
@Getter
|
|
||||||
private String validationUrl;
|
|
||||||
|
|
||||||
@Attribute(name = "name")
|
@Attribute(name = "name") @Getter private String name;
|
||||||
@Getter
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Attribute(name = "password")
|
@Attribute(name = "password") @Getter private String password;
|
||||||
@Getter
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
@Element(name = "renderer")
|
@Element(name = "renderer") @Getter private RendererInfos rendererInfos;
|
||||||
@Getter
|
|
||||||
private RendererInfos rendererInfos;
|
|
||||||
|
|
||||||
@Element(name = "script", data = true)
|
@Element(name = "script", data = true) @Getter private String script;
|
||||||
@Getter
|
|
||||||
private String script;
|
|
||||||
|
|
||||||
public RenderTask() {
|
public RenderTask() {
|
||||||
|
|
||||||
|
|||||||
@@ -5,21 +5,13 @@ import lombok.ToString;
|
|||||||
import org.simpleframework.xml.Attribute;
|
import org.simpleframework.xml.Attribute;
|
||||||
import org.simpleframework.xml.Root;
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
@Root(strict = false, name = "renderer")
|
@Root(strict = false, name = "renderer") @ToString public class RendererInfos {
|
||||||
@ToString
|
|
||||||
public class RendererInfos {
|
|
||||||
|
|
||||||
@Attribute(name = "md5")
|
@Attribute(name = "md5") @Getter private String md5;
|
||||||
@Getter
|
|
||||||
private String md5;
|
|
||||||
|
|
||||||
@Attribute(name = "commandline")
|
@Attribute(name = "commandline") @Getter private String commandline;
|
||||||
@Getter
|
|
||||||
private String commandline;
|
|
||||||
|
|
||||||
@Attribute(name = "update_method")
|
@Attribute(name = "update_method") @Getter private String update_method;
|
||||||
@Getter
|
|
||||||
private String update_method;
|
|
||||||
|
|
||||||
public RendererInfos() {
|
public RendererInfos() {
|
||||||
|
|
||||||
|
|||||||
@@ -5,21 +5,13 @@ import lombok.ToString;
|
|||||||
import org.simpleframework.xml.Attribute;
|
import org.simpleframework.xml.Attribute;
|
||||||
import org.simpleframework.xml.Root;
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
@Root(strict = false, name = "request")
|
@Root(strict = false, name = "request") @ToString public class RequestEndPoint {
|
||||||
@ToString
|
|
||||||
public class RequestEndPoint {
|
|
||||||
|
|
||||||
@Attribute
|
@Attribute @Getter private String type;
|
||||||
@Getter
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
@Attribute
|
@Attribute @Getter private String path;
|
||||||
@Getter
|
|
||||||
private String path;
|
|
||||||
|
|
||||||
@Attribute(name = "max-period", required = false)
|
@Attribute(name = "max-period", required = false) @Getter private int maxPeriod;
|
||||||
@Getter
|
|
||||||
private int maxPeriod;
|
|
||||||
|
|
||||||
public RequestEndPoint() {
|
public RequestEndPoint() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,20 +8,13 @@ import org.simpleframework.xml.Root;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Root(strict = false, name = "config")
|
@Root(strict = false, name = "config") @ToString public class ServerConfig {
|
||||||
@ToString
|
|
||||||
public class ServerConfig {
|
|
||||||
|
|
||||||
@Attribute
|
@Attribute @Getter private int status;
|
||||||
@Getter
|
|
||||||
private int status;
|
|
||||||
|
|
||||||
@Attribute(required = false)
|
@Attribute(required = false) @Getter private String publickey;
|
||||||
@Getter
|
|
||||||
private String publickey;
|
|
||||||
|
|
||||||
@ElementList(name = "request", inline = true, required = false)
|
@ElementList(name = "request", inline = true, required = false) private List<RequestEndPoint> requestEndPoints;
|
||||||
private List<RequestEndPoint> requestEndPoints;
|
|
||||||
|
|
||||||
public ServerConfig() {
|
public ServerConfig() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,33 +5,19 @@ import lombok.ToString;
|
|||||||
import org.simpleframework.xml.Attribute;
|
import org.simpleframework.xml.Attribute;
|
||||||
import org.simpleframework.xml.Root;
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
@Root(strict = false, name = "stats")
|
@Root(strict = false, name = "stats") @ToString public class SessionStats {
|
||||||
@ToString
|
|
||||||
public class SessionStats {
|
|
||||||
|
|
||||||
@Attribute(name = "credits_session")
|
@Attribute(name = "credits_session") @Getter private int pointsEarnedOnSession;
|
||||||
@Getter
|
|
||||||
private int pointsEarnedOnSession;
|
|
||||||
|
|
||||||
@Attribute(name = "credits_total")
|
@Attribute(name = "credits_total") @Getter private int pointsEarnedByUser;
|
||||||
@Getter
|
|
||||||
private int pointsEarnedByUser;
|
|
||||||
|
|
||||||
@Attribute(name = "frame_remaining")
|
@Attribute(name = "frame_remaining") @Getter private int remainingFrames;
|
||||||
@Getter
|
|
||||||
private int remainingFrames;
|
|
||||||
|
|
||||||
@Attribute(name = "waiting_project")
|
@Attribute(name = "waiting_project") @Getter private int waitingProjects;
|
||||||
@Getter
|
|
||||||
private int waitingProjects;
|
|
||||||
|
|
||||||
@Attribute(name = "renderable_project", required = false)
|
@Attribute(name = "renderable_project", required = false) @Getter private int renderableProjects;
|
||||||
@Getter
|
|
||||||
private int renderableProjects;
|
|
||||||
|
|
||||||
@Attribute(name = "connected_machine")
|
@Attribute(name = "connected_machine") @Getter private int connectedMachines;
|
||||||
@Getter
|
|
||||||
private int connectedMachines;
|
|
||||||
|
|
||||||
public SessionStats() {
|
public SessionStats() {
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package com.sheepit.client.exception;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Server down (server side error) or unreachable (client side error)
|
* Server down (server side error) or unreachable (client side error)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class FermeServerDown extends FermeException {
|
public class FermeServerDown extends FermeException {
|
||||||
public FermeServerDown() {
|
public FermeServerDown() {
|
||||||
|
|||||||
@@ -120,8 +120,7 @@ public class GPUDevice {
|
|||||||
this.renderBucketSize = renderBucketSize;
|
this.renderBucketSize = renderBucketSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String toString() {
|
||||||
public String toString() {
|
|
||||||
return "GPUDevice [type=" + type + ", model='" + model + "', memory=" + memory + ", id=" + id + ", renderbucketSize=" + renderBucketSize + "]";
|
return "GPUDevice [type=" + type + ", model='" + model + "', memory=" + memory + ", id=" + id + ", renderbucketSize=" + renderBucketSize + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,16 +28,17 @@ public interface CUDA extends Library {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @return: CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
|
* @return: CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
|
||||||
*/
|
*/
|
||||||
public int cuDeviceGetCount(IntByReference count);
|
public int cuDeviceGetCount(IntByReference count);
|
||||||
|
|
||||||
public int cuDeviceGetName(byte[] name, int len, int dev);
|
public int cuDeviceGetName(byte[] name, int len, int dev);
|
||||||
|
|
||||||
public int cuDeviceGet (IntByReference device, int ordinal);
|
public int cuDeviceGet(IntByReference device, int ordinal);
|
||||||
|
|
||||||
public int cuDeviceGetAttribute (IntByReference pi, int attrib, int dev );
|
public int cuDeviceGetAttribute(IntByReference pi, int attrib, int dev);
|
||||||
|
|
||||||
public int cuDeviceTotalMem_v2(LongByReference bytes, int dev);
|
public int cuDeviceTotalMem_v2(LongByReference bytes, int dev);
|
||||||
|
|
||||||
public int cuDeviceTotalMem(LongByReference bytes, int dev);
|
public int cuDeviceTotalMem(LongByReference bytes, int dev);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ import com.sun.jna.ptr.LongByReference;
|
|||||||
public class Nvidia implements GPULister {
|
public class Nvidia implements GPULister {
|
||||||
public static String TYPE = "CUDA";
|
public static String TYPE = "CUDA";
|
||||||
|
|
||||||
@Override
|
@Override public List<GPUDevice> getGpus() {
|
||||||
public List<GPUDevice> getGpus() {
|
|
||||||
OS os = OS.getOS();
|
OS os = OS.getOS();
|
||||||
String path = os.getCUDALib();
|
String path = os.getCUDALib();
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
@@ -66,7 +65,7 @@ public class Nvidia implements GPULister {
|
|||||||
for (int num = 0; num < count.getValue(); num++) {
|
for (int num = 0; num < count.getValue(); num++) {
|
||||||
IntByReference aDevice = new IntByReference();
|
IntByReference aDevice = new IntByReference();
|
||||||
|
|
||||||
result = cudalib.cuDeviceGet(aDevice, num);
|
result = cudalib.cuDeviceGet(aDevice, num);
|
||||||
if (result != CUresult.CUDA_SUCCESS) {
|
if (result != CUresult.CUDA_SUCCESS) {
|
||||||
System.out.println("Nvidia::getGpus cuDeviceGet failed (ret: " + CUresult.stringFor(result) + ")");
|
System.out.println("Nvidia::getGpus cuDeviceGet failed (ret: " + CUresult.stringFor(result) + ")");
|
||||||
continue;
|
continue;
|
||||||
@@ -75,19 +74,21 @@ public class Nvidia implements GPULister {
|
|||||||
IntByReference pciDomainId = new IntByReference();
|
IntByReference pciDomainId = new IntByReference();
|
||||||
IntByReference pciBusId = new IntByReference();
|
IntByReference pciBusId = new IntByReference();
|
||||||
IntByReference pciDeviceId = new IntByReference();
|
IntByReference pciDeviceId = new IntByReference();
|
||||||
result = cudalib.cuDeviceGetAttribute(pciDomainId, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, aDevice.getValue());
|
result = cudalib.cuDeviceGetAttribute(pciDomainId, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, aDevice.getValue());
|
||||||
if (result != CUresult.CUDA_SUCCESS) {
|
if (result != CUresult.CUDA_SUCCESS) {
|
||||||
System.out.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID failed (ret: " + CUresult.stringFor(result) + ")");
|
System.out
|
||||||
|
.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID failed (ret: " + CUresult.stringFor(result) + ")");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result = cudalib.cuDeviceGetAttribute(pciBusId, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, aDevice.getValue());
|
result = cudalib.cuDeviceGetAttribute(pciBusId, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, aDevice.getValue());
|
||||||
if (result != CUresult.CUDA_SUCCESS) {
|
if (result != CUresult.CUDA_SUCCESS) {
|
||||||
System.out.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_BUS_ID failed (ret: " + CUresult.stringFor(result) + ")");
|
System.out.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_BUS_ID failed (ret: " + CUresult.stringFor(result) + ")");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result = cudalib.cuDeviceGetAttribute(pciDeviceId, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, aDevice.getValue());
|
result = cudalib.cuDeviceGetAttribute(pciDeviceId, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, aDevice.getValue());
|
||||||
if (result != CUresult.CUDA_SUCCESS) {
|
if (result != CUresult.CUDA_SUCCESS) {
|
||||||
System.out.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID failed (ret: " + CUresult.stringFor(result) + ")");
|
System.out
|
||||||
|
.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID failed (ret: " + CUresult.stringFor(result) + ")");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,11 +114,8 @@ public class Nvidia implements GPULister {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String blenderId = String.format("CUDA_%s_%04x:%02x:%02x",
|
String blenderId = String
|
||||||
new String(name).trim(),
|
.format("CUDA_%s_%04x:%02x:%02x", new String(name).trim(), pciDomainId.getValue(), pciBusId.getValue(), pciDeviceId.getValue());
|
||||||
pciDomainId.getValue(),
|
|
||||||
pciBusId.getValue(),
|
|
||||||
pciDeviceId.getValue());
|
|
||||||
GPUDevice gpu = new GPUDevice(TYPE, new String(name).trim(), ram.getValue(), blenderId);
|
GPUDevice gpu = new GPUDevice(TYPE, new String(name).trim(), ram.getValue(), blenderId);
|
||||||
// for backward compatibility generate a CUDA_N id
|
// for backward compatibility generate a CUDA_N id
|
||||||
gpu.setOldId(TYPE + "_" + num);
|
gpu.setOldId(TYPE + "_" + num);
|
||||||
@@ -127,14 +125,12 @@ public class Nvidia implements GPULister {
|
|||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public int getRecommendedRenderBucketSize(long memory) {
|
||||||
public int getRecommendedRenderBucketSize(long memory) {
|
|
||||||
// Optimal CUDA-based GPUs Renderbucket algorithm
|
// Optimal CUDA-based GPUs Renderbucket algorithm
|
||||||
return (memory > 1073741824L) ? 256 : 128;
|
return (memory > 1073741824L) ? 256 : 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public int getMaximumRenderBucketSize(long memory) {
|
||||||
public int getMaximumRenderBucketSize(long memory) {
|
|
||||||
return (memory > 1073741824L) ? 512 : 128;
|
return (memory > 1073741824L) ? 512 : 128;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ import com.sun.jna.ptr.IntByReference;
|
|||||||
public class OpenCL implements GPULister {
|
public class OpenCL implements GPULister {
|
||||||
public static String TYPE = "OPENCL";
|
public static String TYPE = "OPENCL";
|
||||||
|
|
||||||
@Override
|
@Override public List<GPUDevice> getGpus() {
|
||||||
public List<GPUDevice> getGpus() {
|
|
||||||
OpenCLLib lib = null;
|
OpenCLLib lib = null;
|
||||||
|
|
||||||
String path = "OpenCL";
|
String path = "OpenCL";
|
||||||
@@ -123,14 +122,12 @@ public class OpenCL implements GPULister {
|
|||||||
return available_devices;
|
return available_devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public int getRecommendedRenderBucketSize(long memory) {
|
||||||
public int getRecommendedRenderBucketSize(long memory) {
|
|
||||||
// Optimal CUDA-based GPUs Renderbucket algorithm
|
// Optimal CUDA-based GPUs Renderbucket algorithm
|
||||||
return (memory > 1073741824L) ? 256 : 128;
|
return (memory > 1073741824L) ? 256 : 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public int getMaximumRenderBucketSize(long memory) {
|
||||||
public int getMaximumRenderBucketSize(long memory) {
|
|
||||||
return (memory > 1073741824L) ? 2048 : 128;
|
return (memory > 1073741824L) ? 2048 : 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ public interface OpenCLLib extends Library {
|
|||||||
|
|
||||||
public int clGetPlatformInfo(CLPlatformId.ByReference platform, int param_name, long param_value_size, byte[] destination, long size_ret[]);
|
public int clGetPlatformInfo(CLPlatformId.ByReference platform, int param_name, long param_value_size, byte[] destination, long size_ret[]);
|
||||||
|
|
||||||
public int clGetDeviceIDs(CLPlatformId.ByReference platform, int param_name, int num_entries, CLDeviceId.ByReference[] devices, IntByReference device_count);
|
public int clGetDeviceIDs(CLPlatformId.ByReference platform, int param_name, int num_entries, CLDeviceId.ByReference[] devices,
|
||||||
|
IntByReference device_count);
|
||||||
|
|
||||||
public int clGetDeviceInfo(CLDeviceId.ByReference device, int param_name, long param_value_size, byte[] destination, long size_ret[]);
|
public int clGetDeviceInfo(CLDeviceId.ByReference device, int param_name, long param_value_size, byte[] destination, long size_ret[]);
|
||||||
|
|
||||||
@@ -65,8 +66,7 @@ public interface OpenCLLib extends Library {
|
|||||||
|
|
||||||
public int id;
|
public int id;
|
||||||
|
|
||||||
@Override
|
@Override protected List<String> getFieldOrder() {
|
||||||
protected List<String> getFieldOrder() {
|
|
||||||
return Arrays.asList(new String[] { "id" });
|
return Arrays.asList(new String[] { "id" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,8 +77,7 @@ public interface OpenCLLib extends Library {
|
|||||||
|
|
||||||
public int id;
|
public int id;
|
||||||
|
|
||||||
@Override
|
@Override protected List<String> getFieldOrder() {
|
||||||
protected List<String> getFieldOrder() {
|
|
||||||
return Arrays.asList(new String[] { "id" });
|
return Arrays.asList(new String[] { "id" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package com.sheepit.client.network;
|
|||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.Authenticator;
|
import java.net.Authenticator;
|
||||||
|
|
||||||
import com.sheepit.client.network.Proxy;
|
import com.sheepit.client.network.Proxy;
|
||||||
import com.sheepit.client.network.ProxyAuthenticator;
|
import com.sheepit.client.network.ProxyAuthenticator;
|
||||||
|
|
||||||
|
|||||||
@@ -42,13 +42,11 @@ public class FreeBSD extends OS {
|
|||||||
return "freebsd";
|
return "freebsd";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getRenderBinaryPath() {
|
||||||
public String getRenderBinaryPath() {
|
|
||||||
return "rend.exe";
|
return "rend.exe";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public CPU getCPU() {
|
||||||
public CPU getCPU() {
|
|
||||||
CPU ret = new CPU();
|
CPU ret = new CPU();
|
||||||
try {
|
try {
|
||||||
Runtime r = Runtime.getRuntime();
|
Runtime r = Runtime.getRuntime();
|
||||||
@@ -110,8 +108,7 @@ public class FreeBSD extends OS {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public long getMemory() {
|
||||||
public long getMemory() {
|
|
||||||
try {
|
try {
|
||||||
Runtime r = Runtime.getRuntime();
|
Runtime r = Runtime.getRuntime();
|
||||||
Process p = r.exec("sysctl -n hw.usermem");
|
Process p = r.exec("sysctl -n hw.usermem");
|
||||||
@@ -133,18 +130,15 @@ public class FreeBSD extends OS {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public long getFreeMemory() {
|
||||||
public long getFreeMemory() {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getCUDALib() {
|
||||||
public String getCUDALib() {
|
|
||||||
return "cuda";
|
return "cuda";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public Process exec(List<String> command, Map<String, String> env_overight) throws IOException {
|
||||||
public Process exec(List<String> command, Map<String, String> env_overight) throws IOException {
|
|
||||||
// the renderer have a lib directory so add to the LD_LIBRARY_PATH
|
// the renderer have a lib directory so add to the LD_LIBRARY_PATH
|
||||||
// (even if we are not sure that it is the renderer who is launch
|
// (even if we are not sure that it is the renderer who is launch
|
||||||
|
|
||||||
|
|||||||
@@ -43,13 +43,11 @@ public class Linux extends OS {
|
|||||||
return "linux";
|
return "linux";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getRenderBinaryPath() {
|
||||||
public String getRenderBinaryPath() {
|
|
||||||
return "rend.exe";
|
return "rend.exe";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public CPU getCPU() {
|
||||||
public CPU getCPU() {
|
|
||||||
CPU ret = new CPU();
|
CPU ret = new CPU();
|
||||||
try {
|
try {
|
||||||
String filePath = "/proc/cpuinfo";
|
String filePath = "/proc/cpuinfo";
|
||||||
@@ -89,8 +87,7 @@ public class Linux extends OS {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public long getMemory() {
|
||||||
public long getMemory() {
|
|
||||||
try {
|
try {
|
||||||
String filePath = "/proc/meminfo";
|
String filePath = "/proc/meminfo";
|
||||||
Scanner scanner = new Scanner(new File(filePath));
|
Scanner scanner = new Scanner(new File(filePath));
|
||||||
@@ -118,8 +115,7 @@ public class Linux extends OS {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public long getFreeMemory() {
|
||||||
public long getFreeMemory() {
|
|
||||||
try {
|
try {
|
||||||
String filePath = "/proc/meminfo";
|
String filePath = "/proc/meminfo";
|
||||||
Scanner scanner = new Scanner(new File(filePath));
|
Scanner scanner = new Scanner(new File(filePath));
|
||||||
@@ -138,7 +134,8 @@ public class Linux extends OS {
|
|||||||
scanner.close();
|
scanner.close();
|
||||||
}
|
}
|
||||||
catch (java.lang.NoClassDefFoundError e) {
|
catch (java.lang.NoClassDefFoundError e) {
|
||||||
System.err.println("OS::Linux::getFreeMemory error " + e + " mostly because Scanner class was introducted by Java 5 and you are running a lower version");
|
System.err.println(
|
||||||
|
"OS::Linux::getFreeMemory error " + e + " mostly because Scanner class was introducted by Java 5 and you are running a lower version");
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -147,13 +144,11 @@ public class Linux extends OS {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getCUDALib() {
|
||||||
public String getCUDALib() {
|
|
||||||
return "cuda";
|
return "cuda";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public Process exec(List<String> command, Map<String, String> env_overight) throws IOException {
|
||||||
public Process exec(List<String> command, Map<String, String> env_overight) throws IOException {
|
|
||||||
Map<String, String> new_env = new HashMap<String, String>();
|
Map<String, String> new_env = new HashMap<String, String>();
|
||||||
new_env.putAll(java.lang.System.getenv()); // clone the env
|
new_env.putAll(java.lang.System.getenv()); // clone the env
|
||||||
|
|
||||||
@@ -201,13 +196,12 @@ public class Linux extends OS {
|
|||||||
return builder.start();
|
return builder.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public boolean getSupportHighPriority() {
|
||||||
public boolean getSupportHighPriority() {
|
|
||||||
// only the root user can create process with high (negative nice) value
|
// only the root user can create process with high (negative nice) value
|
||||||
String logname = System.getenv("LOGNAME");
|
String logname = System.getenv("LOGNAME");
|
||||||
String user = System.getenv("USER");
|
String user = System.getenv("USER");
|
||||||
|
|
||||||
if ((logname != null && logname.equals("root")) || (user != null && user.equals("root"))) {
|
if ((logname != null && logname.equals("root")) || (user != null && user.equals("root"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,13 +41,11 @@ public class Mac extends OS {
|
|||||||
return "mac";
|
return "mac";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getRenderBinaryPath() {
|
||||||
public String getRenderBinaryPath() {
|
|
||||||
return "Blender" + File.separator + "blender.app" + File.separator + "Contents" + File.separator + "MacOS" + File.separator + "blender";
|
return "Blender" + File.separator + "blender.app" + File.separator + "Contents" + File.separator + "MacOS" + File.separator + "blender";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public CPU getCPU() {
|
||||||
public CPU getCPU() {
|
|
||||||
CPU ret = new CPU();
|
CPU ret = new CPU();
|
||||||
|
|
||||||
String command = "sysctl machdep.cpu.family machdep.cpu.brand_string";
|
String command = "sysctl machdep.cpu.family machdep.cpu.brand_string";
|
||||||
@@ -97,8 +95,7 @@ public class Mac extends OS {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public long getMemory() {
|
||||||
public long getMemory() {
|
|
||||||
String command = "sysctl hw.memsize";
|
String command = "sysctl hw.memsize";
|
||||||
|
|
||||||
Process p = null;
|
Process p = null;
|
||||||
@@ -140,13 +137,11 @@ public class Mac extends OS {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public long getFreeMemory() {
|
||||||
public long getFreeMemory() {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public Process exec(List<String> command, Map<String, String> env) throws IOException {
|
||||||
public Process exec(List<String> command, Map<String, String> env) throws IOException {
|
|
||||||
List<String> actual_command = command;
|
List<String> actual_command = command;
|
||||||
if (this.hasNiceBinary == null) {
|
if (this.hasNiceBinary == null) {
|
||||||
this.checkNiceAvailability();
|
this.checkNiceAvailability();
|
||||||
@@ -173,8 +168,7 @@ public class Mac extends OS {
|
|||||||
return builder.start();
|
return builder.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getCUDALib() {
|
||||||
public String getCUDALib() {
|
|
||||||
return "/usr/local/cuda/lib/libcuda.dylib";
|
return "/usr/local/cuda/lib/libcuda.dylib";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,13 +37,11 @@ public class Windows extends OS {
|
|||||||
return "windows";
|
return "windows";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getRenderBinaryPath() {
|
||||||
public String getRenderBinaryPath() {
|
|
||||||
return "rend.exe";
|
return "rend.exe";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public CPU getCPU() {
|
||||||
public CPU getCPU() {
|
|
||||||
CPU ret = new CPU();
|
CPU ret = new CPU();
|
||||||
try {
|
try {
|
||||||
String[] identifier = java.lang.System.getenv("PROCESSOR_IDENTIFIER").split(" ");
|
String[] identifier = java.lang.System.getenv("PROCESSOR_IDENTIFIER").split(" ");
|
||||||
@@ -88,8 +86,7 @@ public class Windows extends OS {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public long getMemory() {
|
||||||
public long getMemory() {
|
|
||||||
try {
|
try {
|
||||||
MEMORYSTATUSEX _memory = new MEMORYSTATUSEX();
|
MEMORYSTATUSEX _memory = new MEMORYSTATUSEX();
|
||||||
if (Kernel32.INSTANCE.GlobalMemoryStatusEx(_memory)) {
|
if (Kernel32.INSTANCE.GlobalMemoryStatusEx(_memory)) {
|
||||||
@@ -102,8 +99,7 @@ public class Windows extends OS {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public long getFreeMemory() {
|
||||||
public long getFreeMemory() {
|
|
||||||
try {
|
try {
|
||||||
MEMORYSTATUSEX _memory = new MEMORYSTATUSEX();
|
MEMORYSTATUSEX _memory = new MEMORYSTATUSEX();
|
||||||
if (Kernel32.INSTANCE.GlobalMemoryStatusEx(_memory)) {
|
if (Kernel32.INSTANCE.GlobalMemoryStatusEx(_memory)) {
|
||||||
@@ -117,13 +113,11 @@ public class Windows extends OS {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getCUDALib() {
|
||||||
public String getCUDALib() {
|
|
||||||
return "nvcuda";
|
return "nvcuda";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public Process exec(List<String> command, Map<String, String> env) throws IOException {
|
||||||
public Process exec(List<String> command, Map<String, String> env) throws IOException {
|
|
||||||
// disable a popup because the renderer might crash (seg fault)
|
// disable a popup because the renderer might crash (seg fault)
|
||||||
Kernel32Lib kernel32lib = null;
|
Kernel32Lib kernel32lib = null;
|
||||||
try {
|
try {
|
||||||
@@ -216,8 +210,7 @@ public class Windows extends OS {
|
|||||||
return process_class;
|
return process_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public boolean kill(Process process) {
|
||||||
public boolean kill(Process process) {
|
|
||||||
if (process != null) {
|
if (process != null) {
|
||||||
WinProcess wproc = new WinProcess(process);
|
WinProcess wproc = new WinProcess(process);
|
||||||
wproc.kill();
|
wproc.kill();
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ public interface Kernel32Lib extends Library {
|
|||||||
/**
|
/**
|
||||||
* Includes all processes and threads in the system, plus the heaps and modules of the process specified in th32ProcessID.
|
* Includes all processes and threads in the system, plus the heaps and modules of the process specified in th32ProcessID.
|
||||||
*/
|
*/
|
||||||
WinDef.DWORD TH32CS_SNAPALL = new WinDef.DWORD((TH32CS_SNAPHEAPLIST.intValue() | TH32CS_SNAPPROCESS.intValue() | TH32CS_SNAPTHREAD.intValue() | TH32CS_SNAPMODULE.intValue()));
|
WinDef.DWORD TH32CS_SNAPALL = new WinDef.DWORD(
|
||||||
|
(TH32CS_SNAPHEAPLIST.intValue() | TH32CS_SNAPPROCESS.intValue() | TH32CS_SNAPTHREAD.intValue() | TH32CS_SNAPMODULE.intValue()));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that the snapshot handle is to be inheritable.
|
* Indicates that the snapshot handle is to be inheritable.
|
||||||
@@ -151,9 +152,10 @@ public interface Kernel32Lib extends Library {
|
|||||||
*/
|
*/
|
||||||
public char[] szExeFile = new char[WinDef.MAX_PATH];
|
public char[] szExeFile = new char[WinDef.MAX_PATH];
|
||||||
|
|
||||||
@Override
|
@Override protected List<String> getFieldOrder() {
|
||||||
protected List<String> getFieldOrder() {
|
return Arrays
|
||||||
return Arrays.asList("dwSize", "cntUsage", "th32ProcessID", "th32DefaultHeapID", "th32ModuleID", "cntThreads", "th32ParentProcessID", "pcPriClassBase", "dwFlags", "szExeFile");
|
.asList("dwSize", "cntUsage", "th32ProcessID", "th32DefaultHeapID", "th32ModuleID", "cntThreads", "th32ParentProcessID", "pcPriClassBase",
|
||||||
|
"dwFlags", "szExeFile");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,13 +84,14 @@ public class WinProcess {
|
|||||||
|
|
||||||
private static WinNT.HANDLE getHandleByPid(int pid_) throws IOException {
|
private static WinNT.HANDLE getHandleByPid(int pid_) throws IOException {
|
||||||
WinNT.HANDLE handle = Kernel32.INSTANCE.OpenProcess(0x0400 | // PROCESS_QUERY_INFORMATION
|
WinNT.HANDLE handle = Kernel32.INSTANCE.OpenProcess(0x0400 | // PROCESS_QUERY_INFORMATION
|
||||||
0x0800 | // PROCESS_SUSPEND_RESUME
|
0x0800 | // PROCESS_SUSPEND_RESUME
|
||||||
0x0001 | // PROCESS_TERMINATE
|
0x0001 | // PROCESS_TERMINATE
|
||||||
0x0200 | // PROCESS_SET_INFORMATION
|
0x0200 | // PROCESS_SET_INFORMATION
|
||||||
0x00100000, // SYNCHRONIZE
|
0x00100000, // SYNCHRONIZE
|
||||||
false, pid_);
|
false, pid_);
|
||||||
if (handle == null) {
|
if (handle == null) {
|
||||||
throw new IOException("OpenProcess failed: " + Kernel32Util.formatMessageFromLastErrorCode(Kernel32.INSTANCE.GetLastError()) + " (pid: " + pid_ + ")");
|
throw new IOException(
|
||||||
|
"OpenProcess failed: " + Kernel32Util.formatMessageFromLastErrorCode(Kernel32.INSTANCE.GetLastError()) + " (pid: " + pid_ + ")");
|
||||||
}
|
}
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
@@ -130,8 +131,7 @@ public class WinProcess {
|
|||||||
this.pid = pid_;
|
this.pid = pid_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override protected void finalize() throws Throwable {
|
||||||
protected void finalize() throws Throwable {
|
|
||||||
if (this.handle != null) {
|
if (this.handle != null) {
|
||||||
// Kernel32.INSTANCE.CloseHandle(this.handle); // do not close the handle because the parent Process object might still be alive
|
// Kernel32.INSTANCE.CloseHandle(this.handle); // do not close the handle because the parent Process object might still be alive
|
||||||
this.handle = null;
|
this.handle = null;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ import com.sheepit.client.standalone.swing.activity.Working;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import com.formdev.flatlaf.FlatLightLaf; // Required for dark & light mode
|
import com.formdev.flatlaf.FlatLightLaf; // Required for dark & light mode
|
||||||
import com.formdev.flatlaf.FlatDarkLaf;
|
import com.formdev.flatlaf.FlatDarkLaf;
|
||||||
import com.formdev.flatlaf.FlatLaf;
|
import com.formdev.flatlaf.FlatLaf;
|
||||||
|
|
||||||
@@ -83,9 +83,7 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
private BufferedImage iconSprites;
|
private BufferedImage iconSprites;
|
||||||
private BufferedImage[] trayIconSprites;
|
private BufferedImage[] trayIconSprites;
|
||||||
|
|
||||||
@Getter
|
@Getter @Setter private SettingsLoader settingsLoader;
|
||||||
@Setter
|
|
||||||
private SettingsLoader settingsLoader;
|
|
||||||
|
|
||||||
private ThreadClient threadClient;
|
private ThreadClient threadClient;
|
||||||
|
|
||||||
@@ -96,8 +94,7 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
waitingForAuthentication = true;
|
waitingForAuthentication = true;
|
||||||
|
|
||||||
new Timer().scheduleAtFixedRate(new TimerTask() {
|
new Timer().scheduleAtFixedRate(new TimerTask() {
|
||||||
@Override
|
@Override public void run() {
|
||||||
public void run() {
|
|
||||||
if (activityWorking != null) {
|
if (activityWorking != null) {
|
||||||
activityWorking.updateTime();
|
activityWorking.updateTime();
|
||||||
}
|
}
|
||||||
@@ -105,8 +102,7 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
}, 2 * 1000, 2 * 1000);
|
}, 2 * 1000, 2 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void start() {
|
||||||
public void start() {
|
|
||||||
if (useSysTray) {
|
if (useSysTray) {
|
||||||
try {
|
try {
|
||||||
sysTray = SystemTray.getSystemTray();
|
sysTray = SystemTray.getSystemTray();
|
||||||
@@ -131,10 +127,11 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
if (spriteSequenceUrl != null) {
|
if (spriteSequenceUrl != null) {
|
||||||
try {
|
try {
|
||||||
iconSprites = ImageIO.read(spriteSequenceUrl);
|
iconSprites = ImageIO.read(spriteSequenceUrl);
|
||||||
trayIconSprites = new BufferedImage[101 * 1]; // sprite sheet has 101 images in 1 column
|
trayIconSprites = new BufferedImage[101 * 1]; // sprite sheet has 101 images in 1 column
|
||||||
|
|
||||||
setIconImage(extractImageFromSprite(-1)); // sprite 0 is standard Sheep It! icon
|
setIconImage(extractImageFromSprite(-1)); // sprite 0 is standard Sheep It! icon
|
||||||
} catch (IOException e) {
|
}
|
||||||
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,7 +154,8 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
try {
|
try {
|
||||||
if (client.getConfiguration().getTheme().equals("light")) {
|
if (client.getConfiguration().getTheme().equals("light")) {
|
||||||
UIManager.setLookAndFeel(new FlatLightLaf());
|
UIManager.setLookAndFeel(new FlatLightLaf());
|
||||||
} else if (client.getConfiguration().getTheme().equals("dark")) {
|
}
|
||||||
|
else if (client.getConfiguration().getTheme().equals("dark")) {
|
||||||
UIManager.setLookAndFeel(new FlatDarkLaf());
|
UIManager.setLookAndFeel(new FlatDarkLaf());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,51 +178,43 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void stop() {
|
||||||
public void stop() {
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void status(String msg_) {
|
||||||
public void status(String msg_) {
|
|
||||||
status(msg_, false);
|
status(msg_, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void status(String msg_, boolean overwriteSuspendedMsg) {
|
||||||
public void status(String msg_, boolean overwriteSuspendedMsg) {
|
|
||||||
if (activityWorking != null) {
|
if (activityWorking != null) {
|
||||||
this.activityWorking.setStatus(msg_, overwriteSuspendedMsg);
|
this.activityWorking.setStatus(msg_, overwriteSuspendedMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setRenderingProjectName(String name_) {
|
||||||
public void setRenderingProjectName(String name_) {
|
|
||||||
if (activityWorking != null) {
|
if (activityWorking != null) {
|
||||||
this.activityWorking.setRenderingProjectName(name_);
|
this.activityWorking.setRenderingProjectName(name_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void error(String msg_) {
|
||||||
public void error(String msg_) {
|
|
||||||
status(msg_, true);
|
status(msg_, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setRemainingTime(String time_) {
|
||||||
public void setRemainingTime(String time_) {
|
|
||||||
if (activityWorking != null) {
|
if (activityWorking != null) {
|
||||||
this.activityWorking.setRemainingTime(time_);
|
this.activityWorking.setRemainingTime(time_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setRenderingTime(String time_) {
|
||||||
public void setRenderingTime(String time_) {
|
|
||||||
if (activityWorking != null) {
|
if (activityWorking != null) {
|
||||||
this.activityWorking.setRenderingTime(time_);
|
this.activityWorking.setRenderingTime(time_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void AddFrameRendered() {
|
||||||
public void AddFrameRendered() {
|
|
||||||
framesRendered++;
|
framesRendered++;
|
||||||
|
|
||||||
if (activityWorking != null) {
|
if (activityWorking != null) {
|
||||||
@@ -235,32 +225,27 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void displayStats(Stats stats) {
|
||||||
public void displayStats(Stats stats) {
|
|
||||||
if (activityWorking != null) {
|
if (activityWorking != null) {
|
||||||
this.activityWorking.displayStats(stats);
|
this.activityWorking.displayStats(stats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void displayUploadQueueStats(int queueSize, long queueVolume) {
|
||||||
public void displayUploadQueueStats(int queueSize, long queueVolume) {
|
|
||||||
if (activityWorking != null) {
|
if (activityWorking != null) {
|
||||||
this.activityWorking.displayUploadQueueStats(queueSize, queueVolume);
|
this.activityWorking.displayUploadQueueStats(queueSize, queueVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public Client getClient() {
|
||||||
public Client getClient() {
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setClient(Client cli) {
|
||||||
public void setClient(Client cli) {
|
|
||||||
client = cli;
|
client = cli;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setComputeMethod(String computeMethod) {
|
||||||
public void setComputeMethod(String computeMethod) {
|
|
||||||
this.activityWorking.setComputeMethod(computeMethod);
|
this.activityWorking.setComputeMethod(computeMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,8 +253,7 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
return client.getConfiguration();
|
return client.getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void successfulAuthenticationEvent(String publickey) {
|
||||||
public void successfulAuthenticationEvent(String publickey) {
|
|
||||||
if (settingsLoader != null) {
|
if (settingsLoader != null) {
|
||||||
if (publickey != null) {
|
if (publickey != null) {
|
||||||
settingsLoader.setPassword(publickey);
|
settingsLoader.setPassword(publickey);
|
||||||
@@ -348,8 +332,7 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
|
|
||||||
MenuItem exit = new MenuItem("Exit");
|
MenuItem exit = new MenuItem("Exit");
|
||||||
exit.addActionListener(new ActionListener() {
|
exit.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -357,8 +340,7 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
|
|
||||||
MenuItem open = new MenuItem("Open...");
|
MenuItem open = new MenuItem("Open...");
|
||||||
open.addActionListener(new ActionListener() {
|
open.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
restoreFromTray();
|
restoreFromTray();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -366,8 +348,7 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
|
|
||||||
MenuItem settings = new MenuItem("Settings...");
|
MenuItem settings = new MenuItem("Settings...");
|
||||||
settings.addActionListener(new ActionListener() {
|
settings.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
restoreFromTray();
|
restoreFromTray();
|
||||||
showActivity(ActivityType.SETTINGS);
|
showActivity(ActivityType.SETTINGS);
|
||||||
}
|
}
|
||||||
@@ -379,8 +360,7 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
icon.setToolTip("SheepIt! Client");
|
icon.setToolTip("SheepIt! Client");
|
||||||
|
|
||||||
icon.addActionListener(new ActionListener() {
|
icon.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
restoreFromTray();
|
restoreFromTray();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -402,8 +382,7 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
return img.getImage();
|
return img.getImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void updateTrayIcon(Integer percentage) {
|
||||||
public void updateTrayIcon(Integer percentage) {
|
|
||||||
// update the app icon on the app bar
|
// update the app icon on the app bar
|
||||||
Image img = extractImageFromSprite(percentage);
|
Image img = extractImageFromSprite(percentage);
|
||||||
setIconImage(img);
|
setIconImage(img);
|
||||||
@@ -412,15 +391,14 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
if (sysTray != null && SystemTray.isSupported()) {
|
if (sysTray != null && SystemTray.isSupported()) {
|
||||||
if (trayIcon != null) {
|
if (trayIcon != null) {
|
||||||
trayIcon.setImage(img);
|
trayIcon.setImage(img);
|
||||||
trayIcon.setImageAutoSize(true); // use this method to ensure that icon is refreshed when on
|
trayIcon.setImageAutoSize(true); // use this method to ensure that icon is refreshed when on
|
||||||
// the tray
|
// the tray
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ThreadClient extends Thread {
|
public class ThreadClient extends Thread {
|
||||||
@Override
|
@Override public void run() {
|
||||||
public void run() {
|
|
||||||
if (GuiSwing.this.client != null) {
|
if (GuiSwing.this.client != null) {
|
||||||
GuiSwing.this.client.run();
|
GuiSwing.this.client.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,7 @@ public class GuiText implements Gui {
|
|||||||
this.log = Log.getInstance(null);
|
this.log = Log.getInstance(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void start() {
|
||||||
public void start() {
|
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
|
|
||||||
CLIInputObserver cli_input_observer = new CLIInputObserver(client);
|
CLIInputObserver cli_input_observer = new CLIInputObserver(client);
|
||||||
@@ -56,8 +55,7 @@ public class GuiText implements Gui {
|
|||||||
cli_input_observer_thread.start();
|
cli_input_observer_thread.start();
|
||||||
|
|
||||||
Signal.handle(new Signal("INT"), new SignalHandler() {
|
Signal.handle(new Signal("INT"), new SignalHandler() {
|
||||||
@Override
|
@Override public void handle(Signal signal) {
|
||||||
public void handle(Signal signal) {
|
|
||||||
sigIntCount++;
|
sigIntCount++;
|
||||||
|
|
||||||
if (sigIntCount == 4) {
|
if (sigIntCount == 4) {
|
||||||
@@ -84,22 +82,18 @@ public class GuiText implements Gui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void stop() {
|
||||||
public void stop() {
|
|
||||||
Runtime.getRuntime().halt(0);
|
Runtime.getRuntime().halt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void updateTrayIcon(Integer percentage) {
|
||||||
public void updateTrayIcon(Integer percentage) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void status(String msg_) {
|
||||||
public void status(String msg_) {
|
|
||||||
status(msg_, false);
|
status(msg_, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void status(String msg_, boolean overwriteSuspendedMsg) {
|
||||||
public void status(String msg_, boolean overwriteSuspendedMsg) {
|
|
||||||
log.debug("GUI " + msg_);
|
log.debug("GUI " + msg_);
|
||||||
|
|
||||||
if (client != null && client.isSuspended()) {
|
if (client != null && client.isSuspended()) {
|
||||||
@@ -112,67 +106,54 @@ public class GuiText implements Gui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void error(String err_) {
|
||||||
public void error(String err_) {
|
|
||||||
System.out.println("Error " + err_);
|
System.out.println("Error " + err_);
|
||||||
log.error("Error " + err_);
|
log.error("Error " + err_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void AddFrameRendered() {
|
||||||
public void AddFrameRendered() {
|
|
||||||
this.framesRendered += 1;
|
this.framesRendered += 1;
|
||||||
System.out.println("Frames rendered: " + this.framesRendered);
|
System.out.println("Frames rendered: " + this.framesRendered);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void displayStats(Stats stats) {
|
||||||
public void displayStats(Stats stats) {
|
|
||||||
System.out.println("Frames remaining: " + stats.getRemainingFrame());
|
System.out.println("Frames remaining: " + stats.getRemainingFrame());
|
||||||
System.out.println("Credits earned: " + stats.getCreditsEarnedDuringSession());
|
System.out.println("Credits earned: " + stats.getCreditsEarnedDuringSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void displayUploadQueueStats(int queueSize, long queueVolume) {
|
||||||
public void displayUploadQueueStats(int queueSize, long queueVolume) {
|
|
||||||
// No need to check if the queue is not empty to show the volume bc this line is always shown at the end
|
// No need to check if the queue is not empty to show the volume bc this line is always shown at the end
|
||||||
// of the render process in text GUI (unless an error occurred, where the file is uploaded synchronously)
|
// of the render process in text GUI (unless an error occurred, where the file is uploaded synchronously)
|
||||||
System.out.println(String.format("Queued uploads: %d (%.2fMB)",
|
System.out.println(String.format("Queued uploads: %d (%.2fMB)", queueSize, (queueVolume / 1024.0 / 1024.0)));
|
||||||
queueSize,
|
|
||||||
(queueVolume / 1024.0 / 1024.0)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setRenderingProjectName(String name_) {
|
||||||
public void setRenderingProjectName(String name_) {
|
|
||||||
if (name_ != null && name_.isEmpty() == false) {
|
if (name_ != null && name_.isEmpty() == false) {
|
||||||
System.out.println("Rendering project \"" + name_ + "\"");
|
System.out.println("Rendering project \"" + name_ + "\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setRemainingTime(String time_) {
|
||||||
public void setRemainingTime(String time_) {
|
|
||||||
System.out.println("Rendering (remaining " + time_ + ")");
|
System.out.println("Rendering (remaining " + time_ + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setRenderingTime(String time_) {
|
||||||
public void setRenderingTime(String time_) {
|
|
||||||
System.out.println("Rendering " + time_);
|
System.out.println("Rendering " + time_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setClient(Client cli) {
|
||||||
public void setClient(Client cli) {
|
|
||||||
client = cli;
|
client = cli;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setComputeMethod(String computeMethod) {
|
||||||
public void setComputeMethod(String computeMethod) {
|
|
||||||
System.out.println("Compute method: " + computeMethod);
|
System.out.println("Compute method: " + computeMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public Client getClient() {
|
||||||
public Client getClient() {
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void successfulAuthenticationEvent(String publickey) {
|
||||||
public void successfulAuthenticationEvent(String publickey) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class GuiTextOneLine implements Gui {
|
|||||||
private String status;
|
private String status;
|
||||||
private String line;
|
private String line;
|
||||||
|
|
||||||
private int uploadQueueSize;
|
private int uploadQueueSize;
|
||||||
private long uploadQueueVolume;
|
private long uploadQueueVolume;
|
||||||
|
|
||||||
private boolean exiting = false;
|
private boolean exiting = false;
|
||||||
@@ -57,12 +57,11 @@ public class GuiTextOneLine implements Gui {
|
|||||||
status = "";
|
status = "";
|
||||||
computeMethod = "";
|
computeMethod = "";
|
||||||
line = "";
|
line = "";
|
||||||
uploadQueueSize = 0;
|
uploadQueueSize = 0;
|
||||||
uploadQueueVolume = 0;
|
uploadQueueVolume = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void start() {
|
||||||
public void start() {
|
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
|
|
||||||
CLIInputObserver cli_input_observer = new CLIInputObserver(client);
|
CLIInputObserver cli_input_observer = new CLIInputObserver(client);
|
||||||
@@ -71,8 +70,7 @@ public class GuiTextOneLine implements Gui {
|
|||||||
cli_input_observer_thread.start();
|
cli_input_observer_thread.start();
|
||||||
|
|
||||||
Signal.handle(new Signal("INT"), new SignalHandler() {
|
Signal.handle(new Signal("INT"), new SignalHandler() {
|
||||||
@Override
|
@Override public void handle(Signal signal) {
|
||||||
public void handle(Signal signal) {
|
|
||||||
sigIntCount++;
|
sigIntCount++;
|
||||||
|
|
||||||
if (sigIntCount == 5) {
|
if (sigIntCount == 5) {
|
||||||
@@ -95,22 +93,18 @@ public class GuiTextOneLine implements Gui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void stop() {
|
||||||
public void stop() {
|
|
||||||
Runtime.getRuntime().halt(0);
|
Runtime.getRuntime().halt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void updateTrayIcon(Integer percentage) {
|
||||||
public void updateTrayIcon(Integer percentage) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void status(String msg_) {
|
||||||
public void status(String msg_) {
|
|
||||||
status(msg_, false);
|
status(msg_, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void status(String msg_, boolean overwriteSuspendedMsg) {
|
||||||
public void status(String msg_, boolean overwriteSuspendedMsg) {
|
|
||||||
if (client != null && client.isSuspended()) {
|
if (client != null && client.isSuspended()) {
|
||||||
if (overwriteSuspendedMsg) {
|
if (overwriteSuspendedMsg) {
|
||||||
status = msg_;
|
status = msg_;
|
||||||
@@ -123,8 +117,7 @@ public class GuiTextOneLine implements Gui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setRenderingProjectName(String name_) {
|
||||||
public void setRenderingProjectName(String name_) {
|
|
||||||
if (name_ == null || name_.isEmpty()) {
|
if (name_ == null || name_.isEmpty()) {
|
||||||
project = "";
|
project = "";
|
||||||
}
|
}
|
||||||
@@ -134,60 +127,50 @@ public class GuiTextOneLine implements Gui {
|
|||||||
updateLine();
|
updateLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void error(String msg_) {
|
||||||
public void error(String msg_) {
|
|
||||||
status = "Error " + msg_;
|
status = "Error " + msg_;
|
||||||
updateLine();
|
updateLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void AddFrameRendered() {
|
||||||
public void AddFrameRendered() {
|
|
||||||
rendered += 1;
|
rendered += 1;
|
||||||
updateLine();
|
updateLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void displayStats(Stats stats) {
|
||||||
public void displayStats(Stats stats) {
|
|
||||||
remaining = stats.getRemainingFrame();
|
remaining = stats.getRemainingFrame();
|
||||||
creditsEarned = String.valueOf(stats.getCreditsEarnedDuringSession());
|
creditsEarned = String.valueOf(stats.getCreditsEarnedDuringSession());
|
||||||
updateLine();
|
updateLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void displayUploadQueueStats(int queueSize, long queueVolume) {
|
||||||
public void displayUploadQueueStats(int queueSize, long queueVolume) {
|
this.uploadQueueSize = queueSize;
|
||||||
this.uploadQueueSize = queueSize;
|
|
||||||
this.uploadQueueVolume = queueVolume;
|
this.uploadQueueVolume = queueVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setRemainingTime(String time_) {
|
||||||
public void setRemainingTime(String time_) {
|
|
||||||
status = "(remaining " + time_ + ")";
|
status = "(remaining " + time_ + ")";
|
||||||
updateLine();
|
updateLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setRenderingTime(String time_) {
|
||||||
public void setRenderingTime(String time_) {
|
|
||||||
status = "Rendering " + time_;
|
status = "Rendering " + time_;
|
||||||
updateLine();
|
updateLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setClient(Client cli) {
|
||||||
public void setClient(Client cli) {
|
|
||||||
client = cli;
|
client = cli;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setComputeMethod(String computeMethod_) {
|
||||||
public void setComputeMethod(String computeMethod_) {
|
|
||||||
computeMethod = computeMethod_;
|
computeMethod = computeMethod_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public Client getClient() {
|
||||||
public Client getClient() {
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void successfulAuthenticationEvent(String publickey) {
|
||||||
public void successfulAuthenticationEvent(String publickey) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,15 +179,9 @@ public class GuiTextOneLine implements Gui {
|
|||||||
|
|
||||||
System.out.print("\r");
|
System.out.print("\r");
|
||||||
|
|
||||||
line = String.format("Frames: %d Points: %s | Queued uploads: %d%s | %s %s %s",
|
line = String.format("Frames: %d Points: %s | Queued uploads: %d%s | %s %s %s", rendered, creditsEarned != null ? creditsEarned : "unknown",
|
||||||
rendered,
|
this.uploadQueueSize, (this.uploadQueueSize > 0 ? String.format(" (%.2fMB)", (this.uploadQueueVolume / 1024.0 / 1024.0)) : ""), project,
|
||||||
creditsEarned != null ? creditsEarned : "unknown",
|
computeMethod, status + (exiting ? " (Exiting after all frames are uploaded)" : ""));
|
||||||
this.uploadQueueSize,
|
|
||||||
(this.uploadQueueSize > 0 ? String.format(" (%.2fMB)", (this.uploadQueueVolume / 1024.0 / 1024.0)) : ""),
|
|
||||||
project,
|
|
||||||
computeMethod,
|
|
||||||
status + (exiting ? " (Exiting after all frames are uploaded)" : "")
|
|
||||||
);
|
|
||||||
|
|
||||||
System.out.print(line);
|
System.out.print(line);
|
||||||
for (int i = line.length(); i <= charToRemove; i++) {
|
for (int i = line.length(); i <= charToRemove; i++) {
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ public class ListGpuParameterHandler<T> extends OptionHandler<T> {
|
|||||||
super(parser, option, setter);
|
super(parser, option, setter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public int parseArguments(Parameters params) throws CmdLineException {
|
||||||
public int parseArguments(Parameters params) throws CmdLineException {
|
|
||||||
List<GPUDevice> gpus = GPU.listDevices(new Configuration(null, null, null));
|
List<GPUDevice> gpus = GPU.listDevices(new Configuration(null, null, null));
|
||||||
if (gpus != null) {
|
if (gpus != null) {
|
||||||
for (GPUDevice gpu : gpus) {
|
for (GPUDevice gpu : gpus) {
|
||||||
@@ -53,8 +52,7 @@ public class ListGpuParameterHandler<T> extends OptionHandler<T> {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getDefaultMetaVariable() {
|
||||||
public String getDefaultMetaVariable() {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,16 +33,14 @@ public class VersionParameterHandler<T> extends OptionHandler<T> {
|
|||||||
super(parser, option, setter);
|
super(parser, option, setter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public int parseArguments(Parameters params) throws CmdLineException {
|
||||||
public int parseArguments(Parameters params) throws CmdLineException {
|
|
||||||
Configuration config = new Configuration(null, "", "");
|
Configuration config = new Configuration(null, "", "");
|
||||||
System.out.println("Version: " + config.getJarVersion());
|
System.out.println("Version: " + config.getJarVersion());
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getDefaultMetaVariable() {
|
||||||
public String getDefaultMetaVariable() {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import java.text.ParseException;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import com.sheepit.client.Client;
|
import com.sheepit.client.Client;
|
||||||
import com.sheepit.client.Configuration;
|
import com.sheepit.client.Configuration;
|
||||||
import com.sheepit.client.Configuration.ComputeType;
|
import com.sheepit.client.Configuration.ComputeType;
|
||||||
@@ -46,74 +47,52 @@ import com.sheepit.client.hardware.gpu.opencl.OpenCL;
|
|||||||
import com.sheepit.client.network.Proxy;
|
import com.sheepit.client.network.Proxy;
|
||||||
|
|
||||||
public class Worker {
|
public class Worker {
|
||||||
@Option(name = "-server", usage = "Render-farm server, default https://client.sheepit-renderfarm.com", metaVar = "URL", required = false)
|
@Option(name = "-server", usage = "Render-farm server, default https://client.sheepit-renderfarm.com", metaVar = "URL", required = false) private String server = "https://client.sheepit-renderfarm.com";
|
||||||
private String server = "https://client.sheepit-renderfarm.com";
|
|
||||||
|
|
||||||
@Option(name = "-login", usage = "User's login", metaVar = "LOGIN", required = false)
|
@Option(name = "-login", usage = "User's login", metaVar = "LOGIN", required = false) private String login = "";
|
||||||
private String login = "";
|
|
||||||
|
|
||||||
@Option(name = "-password", usage = "User's password", metaVar = "PASSWORD", required = false)
|
@Option(name = "-password", usage = "User's password", metaVar = "PASSWORD", required = false) private String password = "";
|
||||||
private String password = "";
|
|
||||||
|
|
||||||
@Option(name = "-cache-dir", usage = "Cache/Working directory. Caution, everything in it not related to the render-farm will be removed", metaVar = "/tmp/cache", required = false)
|
@Option(name = "-cache-dir", usage = "Cache/Working directory. Caution, everything in it not related to the render-farm will be removed", metaVar = "/tmp/cache", required = false) private String cache_dir = null;
|
||||||
private String cache_dir = null;
|
|
||||||
|
|
||||||
@Option(name = "-gpu", usage = "Name of the GPU used for the render, for example CUDA_0 for Nvidia or OPENCL_0 for AMD/Intel card", metaVar = "CUDA_0", required = false)
|
@Option(name = "-gpu", usage = "Name of the GPU used for the render, for example CUDA_0 for Nvidia or OPENCL_0 for AMD/Intel card", metaVar = "CUDA_0", required = false) private String gpu_device = null;
|
||||||
private String gpu_device = null;
|
|
||||||
|
|
||||||
@Option(name = "--no-gpu", usage = "Don't detect GPUs", required = false)
|
@Option(name = "--no-gpu", usage = "Don't detect GPUs", required = false) private boolean no_gpu_detection = false;
|
||||||
private boolean no_gpu_detection = false;
|
|
||||||
|
|
||||||
@Option(name = "-compute-method", usage = "CPU: only use cpu, GPU: only use gpu, CPU_GPU: can use cpu and gpu (not at the same time) if -gpu is not use it will not use the gpu", metaVar = "CPU", required = false)
|
@Option(name = "-compute-method", usage = "CPU: only use cpu, GPU: only use gpu, CPU_GPU: can use cpu and gpu (not at the same time) if -gpu is not use it will not use the gpu", metaVar = "CPU", required = false) private String method = null;
|
||||||
private String method = null;
|
|
||||||
|
|
||||||
@Option(name = "-cores", usage = "Number of cores/threads to use for the render", metaVar = "3", required = false)
|
@Option(name = "-cores", usage = "Number of cores/threads to use for the render", metaVar = "3", required = false) private int nb_cores = -1;
|
||||||
private int nb_cores = -1;
|
|
||||||
|
|
||||||
@Option(name = "-memory", usage = "Maximum memory allow to be used by renderer, number with unit (800M, 2G, ...)", required = false)
|
@Option(name = "-memory", usage = "Maximum memory allow to be used by renderer, number with unit (800M, 2G, ...)", required = false) private String max_ram = null;
|
||||||
private String max_ram = null;
|
|
||||||
|
|
||||||
@Option(name = "-rendertime", usage = "Maximum time allow for each frame (in minutes)", required = false)
|
@Option(name = "-rendertime", usage = "Maximum time allow for each frame (in minutes)", required = false) private int max_rendertime = -1;
|
||||||
private int max_rendertime = -1;
|
|
||||||
|
|
||||||
@Option(name = "--verbose", usage = "Display log", required = false)
|
@Option(name = "--verbose", usage = "Display log", required = false) private boolean print_log = false;
|
||||||
private boolean print_log = false;
|
|
||||||
|
|
||||||
@Option(name = "-request-time", usage = "H1:M1-H2:M2,H3:M3-H4:M4 Use the 24h format. For example to request job between 2am-8.30am and 5pm-11pm you should do --request-time 2:00-8:30,17:00-23:00 Caution, it's the requesting job time to get a project, not the working time", metaVar = "2:00-8:30,17:00-23:00", required = false)
|
@Option(name = "-request-time", usage = "H1:M1-H2:M2,H3:M3-H4:M4 Use the 24h format. For example to request job between 2am-8.30am and 5pm-11pm you should do --request-time 2:00-8:30,17:00-23:00 Caution, it's the requesting job time to get a project, not the working time", metaVar = "2:00-8:30,17:00-23:00", required = false) private String request_time = null;
|
||||||
private String request_time = null;
|
|
||||||
|
|
||||||
@Option(name = "-proxy", usage = "URL of the proxy", metaVar = "http://login:password@host:port", required = false)
|
@Option(name = "-proxy", usage = "URL of the proxy", metaVar = "http://login:password@host:port", required = false) private String proxy = null;
|
||||||
private String proxy = null;
|
|
||||||
|
|
||||||
@Option(name = "-extras", usage = "Extras data push on the authentication request", required = false)
|
@Option(name = "-extras", usage = "Extras data push on the authentication request", required = false) private String extras = null;
|
||||||
private String extras = null;
|
|
||||||
|
|
||||||
@Option(name = "-ui", usage = "Specify the user interface to use, default '" + GuiSwing.type + "', available '" + GuiTextOneLine.type + "', '" + GuiText.type + "', '" + GuiSwing.type + "' (graphical)", required = false)
|
@Option(name = "-ui", usage = "Specify the user interface to use, default '" + GuiSwing.type + "', available '" + GuiTextOneLine.type + "', '"
|
||||||
private String ui_type = null;
|
+ GuiText.type + "', '" + GuiSwing.type + "' (graphical)", required = false) private String ui_type = null;
|
||||||
|
|
||||||
@Option(name = "-config", usage = "Specify the configuration file", required = false)
|
@Option(name = "-config", usage = "Specify the configuration file", required = false) private String config_file = null;
|
||||||
private String config_file = null;
|
|
||||||
|
|
||||||
@Option(name = "--version", usage = "Display application version", required = false, handler = VersionParameterHandler.class)
|
@Option(name = "--version", usage = "Display application version", required = false, handler = VersionParameterHandler.class) private VersionParameterHandler versionHandler;
|
||||||
private VersionParameterHandler versionHandler;
|
|
||||||
|
|
||||||
@Option(name = "--show-gpu", usage = "Print available CUDA devices and exit", required = false, handler = ListGpuParameterHandler.class)
|
@Option(name = "--show-gpu", usage = "Print available CUDA devices and exit", required = false, handler = ListGpuParameterHandler.class) private ListGpuParameterHandler listGpuParameterHandler;
|
||||||
private ListGpuParameterHandler listGpuParameterHandler;
|
|
||||||
|
|
||||||
@Option(name = "--no-systray", usage = "Don't use systray", required = false)
|
@Option(name = "--no-systray", usage = "Don't use systray", required = false) private boolean no_systray = false;
|
||||||
private boolean no_systray = false;
|
|
||||||
|
|
||||||
@Option(name = "-priority", usage = "Set render process priority (19 lowest to -19 highest)", required = false)
|
@Option(name = "-priority", usage = "Set render process priority (19 lowest to -19 highest)", required = false) private int priority = 19;
|
||||||
private int priority = 19;
|
|
||||||
|
|
||||||
@Option(name = "-title", usage = "Custom title for the GUI Client", required = false)
|
@Option(name = "-title", usage = "Custom title for the GUI Client", required = false) private String title = "SheepIt Render Farm";
|
||||||
private String title = "SheepIt Render Farm";
|
|
||||||
|
|
||||||
@Option(name = "-theme", usage = "Specify the theme to use for the graphical client, default 'light', available 'light', 'dark'", required = false)
|
@Option(name = "-theme", usage = "Specify the theme to use for the graphical client, default 'light', available 'light', 'dark'", required = false) private String theme = null;
|
||||||
private String theme = null;
|
|
||||||
|
|
||||||
@Option(name = "-renderbucket-size", usage = "Set a custom GPU renderbucket size (32 for 32x32px, 64 for 64x64px, and so on). NVIDIA GPUs support a maximum renderbucket size of 512x512 pixel, while AMD GPUs support a maximum 2048x2048 pixel renderbucket size. Minimum renderbucket size is 32 pixels for all GPUs", required = false)
|
@Option(name = "-renderbucket-size", usage = "Set a custom GPU renderbucket size (32 for 32x32px, 64 for 64x64px, and so on). NVIDIA GPUs support a maximum renderbucket size of 512x512 pixel, while AMD GPUs support a maximum 2048x2048 pixel renderbucket size. Minimum renderbucket size is 32 pixels for all GPUs", required = false) private int renderbucketSize = -1;
|
||||||
private int renderbucketSize = -1;
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new Worker().doMain(args);
|
new Worker().doMain(args);
|
||||||
@@ -137,7 +116,7 @@ public class Worker {
|
|||||||
Configuration config = new Configuration(null, login, password);
|
Configuration config = new Configuration(null, login, password);
|
||||||
config.setPrintLog(print_log);
|
config.setPrintLog(print_log);
|
||||||
config.setUsePriority(priority);
|
config.setUsePriority(priority);
|
||||||
config.setDetectGPUs(! no_gpu_detection);
|
config.setDetectGPUs(!no_gpu_detection);
|
||||||
|
|
||||||
if (cache_dir != null) {
|
if (cache_dir != null) {
|
||||||
File a_dir = new File(cache_dir);
|
File a_dir = new File(cache_dir);
|
||||||
|
|||||||
@@ -108,12 +108,11 @@ public class Settings implements Activity {
|
|||||||
haveAutoStarted = false;
|
haveAutoStarted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void show() {
|
||||||
public void show() {
|
|
||||||
Configuration config = parent.getConfiguration();
|
Configuration config = parent.getConfiguration();
|
||||||
new SettingsLoader(config.getConfigFilePath()).merge(config);
|
new SettingsLoader(config.getConfigFilePath()).merge(config);
|
||||||
|
|
||||||
applyTheme(config.getTheme()); // apply the proper theme (light/dark)
|
applyTheme(config.getTheme()); // apply the proper theme (light/dark)
|
||||||
|
|
||||||
List<GPUDevice> gpus = GPU.listDevices(config);
|
List<GPUDevice> gpus = GPU.listDevices(config);
|
||||||
useGPUs.clear(); // Empty the auxiliary list (used in the list of checkboxes)
|
useGPUs.clear(); // Empty the auxiliary list (used in the list of checkboxes)
|
||||||
@@ -132,7 +131,7 @@ public class Settings implements Activity {
|
|||||||
++currentRow;
|
++currentRow;
|
||||||
|
|
||||||
constraints.gridy = currentRow;
|
constraints.gridy = currentRow;
|
||||||
parent.getContentPane().add(new JLabel(" "), constraints); // Add a separator between logo and first panel
|
parent.getContentPane().add(new JLabel(" "), constraints); // Add a separator between logo and first panel
|
||||||
|
|
||||||
currentRow++;
|
currentRow++;
|
||||||
|
|
||||||
@@ -260,7 +259,7 @@ public class Settings implements Activity {
|
|||||||
|
|
||||||
if (gpus.size() > 0) {
|
if (gpus.size() > 0) {
|
||||||
renderbucketSizeLabel = new JLabel("Renderbucket size:");
|
renderbucketSizeLabel = new JLabel("Renderbucket size:");
|
||||||
renderbucketSize = new JSlider();
|
renderbucketSize = new JSlider();
|
||||||
renderbucketSize.setMajorTickSpacing(1);
|
renderbucketSize.setMajorTickSpacing(1);
|
||||||
renderbucketSize.setMinorTickSpacing(1);
|
renderbucketSize.setMinorTickSpacing(1);
|
||||||
renderbucketSize.setPaintTicks(true);
|
renderbucketSize.setPaintTicks(true);
|
||||||
@@ -291,7 +290,7 @@ public class Settings implements Activity {
|
|||||||
// Initialisation values will apply if we are not able to detect the proper GPU technology or
|
// Initialisation values will apply if we are not able to detect the proper GPU technology or
|
||||||
// because is a new one (different from CUDA and OPENCL). In that case, move into a safe position
|
// because is a new one (different from CUDA and OPENCL). In that case, move into a safe position
|
||||||
// of 32x32 pixel render bucket and a maximum of 128x128 pixel for the "unknown GPU"
|
// of 32x32 pixel render bucket and a maximum of 128x128 pixel for the "unknown GPU"
|
||||||
int maxRenderbucketSize = 128;
|
int maxRenderbucketSize = 128;
|
||||||
int recommendedBucketSize = 32;
|
int recommendedBucketSize = 32;
|
||||||
|
|
||||||
if (config.getComputeMethod() == ComputeType.GPU || config.getComputeMethod() == ComputeType.CPU_GPU) {
|
if (config.getComputeMethod() == ComputeType.GPU || config.getComputeMethod() == ComputeType.CPU_GPU) {
|
||||||
@@ -331,14 +330,14 @@ public class Settings implements Activity {
|
|||||||
CPU cpu = new CPU();
|
CPU cpu = new CPU();
|
||||||
if (cpu.cores() > 1) { // if only one core is available, no need to show the choice
|
if (cpu.cores() > 1) { // if only one core is available, no need to show the choice
|
||||||
double step = 1;
|
double step = 1;
|
||||||
double display = (double)cpu.cores() / step;
|
double display = (double) cpu.cores() / step;
|
||||||
while (display > 10) {
|
while (display > 10) {
|
||||||
step += 1.0;
|
step += 1.0;
|
||||||
display = (double)cpu.cores() / step;
|
display = (double) cpu.cores() / step;
|
||||||
}
|
}
|
||||||
|
|
||||||
cpuCores = new JSlider(1, cpu.cores());
|
cpuCores = new JSlider(1, cpu.cores());
|
||||||
cpuCores.setMajorTickSpacing((int)(step));
|
cpuCores.setMajorTickSpacing((int) (step));
|
||||||
cpuCores.setMinorTickSpacing(1);
|
cpuCores.setMinorTickSpacing(1);
|
||||||
cpuCores.setPaintTicks(true);
|
cpuCores.setPaintTicks(true);
|
||||||
cpuCores.setPaintLabels(true);
|
cpuCores.setPaintLabels(true);
|
||||||
@@ -365,10 +364,10 @@ public class Settings implements Activity {
|
|||||||
int all_ram = (int) os.getMemory();
|
int all_ram = (int) os.getMemory();
|
||||||
ram = new JSlider(0, all_ram);
|
ram = new JSlider(0, all_ram);
|
||||||
int step = 1000000;
|
int step = 1000000;
|
||||||
double display = (double)all_ram / (double)step;
|
double display = (double) all_ram / (double) step;
|
||||||
while (display > 10) {
|
while (display > 10) {
|
||||||
step += 1000000;
|
step += 1000000;
|
||||||
display = (double)all_ram / (double)step;
|
display = (double) all_ram / (double) step;
|
||||||
}
|
}
|
||||||
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
|
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
|
||||||
for (int g = 0; g < all_ram; g += step) {
|
for (int g = 0; g < all_ram; g += step) {
|
||||||
@@ -378,7 +377,7 @@ public class Settings implements Activity {
|
|||||||
ram.setLabelTable(labelTable);
|
ram.setLabelTable(labelTable);
|
||||||
ram.setPaintTicks(true);
|
ram.setPaintTicks(true);
|
||||||
ram.setPaintLabels(true);
|
ram.setPaintLabels(true);
|
||||||
ram.setValue((int)(config.getMaxMemory() != -1 ? config.getMaxMemory() : os.getMemory()));
|
ram.setValue((int) (config.getMaxMemory() != -1 ? config.getMaxMemory() : os.getMemory()));
|
||||||
JLabel ramLabel = new JLabel("Memory:");
|
JLabel ramLabel = new JLabel("Memory:");
|
||||||
|
|
||||||
compute_devices_constraints.weightx = 1.0 / gpus.size();
|
compute_devices_constraints.weightx = 1.0 / gpus.size();
|
||||||
@@ -405,7 +404,7 @@ public class Settings implements Activity {
|
|||||||
priority.setPaintTicks(true);
|
priority.setPaintTicks(true);
|
||||||
priority.setPaintLabels(true);
|
priority.setPaintLabels(true);
|
||||||
priority.setValue(config.getPriority());
|
priority.setValue(config.getPriority());
|
||||||
JLabel priorityLabel = new JLabel(high_priority_support ? "Priority (High <-> Low):" : "Priority (Normal <-> Low):" );
|
JLabel priorityLabel = new JLabel(high_priority_support ? "Priority (High <-> Low):" : "Priority (Normal <-> Low):");
|
||||||
|
|
||||||
compute_devices_constraints.weightx = 1.0 / gpus.size();
|
compute_devices_constraints.weightx = 1.0 / gpus.size();
|
||||||
compute_devices_constraints.gridx = 0;
|
compute_devices_constraints.gridx = 0;
|
||||||
@@ -452,7 +451,7 @@ public class Settings implements Activity {
|
|||||||
if (parent.getConfiguration().getMaxRenderTime() > 0) {
|
if (parent.getConfiguration().getMaxRenderTime() > 0) {
|
||||||
val = parent.getConfiguration().getMaxRenderTime() / 60;
|
val = parent.getConfiguration().getMaxRenderTime() / 60;
|
||||||
}
|
}
|
||||||
renderTime = new JSpinner(new SpinnerNumberModel(val,0,1000,1));
|
renderTime = new JSpinner(new SpinnerNumberModel(val, 0, 1000, 1));
|
||||||
|
|
||||||
advanced_panel.add(renderTimeLabel);
|
advanced_panel.add(renderTimeLabel);
|
||||||
advanced_panel.add(renderTime);
|
advanced_panel.add(renderTime);
|
||||||
@@ -482,7 +481,7 @@ public class Settings implements Activity {
|
|||||||
|
|
||||||
currentRow++;
|
currentRow++;
|
||||||
constraints.gridy = currentRow;
|
constraints.gridy = currentRow;
|
||||||
parent.getContentPane().add(new JLabel(" "), constraints); // Add a separator between last checkboxes and button
|
parent.getContentPane().add(new JLabel(" "), constraints); // Add a separator between last checkboxes and button
|
||||||
|
|
||||||
currentRow++;
|
currentRow++;
|
||||||
String buttonText = "Start";
|
String buttonText = "Start";
|
||||||
@@ -549,7 +548,8 @@ public class Settings implements Activity {
|
|||||||
try {
|
try {
|
||||||
if (theme_.equals("light")) {
|
if (theme_.equals("light")) {
|
||||||
UIManager.setLookAndFeel(new FlatLightLaf());
|
UIManager.setLookAndFeel(new FlatLightLaf());
|
||||||
} else if (theme_.equals("dark")) {
|
}
|
||||||
|
else if (theme_.equals("dark")) {
|
||||||
UIManager.setLookAndFeel(new FlatDarkLaf());
|
UIManager.setLookAndFeel(new FlatDarkLaf());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,9 +563,10 @@ public class Settings implements Activity {
|
|||||||
|
|
||||||
class ChooseFileAction implements ActionListener {
|
class ChooseFileAction implements ActionListener {
|
||||||
|
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent arg0) {
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
JOptionPane.showMessageDialog(parent.getContentPane(),
|
||||||
JOptionPane.showMessageDialog(parent.getContentPane(), "<html>The working directory has to be dedicated directory. <br />Caution, everything not related to SheepIt-Renderfarm will be removed.<br />You should create a directory specifically for it.</html>", "Warning: files will be removed!", JOptionPane.WARNING_MESSAGE);
|
"<html>The working directory has to be dedicated directory. <br />Caution, everything not related to SheepIt-Renderfarm will be removed.<br />You should create a directory specifically for it.</html>",
|
||||||
|
"Warning: files will be removed!", JOptionPane.WARNING_MESSAGE);
|
||||||
int returnVal = cacheDirChooser.showOpenDialog(parent.getContentPane());
|
int returnVal = cacheDirChooser.showOpenDialog(parent.getContentPane());
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
File file = cacheDirChooser.getSelectedFile();
|
File file = cacheDirChooser.getSelectedFile();
|
||||||
@@ -577,16 +578,14 @@ public class Settings implements Activity {
|
|||||||
|
|
||||||
class CpuChangeAction implements ActionListener {
|
class CpuChangeAction implements ActionListener {
|
||||||
|
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
checkDisplaySaveButton();
|
checkDisplaySaveButton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GpuChangeAction implements ActionListener {
|
class GpuChangeAction implements ActionListener {
|
||||||
|
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
renderbucketSizeLabel.setVisible(false);
|
renderbucketSizeLabel.setVisible(false);
|
||||||
renderbucketSize.setVisible(false);
|
renderbucketSize.setVisible(false);
|
||||||
|
|
||||||
@@ -597,8 +596,8 @@ public class Settings implements Activity {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GPULister gpu;
|
GPULister gpu;
|
||||||
int maxRenderbucketSize = 128; // Max default render bucket size
|
int maxRenderbucketSize = 128; // Max default render bucket size
|
||||||
int recommendedBucketSize = 32; // Default recommended render bucket size
|
int recommendedBucketSize = 32; // Default recommended render bucket size
|
||||||
|
|
||||||
if (useGPUs.get(counter).getGPUDevice().getType().equals("CUDA")) {
|
if (useGPUs.get(counter).getGPUDevice().getType().equals("CUDA")) {
|
||||||
gpu = new Nvidia();
|
gpu = new Nvidia();
|
||||||
@@ -631,8 +630,7 @@ public class Settings implements Activity {
|
|||||||
|
|
||||||
class AutoSignInChangeAction implements ActionListener {
|
class AutoSignInChangeAction implements ActionListener {
|
||||||
|
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
if (autoSignIn.isSelected()) {
|
if (autoSignIn.isSelected()) {
|
||||||
saveFile.setSelected(true);
|
saveFile.setSelected(true);
|
||||||
}
|
}
|
||||||
@@ -640,16 +638,14 @@ public class Settings implements Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ApplyThemeAction implements ActionListener {
|
class ApplyThemeAction implements ActionListener {
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
applyTheme(themeOptionsGroup.getSelection().getActionCommand());
|
applyTheme(themeOptionsGroup.getSelection().getActionCommand());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SaveAction implements ActionListener {
|
class SaveAction implements ActionListener {
|
||||||
|
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -720,7 +716,7 @@ public class Settings implements Activity {
|
|||||||
|
|
||||||
int max_rendertime = -1;
|
int max_rendertime = -1;
|
||||||
if (renderTime != null) {
|
if (renderTime != null) {
|
||||||
max_rendertime = (Integer)renderTime.getValue() * 60;
|
max_rendertime = (Integer) renderTime.getValue() * 60;
|
||||||
config.setMaxRenderTime(max_rendertime);
|
config.setMaxRenderTime(max_rendertime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -752,23 +748,11 @@ public class Settings implements Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (saveFile.isSelected()) {
|
if (saveFile.isSelected()) {
|
||||||
parent.setSettingsLoader(new SettingsLoader(
|
parent.setSettingsLoader(
|
||||||
config.getConfigFilePath(),
|
new SettingsLoader(config.getConfigFilePath(), login.getText(), new String(password.getPassword()), proxyText, hostnameText, method,
|
||||||
login.getText(),
|
selected_gpu, renderbucket_size, cpu_cores, max_ram, max_rendertime, cachePath, autoSignIn.isSelected(), GuiSwing.type,
|
||||||
new String(password.getPassword()),
|
themeOptionsGroup.getSelection().getActionCommand(), // selected theme
|
||||||
proxyText,
|
priority.getValue()));
|
||||||
hostnameText,
|
|
||||||
method,
|
|
||||||
selected_gpu,
|
|
||||||
renderbucket_size,
|
|
||||||
cpu_cores,
|
|
||||||
max_ram,
|
|
||||||
max_rendertime,
|
|
||||||
cachePath,
|
|
||||||
autoSignIn.isSelected(),
|
|
||||||
GuiSwing.type,
|
|
||||||
themeOptionsGroup.getSelection().getActionCommand(), // selected theme
|
|
||||||
priority.getValue()));
|
|
||||||
|
|
||||||
// wait for successful authentication (to store the public key)
|
// wait for successful authentication (to store the public key)
|
||||||
// or do we already have one?
|
// or do we already have one?
|
||||||
@@ -794,17 +778,14 @@ public class Settings implements Activity {
|
|||||||
|
|
||||||
public class CheckCanStart implements KeyListener {
|
public class CheckCanStart implements KeyListener {
|
||||||
|
|
||||||
@Override
|
@Override public void keyPressed(KeyEvent arg0) {
|
||||||
public void keyPressed(KeyEvent arg0) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void keyReleased(KeyEvent arg0) {
|
||||||
public void keyReleased(KeyEvent arg0) {
|
|
||||||
checkDisplaySaveButton();
|
checkDisplaySaveButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void keyTyped(KeyEvent arg0) {
|
||||||
public void keyTyped(KeyEvent arg0) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,8 +102,7 @@ public class Working implements Activity {
|
|||||||
log = Log.getInstance(parent_.getConfiguration());
|
log = Log.getInstance(parent_.getConfiguration());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void show() {
|
||||||
public void show() {
|
|
||||||
// If the stored theme and the UIManager's theme doesn't match is bc the user has changed it
|
// If the stored theme and the UIManager's theme doesn't match is bc the user has changed it
|
||||||
if (!currentTheme.equals(UIManager.getLookAndFeel().getName())) {
|
if (!currentTheme.equals(UIManager.getLookAndFeel().getName())) {
|
||||||
// And, as the user has changed the theme, then we must recreate all the UI elements with session data
|
// And, as the user has changed the theme, then we must recreate all the UI elements with session data
|
||||||
@@ -248,12 +247,12 @@ public class Working implements Activity {
|
|||||||
global_constraints.weightx = 1;
|
global_constraints.weightx = 1;
|
||||||
global_constraints.gridx = 0;
|
global_constraints.gridx = 0;
|
||||||
|
|
||||||
parent.getContentPane().add(new JLabel(" "), global_constraints); // Add a separator between logo and first panel
|
parent.getContentPane().add(new JLabel(" "), global_constraints); // Add a separator between logo and first panel
|
||||||
parent.getContentPane().add(current_project_panel, global_constraints);
|
parent.getContentPane().add(current_project_panel, global_constraints);
|
||||||
parent.getContentPane().add(global_stats_panel, global_constraints);
|
parent.getContentPane().add(global_stats_panel, global_constraints);
|
||||||
parent.getContentPane().add(session_info_panel, global_constraints);
|
parent.getContentPane().add(session_info_panel, global_constraints);
|
||||||
parent.getContentPane().add(last_frame_panel, global_constraints);
|
parent.getContentPane().add(last_frame_panel, global_constraints);
|
||||||
parent.getContentPane().add(new JLabel(" "), global_constraints); // Add a separator between last panel and buttons
|
parent.getContentPane().add(new JLabel(" "), global_constraints); // Add a separator between last panel and buttons
|
||||||
parent.getContentPane().add(buttonsPanel, global_constraints);
|
parent.getContentPane().add(buttonsPanel, global_constraints);
|
||||||
|
|
||||||
Spring widthLeftColumn = getBestWidth(current_project_panel, 4, 2);
|
Spring widthLeftColumn = getBestWidth(current_project_panel, 4, 2);
|
||||||
@@ -314,11 +313,9 @@ public class Working implements Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void displayUploadQueueStats(int queueSize, long queueVolume) {
|
public void displayUploadQueueStats(int queueSize, long queueVolume) {
|
||||||
userInfoQueuedUploadsAndSizeValue.setText(String.format("%d%s%s",
|
userInfoQueuedUploadsAndSizeValue.setText(
|
||||||
queueSize,
|
String.format("%d%s%s", queueSize, (queueSize > 0 ? String.format(" (%.2fMB) ", (queueVolume / 1024.0 / 1024.0)) : ""),
|
||||||
(queueSize > 0 ? String.format(" (%.2fMB) ", (queueVolume / 1024.0 / 1024.0)) : ""),
|
(queueSize == this.parent.getConfiguration().getMaxUploadingJob() ? "- Queue full!" : "")));
|
||||||
(queueSize == this.parent.getConfiguration().getMaxUploadingJob() ? "- Queue full!" : "")
|
|
||||||
));
|
|
||||||
|
|
||||||
// If the user has requested to exit, then we need to update the JButton with the queue size
|
// If the user has requested to exit, then we need to update the JButton with the queue size
|
||||||
if (this.exitAfterFrame.getText().startsWith("Cancel")) {
|
if (this.exitAfterFrame.getText().startsWith("Cancel")) {
|
||||||
@@ -330,20 +327,19 @@ public class Working implements Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)",
|
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)", queueSize, (queueSize > 1 ? "s" : "")));
|
||||||
queueSize,
|
|
||||||
(queueSize > 1 ? "s" : ""))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTime() {
|
public void updateTime() {
|
||||||
if (this.parent.getClient().getStartTime() != 0) {
|
if (this.parent.getClient().getStartTime() != 0) {
|
||||||
user_info_total_rendertime_this_session_value.setText(Utils.humanDuration(new Date((new Date().getTime() - this.parent.getClient().getStartTime()))));
|
user_info_total_rendertime_this_session_value
|
||||||
|
.setText(Utils.humanDuration(new Date((new Date().getTime() - this.parent.getClient().getStartTime()))));
|
||||||
}
|
}
|
||||||
Job job = this.parent.getClient().getRenderingJob();
|
Job job = this.parent.getClient().getRenderingJob();
|
||||||
if (job != null && job.getProcessRender() != null && job.getProcessRender().getStartTime() > 0) {
|
if (job != null && job.getProcessRender() != null && job.getProcessRender().getStartTime() > 0) {
|
||||||
current_project_duration_value.setText("<html>" + Utils.humanDuration(new Date((new Date().getTime() - job.getProcessRender().getStartTime()))) + "</html>");
|
current_project_duration_value
|
||||||
|
.setText("<html>" + Utils.humanDuration(new Date((new Date().getTime() - job.getProcessRender().getStartTime()))) + "</html>");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
current_project_duration_value.setText("");
|
current_project_duration_value.setText("");
|
||||||
@@ -386,8 +382,7 @@ public class Working implements Activity {
|
|||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
log.error(String.format("Working::showLastRender() Unable to load/preview rendered frame [%s]. Exception %s",
|
log.error(String.format("Working::showLastRender() Unable to load/preview rendered frame [%s]. Exception %s",
|
||||||
lastJob.getOutputImagePath(),
|
lastJob.getOutputImagePath(), e.getMessage()));
|
||||||
e.getMessage()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,7 +390,8 @@ public class Working implements Activity {
|
|||||||
lastRender.setIcon(icon);
|
lastRender.setIcon(icon);
|
||||||
// don't use lastJob.getProcessRender().getDuration() due to timezone
|
// don't use lastJob.getProcessRender().getDuration() due to timezone
|
||||||
if (lastJob.getProcessRender().getDuration() > 1) {
|
if (lastJob.getProcessRender().getDuration() > 1) {
|
||||||
lastRenderTime.setText("Render time : " + Utils.humanDuration(new Date(lastJob.getProcessRender().getEndTime() - lastJob.getProcessRender().getStartTime())));
|
lastRenderTime.setText("Render time : " + Utils
|
||||||
|
.humanDuration(new Date(lastJob.getProcessRender().getEndTime() - lastJob.getProcessRender().getStartTime())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -463,8 +459,7 @@ public class Working implements Activity {
|
|||||||
|
|
||||||
class PauseAction implements ActionListener {
|
class PauseAction implements ActionListener {
|
||||||
|
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
Client client = parent.getClient();
|
Client client = parent.getClient();
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
if (client.isSuspended()) {
|
if (client.isSuspended()) {
|
||||||
@@ -482,8 +477,7 @@ public class Working implements Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SettingsAction implements ActionListener {
|
class SettingsAction implements ActionListener {
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
parent.showActivity(ActivityType.SETTINGS);
|
parent.showActivity(ActivityType.SETTINGS);
|
||||||
}
|
}
|
||||||
@@ -491,34 +485,22 @@ public class Working implements Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ExitAfterAction implements ActionListener {
|
class ExitAfterAction implements ActionListener {
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
Client client = parent.getClient();
|
Client client = parent.getClient();
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
if (client.isRunning()) {
|
if (client.isRunning()) {
|
||||||
String[] exitJobOptions = {"Exit after current Jobs", "Exit Immediately", "Do Nothing"};
|
String[] exitJobOptions = { "Exit after current Jobs", "Exit Immediately", "Do Nothing" };
|
||||||
int jobsQueueSize = client.getUploadQueueSize() + (client.isRunning() ? 1 : 0);
|
int jobsQueueSize = client.getUploadQueueSize() + (client.isRunning() ? 1 : 0);
|
||||||
|
|
||||||
int userDecision = JOptionPane.showOptionDialog(
|
int userDecision = JOptionPane.showOptionDialog(null, String.format(
|
||||||
null,
|
"<html>You have <strong>%d frame%s</strong> being uploaded or rendered. Do you want to finish the jobs or exit now?.\n\n",
|
||||||
String.format("<html>You have <strong>%d frame%s</strong> being uploaded or rendered. Do you want to finish the jobs or exit now?.\n\n",
|
jobsQueueSize, // Add the current frame to the total count ONLY if the client is running
|
||||||
jobsQueueSize , // Add the current frame to the total count ONLY if the client is running
|
(jobsQueueSize > 1 ? "s" : ""), (jobsQueueSize > 1 ? (jobsQueueSize + " ") : ""), (jobsQueueSize > 1 ? "s" : "")),
|
||||||
(jobsQueueSize > 1 ? "s" : ""),
|
"Exit Now or Later", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, exitJobOptions,
|
||||||
(jobsQueueSize > 1 ? (jobsQueueSize + " ") : ""),
|
|
||||||
(jobsQueueSize > 1 ? "s" : "")
|
|
||||||
),
|
|
||||||
"Exit Now or Later",
|
|
||||||
JOptionPane.DEFAULT_OPTION,
|
|
||||||
JOptionPane.QUESTION_MESSAGE,
|
|
||||||
null,
|
|
||||||
exitJobOptions,
|
|
||||||
exitJobOptions[2]); // Make the "Do nothing" button the default one to avoid mistakes
|
exitJobOptions[2]); // Make the "Do nothing" button the default one to avoid mistakes
|
||||||
|
|
||||||
if (userDecision == 0) {
|
if (userDecision == 0) {
|
||||||
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)",
|
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)", jobsQueueSize, (jobsQueueSize > 1 ? "s" : "")));
|
||||||
jobsQueueSize,
|
|
||||||
(jobsQueueSize > 1 ? "s" : ""))
|
|
||||||
);
|
|
||||||
|
|
||||||
client.askForStop();
|
client.askForStop();
|
||||||
}
|
}
|
||||||
@@ -536,8 +518,7 @@ public class Working implements Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class blockJobAction implements ActionListener {
|
class blockJobAction implements ActionListener {
|
||||||
@Override
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
Client client = parent.getClient();
|
Client client = parent.getClient();
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
Job job = client.getRenderingJob();
|
Job job = client.getRenderingJob();
|
||||||
|
|||||||
@@ -105,8 +105,7 @@ public class CollapsibleJPanel extends JPanel {
|
|||||||
setMaximumSize(new Dimension(getMaximumSize().width, height));
|
setMaximumSize(new Dimension(getMaximumSize().width, height));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public Component add(Component component) { // Need this to get the original height of panel
|
||||||
public Component add(Component component) { // Need this to get the original height of panel
|
|
||||||
|
|
||||||
Component returnComponent = super.add(component);
|
Component returnComponent = super.add(component);
|
||||||
|
|
||||||
@@ -115,8 +114,7 @@ public class CollapsibleJPanel extends JPanel {
|
|||||||
return returnComponent;
|
return returnComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void setBorder(Border border) { // Need this to get the border title
|
||||||
public void setBorder(Border border) { // Need this to get the border title
|
|
||||||
|
|
||||||
if (border instanceof TitledBorder && (borderTitle == "")) {
|
if (border instanceof TitledBorder && (borderTitle == "")) {
|
||||||
borderTitle = ((TitledBorder) border).getTitle();
|
borderTitle = ((TitledBorder) border).getTitle();
|
||||||
@@ -129,27 +127,22 @@ public class CollapsibleJPanel extends JPanel {
|
|||||||
|
|
||||||
public class onClickHandler implements MouseListener {
|
public class onClickHandler implements MouseListener {
|
||||||
|
|
||||||
@Override
|
@Override public void mouseClicked(MouseEvent e) {
|
||||||
public void mouseClicked(MouseEvent e) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void mousePressed(MouseEvent e) {
|
||||||
public void mousePressed(MouseEvent e) {
|
|
||||||
if (e.getPoint().y < COLLAPSED_HEIGHT) { // Only if click is on top of panel
|
if (e.getPoint().y < COLLAPSED_HEIGHT) { // Only if click is on top of panel
|
||||||
((CollapsibleJPanel) e.getComponent()).toggleCollapsed();
|
((CollapsibleJPanel) e.getComponent()).toggleCollapsed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void mouseEntered(MouseEvent e) {
|
||||||
public void mouseEntered(MouseEvent e) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void mouseExited(MouseEvent e) {
|
||||||
public void mouseExited(MouseEvent e) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void mouseReleased(MouseEvent e) {
|
||||||
public void mouseReleased(MouseEvent e) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ import com.sheepit.client.Job;
|
|||||||
|
|
||||||
public class CLIInputActionHandler implements CLIInputListener {
|
public class CLIInputActionHandler implements CLIInputListener {
|
||||||
|
|
||||||
@Override
|
@Override public void commandEntered(Client client, String command) {
|
||||||
public void commandEntered(Client client, String command) {
|
|
||||||
int priorityLength = "priority".length();
|
int priorityLength = "priority".length();
|
||||||
|
|
||||||
//prevent Null Pointer at next step
|
//prevent Null Pointer at next step
|
||||||
|
|||||||
Reference in New Issue
Block a user