Merge branch 'feat/static-analytics' into 'master'
Feat/static analytics See merge request sheepitrenderfarm/client!307
This commit is contained in:
@@ -8,6 +8,10 @@ charset = utf-8
|
|||||||
indent_size = 4
|
indent_size = 4
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
|
||||||
|
[*.yml]
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
|
||||||
[*.java]
|
[*.java]
|
||||||
ij_java_class_count_to_use_import_on_demand = 999
|
ij_java_class_count_to_use_import_on_demand = 999
|
||||||
ij_java_names_count_to_use_import_on_demand = 999
|
ij_java_names_count_to_use_import_on_demand = 999
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ plugins {
|
|||||||
id 'java-library'
|
id 'java-library'
|
||||||
id 'application'
|
id 'application'
|
||||||
id 'com.github.johnrengelman.shadow' version '7.1.2'
|
id 'com.github.johnrengelman.shadow' version '7.1.2'
|
||||||
|
id 'pmd'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = '1.11'
|
sourceCompatibility = '1.11'
|
||||||
@@ -63,3 +64,9 @@ jar {
|
|||||||
configurations.implementation.collect { it.isDirectory() ? it : zipTree(it) }
|
configurations.implementation.collect { it.isDirectory() ? it : zipTree(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pmd {
|
||||||
|
ignoreFailures = false
|
||||||
|
ruleSetFiles = files("rulesets/java-sheepit.xml")
|
||||||
|
ruleSets = []
|
||||||
|
}
|
||||||
|
|||||||
57
rulesets/java-sheepit.xml
Normal file
57
rulesets/java-sheepit.xml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<ruleset name="Custom Rules"
|
||||||
|
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||||
|
|
||||||
|
<description>
|
||||||
|
SheepIt client custom rules
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<rule ref="category/java/bestpractices.xml/ArrayIsStoredDirectly" />
|
||||||
|
<rule ref="category/java/bestpractices.xml/AbstractClassWithoutAbstractMethod" />
|
||||||
|
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
|
||||||
|
<rule ref="category/java/bestpractices.xml/CheckResultSet" />
|
||||||
|
<rule ref="category/java/bestpractices.xml/PrimitiveWrapperInstantiation" />
|
||||||
|
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter" />
|
||||||
|
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable" />
|
||||||
|
<!-- <rule ref="category/java/bestpractices.xml/UnusedPrivateField" />-->
|
||||||
|
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod" />
|
||||||
|
|
||||||
|
<rule ref="category/java/codestyle.xml/ExtendsObject" />
|
||||||
|
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
|
||||||
|
<rule ref="category/java/codestyle.xml/TooManyStaticImports" />
|
||||||
|
<rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName" />
|
||||||
|
<rule ref="category/java/codestyle.xml/UnnecessaryImport" />
|
||||||
|
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
|
||||||
|
<!-- <rule ref="category/java/codestyle.xml/UnnecessarySemicolon" />-->
|
||||||
|
<rule ref="category/java/codestyle.xml/UselessQualifiedThis" />
|
||||||
|
<rule ref="category/java/design.xml/SimplifiedTernary" />
|
||||||
|
<rule ref="category/java/design.xml/UselessOverridingMethod" />
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop" />
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor" />
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators" />
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues" />
|
||||||
|
<rule ref="category/java/errorprone.xml/BrokenNullCheck" />
|
||||||
|
<rule ref="category/java/errorprone.xml/CheckSkipResult" />
|
||||||
|
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray" />
|
||||||
|
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices" />
|
||||||
|
<rule ref="category/java/errorprone.xml/JumbledIncrementer" />
|
||||||
|
<rule ref="category/java/errorprone.xml/MisplacedNullCheck" />
|
||||||
|
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode" />
|
||||||
|
<rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock" />
|
||||||
|
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement" />
|
||||||
|
<rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary" />
|
||||||
|
<rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals" />
|
||||||
|
<rule ref="category/java/errorprone.xml/UselessOperationOnImmutable" />
|
||||||
|
<rule ref="category/java/multithreading.xml/AvoidThreadGroup" />
|
||||||
|
<rule ref="category/java/multithreading.xml/DontCallThreadRun" />
|
||||||
|
<rule ref="category/java/multithreading.xml/DoubleCheckedLocking" />
|
||||||
|
<rule ref="category/java/performance.xml/BigIntegerInstantiation" />
|
||||||
|
|
||||||
|
|
||||||
|
</ruleset>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -91,15 +91,15 @@ import okhttp3.HttpUrl;
|
|||||||
private long uploadQueueVolume;
|
private long uploadQueueVolume;
|
||||||
private int noJobRetryIter;
|
private int noJobRetryIter;
|
||||||
|
|
||||||
public Client(Gui gui_, Configuration configuration, String url_) {
|
public Client(Gui gui, Configuration configuration, String url) {
|
||||||
this.configuration = configuration;
|
this.configuration = configuration;
|
||||||
this.server = new Server(url_, this.configuration, this);
|
this.server = new Server(url, this.configuration, this);
|
||||||
this.log = Log.getInstance(this.configuration);
|
this.log = Log.getInstance(this.configuration);
|
||||||
this.gui = gui_;
|
this.gui = gui;
|
||||||
this.directoryManager = new DirectoryManager(this.configuration, this.log);
|
this.directoryManager = new DirectoryManager(this.configuration, this.log);
|
||||||
this.renderingJob = null;
|
this.renderingJob = null;
|
||||||
this.previousJob = null;
|
this.previousJob = null;
|
||||||
this.jobsToValidate = new ArrayBlockingQueue<QueuedJob>(5);
|
this.jobsToValidate = new ArrayBlockingQueue<>(5);
|
||||||
this.isValidatingJob = false;
|
this.isValidatingJob = false;
|
||||||
|
|
||||||
this.disableErrorSending = false;
|
this.disableErrorSending = false;
|
||||||
@@ -115,7 +115,7 @@ import okhttp3.HttpUrl;
|
|||||||
this.sessionStarted = false;
|
this.sessionStarted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
@Override public String toString() {
|
||||||
return String.format("Client (configuration %s, server %s)", this.configuration, this.server);
|
return String.format("Client (configuration %s, server %s)", this.configuration, this.server);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ import okhttp3.HttpUrl;
|
|||||||
shuttingdown = true;
|
shuttingdown = true;
|
||||||
log.debug("Initiating the computer's shutting down process");
|
log.debug("Initiating the computer's shutting down process");
|
||||||
|
|
||||||
if (configuration.getShutdownMode().equals("wait")) {
|
if ("wait".equals(configuration.getShutdownMode())) {
|
||||||
// Soft stop. Complete current render (if any), finish uploading frames and then shutdown the computer
|
// Soft stop. Complete current render (if any), finish uploading frames and then shutdown the computer
|
||||||
askForStop();
|
askForStop();
|
||||||
}
|
}
|
||||||
@@ -183,13 +183,9 @@ import okhttp3.HttpUrl;
|
|||||||
this.server.start(); // for staying alive
|
this.server.start(); // for staying alive
|
||||||
|
|
||||||
// create a thread which will send the frame
|
// create a thread which will send the frame
|
||||||
Runnable runnable_sender = new Runnable() {
|
Runnable runnableSender = this::senderLoop;
|
||||||
public void run() {
|
Thread threadSender = new Thread(runnableSender);
|
||||||
senderLoop();
|
threadSender.start();
|
||||||
}
|
|
||||||
};
|
|
||||||
Thread thread_sender = new Thread(runnable_sender);
|
|
||||||
thread_sender.start();
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
while (this.running) {
|
while (this.running) {
|
||||||
@@ -207,12 +203,12 @@ import okhttp3.HttpUrl;
|
|||||||
|
|
||||||
step = this.log.newCheckPoint();
|
step = this.log.newCheckPoint();
|
||||||
try {
|
try {
|
||||||
Calendar next_request = this.nextJobRequest();
|
Calendar nextRequest = this.nextJobRequest();
|
||||||
if (next_request != null) {
|
if (nextRequest != null) {
|
||||||
// wait
|
// wait
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
this.gui.status(String.format("Waiting until %tR before requesting job", next_request));
|
this.gui.status(String.format("Waiting until %tR before requesting job", nextRequest));
|
||||||
long wait = next_request.getTimeInMillis() - now.getTime();
|
long wait = nextRequest.getTimeInMillis() - now.getTime();
|
||||||
if (wait < 0) {
|
if (wait < 0) {
|
||||||
// it means the client has to wait until the next day
|
// it means the client has to wait until the next day
|
||||||
wait += 24 * 3600 * 1000;
|
wait += 24 * 3600 * 1000;
|
||||||
@@ -247,12 +243,12 @@ import okhttp3.HttpUrl;
|
|||||||
else {
|
else {
|
||||||
this.startTime = new Date().getTime(); // reset start session time because the server did it
|
this.startTime = new Date().getTime(); // reset start session time because the server did it
|
||||||
try {
|
try {
|
||||||
Calendar next_request = this.nextJobRequest();
|
Calendar nextRequest = this.nextJobRequest();
|
||||||
if (next_request != null) {
|
if (nextRequest != null) {
|
||||||
// wait
|
// wait
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
this.gui.status(String.format("Waiting until %tR before requesting job", next_request));
|
this.gui.status(String.format("Waiting until %tR before requesting job", nextRequest));
|
||||||
long timeToSleep = next_request.getTimeInMillis() - now.getTime();
|
long timeToSleep = nextRequest.getTimeInMillis() - now.getTime();
|
||||||
this.activeSleep(timeToSleep);
|
this.activeSleep(timeToSleep);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,10 +272,10 @@ import okhttp3.HttpUrl;
|
|||||||
// SheepItServerDown
|
// SheepItServerDown
|
||||||
// SheepItExceptionBadResponseFromServer
|
// SheepItExceptionBadResponseFromServer
|
||||||
|
|
||||||
int time_sleep = e.getWaitDuration();
|
int timeSleep = e.getWaitDuration();
|
||||||
this.gui.status(String.format(e.getHumanText(), new Date(new Date().getTime() + time_sleep)));
|
this.gui.status(String.format(e.getHumanText(), new Date(new Date().getTime() + timeSleep)));
|
||||||
|
|
||||||
if (this.activeSleep(time_sleep) == false) {
|
if (this.activeSleep(timeSleep) == false) {
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
this.log.removeCheckPoint(step);
|
this.log.removeCheckPoint(step);
|
||||||
@@ -297,13 +293,13 @@ import okhttp3.HttpUrl;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.renderingJob == null) { // no job
|
if (this.renderingJob == null) { // no job
|
||||||
int[] retrySchemeInMilliSeconds = { 300000, 480000, 720000, 900000, 1200000 }; // 5, 8, 12, 15 and 20 minutes
|
int[] retrySchemeInMilliSeconds = { 300_000, 480_000, 720_000, 900_000, 1_200_000 }; // 5, 8, 12, 15 and 20 minutes
|
||||||
|
|
||||||
int time_sleep = retrySchemeInMilliSeconds[(this.noJobRetryIter < retrySchemeInMilliSeconds.length) ?
|
int timeSleep = retrySchemeInMilliSeconds[(this.noJobRetryIter < retrySchemeInMilliSeconds.length) ?
|
||||||
this.noJobRetryIter++ :
|
this.noJobRetryIter++ :
|
||||||
(retrySchemeInMilliSeconds.length - 1)];
|
(retrySchemeInMilliSeconds.length - 1)];
|
||||||
this.gui.status(String.format("No job available. Will try again at %tR", new Date(new Date().getTime() + time_sleep)));
|
this.gui.status(String.format("No job available. Will try again at %tR", new Date(new Date().getTime() + timeSleep)));
|
||||||
if (this.activeSleep(time_sleep) == false) {
|
if (this.activeSleep(timeSleep) == false) {
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
this.log.removeCheckPoint(step);
|
this.log.removeCheckPoint(step);
|
||||||
@@ -317,10 +313,10 @@ import okhttp3.HttpUrl;
|
|||||||
|
|
||||||
ret = this.work(this.renderingJob);
|
ret = this.work(this.renderingJob);
|
||||||
if (ret == Error.Type.NO_SPACE_LEFT_ON_DEVICE || ret == Error.Type.PATH_INVALID || ret == Error.Type.NO_WRITE_PERMISSION ) {
|
if (ret == Error.Type.NO_SPACE_LEFT_ON_DEVICE || ret == Error.Type.PATH_INVALID || ret == Error.Type.NO_WRITE_PERMISSION ) {
|
||||||
Job frame_to_reset = this.renderingJob; // copy it because the sendError will take ~5min to execute
|
Job frameToReset = this.renderingJob; // copy it because the sendError will take ~5min to execute
|
||||||
this.renderingJob = null;
|
this.renderingJob = null;
|
||||||
this.gui.error(Error.humanString(ret));
|
this.gui.error(Error.humanString(ret));
|
||||||
this.sendError(step, frame_to_reset, ret);
|
this.sendError(step, frameToReset, ret);
|
||||||
this.log.removeCheckPoint(step);
|
this.log.removeCheckPoint(step);
|
||||||
return -50;
|
return -50;
|
||||||
}
|
}
|
||||||
@@ -433,7 +429,7 @@ import okhttp3.HttpUrl;
|
|||||||
try {
|
try {
|
||||||
this.server.HTTPRequest(this.server.getPage("logout"));
|
this.server.HTTPRequest(this.server.getPage("logout"));
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException ignored) {
|
||||||
// nothing to do: if the logout failed that's ok
|
// nothing to do: if the logout failed that's ok
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -562,11 +558,11 @@ import okhttp3.HttpUrl;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendError(int step_) {
|
protected void sendError(int step) {
|
||||||
this.sendError(step_, null, null);
|
this.sendError(step, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendError(int step_, Job job_to_reset_, Error.Type error) {
|
protected void sendError(int step, Job jobToReset, Error.Type error) {
|
||||||
if (this.disableErrorSending) {
|
if (this.disableErrorSending) {
|
||||||
this.log.debug("Error sending is disabled, do not send log");
|
this.log.debug("Error sending is disabled, do not send log");
|
||||||
return;
|
return;
|
||||||
@@ -574,10 +570,10 @@ import okhttp3.HttpUrl;
|
|||||||
|
|
||||||
this.log.debug("Sending error to server (type: " + error + ")");
|
this.log.debug("Sending error to server (type: " + error + ")");
|
||||||
try {
|
try {
|
||||||
File temp_file = File.createTempFile("farm_", ".txt");
|
File tempFile = File.createTempFile("farm_", ".txt");
|
||||||
temp_file.createNewFile();
|
tempFile.createNewFile();
|
||||||
temp_file.deleteOnExit();
|
tempFile.deleteOnExit();
|
||||||
FileOutputStream writer = new FileOutputStream(temp_file);
|
FileOutputStream writer = new FileOutputStream(tempFile);
|
||||||
|
|
||||||
// Create a header with the information summarised for easier admin error analysis
|
// Create a header with the information summarised for easier admin error analysis
|
||||||
Configuration conf = this.configuration;
|
Configuration conf = this.configuration;
|
||||||
@@ -594,9 +590,9 @@ import okhttp3.HttpUrl;
|
|||||||
}
|
}
|
||||||
|
|
||||||
logHeader.append("====================================================================================================\n");
|
logHeader.append("====================================================================================================\n");
|
||||||
if (job_to_reset_ != null) {
|
if (jobToReset != null) {
|
||||||
logHeader.append(String.format("Project ::: %s\n", job_to_reset_.getName()))
|
logHeader.append(String.format("Project ::: %s\n", jobToReset.getName()))
|
||||||
.append(String.format("Project id: %s frame: %s\n", job_to_reset_.getId(), job_to_reset_.getFrameNumber())).append(String.format("blender ::: %s\n\n", job_to_reset_.getBlenderLongVersion())).append(String.format("ERROR Type :: %s\n", error));
|
.append(String.format("Project id: %s frame: %s\n", jobToReset.getId(), jobToReset.getFrameNumber())).append(String.format("blender ::: %s\n\n", jobToReset.getBlenderLongVersion())).append(String.format("ERROR Type :: %s\n", error));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logHeader.append("Project ::: No project allocated.\n")
|
logHeader.append("Project ::: No project allocated.\n")
|
||||||
@@ -607,7 +603,7 @@ import okhttp3.HttpUrl;
|
|||||||
// Insert the info at the beginning of the error log
|
// Insert the info at the beginning of the error log
|
||||||
writer.write(logHeader.toString().getBytes());
|
writer.write(logHeader.toString().getBytes());
|
||||||
|
|
||||||
Optional<ArrayList<String>> logs = this.log.getForCheckPoint(step_);
|
Optional<ArrayList<String>> logs = this.log.getForCheckPoint(step);
|
||||||
if (logs.isPresent()) {
|
if (logs.isPresent()) {
|
||||||
for (String line : logs.get()) {
|
for (String line : logs.get()) {
|
||||||
writer.write(line.getBytes());
|
writer.write(line.getBytes());
|
||||||
@@ -618,14 +614,14 @@ import okhttp3.HttpUrl;
|
|||||||
writer.close();
|
writer.close();
|
||||||
HttpUrl.Builder remoteURL = HttpUrl.parse(this.server.getPage("error")).newBuilder();
|
HttpUrl.Builder remoteURL = HttpUrl.parse(this.server.getPage("error")).newBuilder();
|
||||||
remoteURL.addQueryParameter("type", error == null ? "" : Integer.toString(error.getValue()));
|
remoteURL.addQueryParameter("type", error == null ? "" : Integer.toString(error.getValue()));
|
||||||
if (job_to_reset_ != null) {
|
if (jobToReset != null) {
|
||||||
remoteURL.addQueryParameter("frame", job_to_reset_.getFrameNumber());
|
remoteURL.addQueryParameter("frame", jobToReset.getFrameNumber());
|
||||||
remoteURL.addQueryParameter("job", job_to_reset_.getId());
|
remoteURL.addQueryParameter("job", jobToReset.getId());
|
||||||
remoteURL.addQueryParameter("render_time", Integer.toString(job_to_reset_.getProcessRender().getRenderDuration()));
|
remoteURL.addQueryParameter("render_time", Integer.toString(jobToReset.getProcessRender().getRenderDuration()));
|
||||||
remoteURL.addQueryParameter("memoryused", Long.toString(job_to_reset_.getProcessRender().getPeakMemoryUsed()));
|
remoteURL.addQueryParameter("memoryused", Long.toString(jobToReset.getProcessRender().getPeakMemoryUsed()));
|
||||||
}
|
}
|
||||||
this.server.HTTPSendFile(remoteURL.build().toString(), temp_file.getAbsolutePath(), step_, this.gui);
|
this.server.HTTPSendFile(remoteURL.build().toString(), tempFile.getAbsolutePath(), step, this.gui);
|
||||||
temp_file.delete();
|
tempFile.delete();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
@@ -735,26 +731,26 @@ import okhttp3.HttpUrl;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final File scene_file = new File(ajob.getScenePath());
|
final File sceneFile = new File(ajob.getScenePath());
|
||||||
File renderer_file = new File(ajob.getRendererPath());
|
File rendererFile = new File(ajob.getRendererPath());
|
||||||
|
|
||||||
if (scene_file.exists() == false) {
|
if (sceneFile.exists() == false) {
|
||||||
gui.setRenderingProjectName("");
|
gui.setRenderingProjectName("");
|
||||||
for (String logline : configuration.filesystemHealthCheck()) {
|
for (String logline : configuration.filesystemHealthCheck()) {
|
||||||
log.debug(logline);
|
log.debug(logline);
|
||||||
}
|
}
|
||||||
this.log.error("Client::work job preparation failed (scene file '" + scene_file.getAbsolutePath()
|
this.log.error("Client::work job preparation failed (scene file '" + sceneFile.getAbsolutePath()
|
||||||
+ "' does not exist), cleaning directory in hope to recover");
|
+ "' 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 (rendererFile.exists() == false) {
|
||||||
gui.setRenderingProjectName("");
|
gui.setRenderingProjectName("");
|
||||||
for (String logline : configuration.filesystemHealthCheck()) {
|
for (String logline : configuration.filesystemHealthCheck()) {
|
||||||
log.debug(logline);
|
log.debug(logline);
|
||||||
}
|
}
|
||||||
this.log.error("Client::work job preparation failed (renderer file '" + renderer_file.getAbsolutePath()
|
this.log.error("Client::work job preparation failed (renderer file '" + rendererFile.getAbsolutePath()
|
||||||
+ "' does not exist), cleaning directory in hope to recover");
|
+ "' 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;
|
||||||
@@ -764,7 +760,7 @@ import okhttp3.HttpUrl;
|
|||||||
@Override public void update(Observable observable, Object o) {
|
@Override 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();
|
sceneFile.delete();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -782,8 +778,8 @@ import okhttp3.HttpUrl;
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Error.Type downloadSceneFile(Job ajob_) throws SheepItException {
|
protected Error.Type downloadSceneFile(Job ajob) throws SheepItException {
|
||||||
int total = ajob_.getArchiveChunks().size();
|
int total = ajob.getArchiveChunks().size();
|
||||||
int threads = Math.max(1, Math.min(total, 12)); // at least one thread, to avoid IllegalArgumentException if total = 0
|
int threads = Math.max(1, Math.min(total, 12)); // at least one thread, to avoid IllegalArgumentException if total = 0
|
||||||
|
|
||||||
ExecutorService executor = Executors.newFixedThreadPool(threads);
|
ExecutorService executor = Executors.newFixedThreadPool(threads);
|
||||||
@@ -792,9 +788,8 @@ import okhttp3.HttpUrl;
|
|||||||
this.gui.getDownloadProgress().reset("Downloading project");
|
this.gui.getDownloadProgress().reset("Downloading project");
|
||||||
|
|
||||||
for (int i = 0; i < total; i++) {
|
for (int i = 0; i < total; i++) {
|
||||||
Chunk chunk = ajob_.getArchiveChunks().get(i);
|
Chunk chunk = ajob.getArchiveChunks().get(i);
|
||||||
|
|
||||||
int finalI = i;
|
|
||||||
Callable<Type> downloadTask = () -> {
|
Callable<Type> downloadTask = () -> {
|
||||||
DownloadManager downloadManager = new DownloadManager(
|
DownloadManager downloadManager = new DownloadManager(
|
||||||
this.server,
|
this.server,
|
||||||
@@ -804,9 +799,7 @@ import okhttp3.HttpUrl;
|
|||||||
chunk.getMd5(),
|
chunk.getMd5(),
|
||||||
String.format(LOCALE, "%s?chunk=%s", this.server.getPage("download-chunk"), chunk.getId())
|
String.format(LOCALE, "%s?chunk=%s", this.server.getPage("download-chunk"), chunk.getId())
|
||||||
);
|
);
|
||||||
Type ret = null;
|
return downloadManager.download();
|
||||||
ret = downloadManager.download();
|
|
||||||
return ret;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
tasks.add(downloadTask);
|
tasks.add(downloadTask);
|
||||||
@@ -852,31 +845,31 @@ import okhttp3.HttpUrl;
|
|||||||
protected int prepareWorkingDirectory(Job ajob) {
|
protected int prepareWorkingDirectory(Job ajob) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
String renderer_archive = this.directoryManager.getCacheBinaryPathFor(ajob);
|
String rendererArchive = this.directoryManager.getCacheBinaryPathFor(ajob);
|
||||||
String renderer_path = ajob.getRendererDirectory();
|
String rendererPath = ajob.getRendererDirectory();
|
||||||
File renderer_path_file = new File(renderer_path);
|
File rendererPathFile = new File(rendererPath);
|
||||||
|
|
||||||
// file is already downloaded, either on shared directory or cache directory (from this.downloadExecutable)
|
// file is already downloaded, either on shared directory or cache directory (from this.downloadExecutable)
|
||||||
if (this.directoryManager.isSharedEnabled() && new File(this.directoryManager.getSharedBinaryPathFor(ajob)).exists()) {
|
if (this.directoryManager.isSharedEnabled() && new File(this.directoryManager.getSharedBinaryPathFor(ajob)).exists()) {
|
||||||
this.gui.status("Copying renderer from shared downloads directory");
|
this.gui.status("Copying renderer from shared downloads directory");
|
||||||
this.log.debug("Client::prepareWorkingDirectory Copying renderer from shared downloads directory " + this.directoryManager.getSharedBinaryPathFor(ajob) + " into " + this.directoryManager.getCacheBinaryPathFor(ajob));
|
this.log.debug("Client::prepareWorkingDirectory Copying renderer from shared downloads directory " + this.directoryManager.getSharedBinaryPathFor(ajob) + " into " + this.directoryManager.getCacheBinaryPathFor(ajob));
|
||||||
if (this.directoryManager.copyBinaryFromSharedToCache(ajob) == false) {
|
if (this.directoryManager.copyBinaryFromSharedToCache(ajob) == false) {
|
||||||
log.error("Error while copying " + renderer_archive + " from shared downloads directory to working dir");
|
log.error("Error while copying " + rendererArchive + " from shared downloads directory to working dir");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!renderer_path_file.exists()) {
|
if (!rendererPathFile.exists()) {
|
||||||
// we create the directory
|
// we create the directory
|
||||||
renderer_path_file.mkdir();
|
rendererPathFile.mkdir();
|
||||||
|
|
||||||
this.gui.status("Extracting renderer");
|
this.gui.status("Extracting renderer");
|
||||||
this.log.debug("Client::prepareWorkingDirectory Extracting renderer " + renderer_archive + " into " + renderer_path);
|
this.log.debug("Client::prepareWorkingDirectory Extracting renderer " + rendererArchive + " into " + rendererPath);
|
||||||
|
|
||||||
// unzip the archive
|
// unzip the archive
|
||||||
ret = Utils.unzipFileIntoDirectory(renderer_archive, renderer_path, null, log);
|
ret = Utils.unzipFileIntoDirectory(rendererArchive, rendererPath, null, log);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
this.log.error(
|
this.log.error(
|
||||||
"Client::prepareWorkingDirectory, error(1) with Utils.unzipFileIntoDirectory(" + renderer_archive + ", " + renderer_path + ") returned "
|
"Client::prepareWorkingDirectory, error(1) with Utils.unzipFileIntoDirectory(" + rendererArchive + ", " + rendererPath + ") returned "
|
||||||
+ ret);
|
+ 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;
|
||||||
@@ -890,8 +883,8 @@ import okhttp3.HttpUrl;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String scene_path = ajob.getSceneDirectory();
|
String scenePath = ajob.getSceneDirectory();
|
||||||
File scene_path_file = new File(scene_path);
|
File scenePathFile = new File(scenePath);
|
||||||
|
|
||||||
// chunk files are already downloaded, either on shared directory or cache directory (from this.downloadSceneFile)
|
// chunk files are already downloaded, either on shared directory or cache directory (from this.downloadSceneFile)
|
||||||
for (Chunk chunk: ajob.getArchiveChunks()) {
|
for (Chunk chunk: ajob.getArchiveChunks()) {
|
||||||
@@ -906,18 +899,18 @@ import okhttp3.HttpUrl;
|
|||||||
|
|
||||||
/// download the chunks
|
/// download the chunks
|
||||||
|
|
||||||
if (!scene_path_file.exists()) {
|
if (!scenePathFile.exists()) {
|
||||||
// we create the directory
|
// we create the directory
|
||||||
scene_path_file.mkdir();
|
scenePathFile.mkdir();
|
||||||
|
|
||||||
this.gui.status("Extracting project");
|
this.gui.status("Extracting project");
|
||||||
this.log.debug("Client::prepareWorkingDirectory Extracting project into " + scene_path);
|
this.log.debug("Client::prepareWorkingDirectory Extracting project into " + scenePath);
|
||||||
// unzip the archive
|
// unzip the archive
|
||||||
|
|
||||||
Instant startUnzip = Instant.now();
|
Instant startUnzip = Instant.now();
|
||||||
ret = Utils.unzipChunksIntoDirectory(
|
ret = Utils.unzipChunksIntoDirectory(
|
||||||
ajob.getArchiveChunks().stream().map(chunk -> this.directoryManager.getCachePathFor(chunk)).collect(Collectors.toList()),
|
ajob.getArchiveChunks().stream().map(chunk -> this.directoryManager.getCachePathFor(chunk)).collect(Collectors.toList()),
|
||||||
scene_path,
|
scenePath,
|
||||||
ajob.getPassword(),
|
ajob.getPassword(),
|
||||||
log);
|
log);
|
||||||
|
|
||||||
@@ -936,22 +929,22 @@ import okhttp3.HttpUrl;
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Error.Type confirmJob(Job ajob, int checkpoint) {
|
protected Error.Type confirmJob(Job ajob, int checkpoint) {
|
||||||
String url_real = String.format(LOCALE, "%s&rendertime=%d&preptime=%d&memoryused=%s", ajob.getValidationUrl(), ajob.getProcessRender().getRenderDuration(), ajob.getProcessRender().getScenePrepDuration(),
|
String urlReal = String.format(LOCALE, "%s&rendertime=%d&preptime=%d&memoryused=%s", ajob.getValidationUrl(), ajob.getProcessRender().getRenderDuration(), ajob.getProcessRender().getScenePrepDuration(),
|
||||||
ajob.getProcessRender().getPeakMemoryUsed());
|
ajob.getProcessRender().getPeakMemoryUsed());
|
||||||
if (ajob.getSpeedSamplesRendered() > 0.0) {
|
if (ajob.getSpeedSamplesRendered() > 0.0) {
|
||||||
url_real += String.format(LOCALE, "&speedsamples=%s", ajob.getSpeedSamplesRendered());
|
urlReal += String.format(LOCALE, "&speedsamples=%s", ajob.getSpeedSamplesRendered());
|
||||||
}
|
}
|
||||||
this.log.debug(checkpoint, "Client::confirmeJob url " + url_real);
|
this.log.debug(checkpoint, "Client::confirmeJob url " + urlReal);
|
||||||
this.log.debug(checkpoint, "path frame " + ajob.getOutputImagePath());
|
this.log.debug(checkpoint, "path frame " + ajob.getOutputImagePath());
|
||||||
|
|
||||||
this.isValidatingJob = true;
|
this.isValidatingJob = true;
|
||||||
int max_try = 3;
|
int maxTries = 3;
|
||||||
int timeToSleep = 22000;
|
int timeToSleep = 22_000;
|
||||||
ServerCode ret = ServerCode.UNKNOWN;
|
ServerCode ret;
|
||||||
Type confirmJobReturnCode = Error.Type.OK;
|
Type confirmJobReturnCode = Error.Type.OK;
|
||||||
retryLoop:
|
retryLoop:
|
||||||
for (int nb_try = 0; nb_try < max_try; nb_try++) {
|
for (int nbTry = 0; nbTry < maxTries; nbTry++) {
|
||||||
if (nb_try >= 1) {
|
if (nbTry >= 1) {
|
||||||
// sleep before retrying
|
// sleep before retrying
|
||||||
this.log.debug(checkpoint, "Sleep for " + timeToSleep / 1000 + "s before trying to re-upload the frame, previous error: "+ confirmJobReturnCode);
|
this.log.debug(checkpoint, "Sleep for " + timeToSleep / 1000 + "s before trying to re-upload the frame, previous error: "+ confirmJobReturnCode);
|
||||||
try {
|
try {
|
||||||
@@ -963,7 +956,7 @@ import okhttp3.HttpUrl;
|
|||||||
timeToSleep *= 2; // exponential backoff
|
timeToSleep *= 2; // exponential backoff
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = this.server.HTTPSendFile(url_real, ajob.getOutputImagePath(), checkpoint, this.gui);
|
ret = this.server.HTTPSendFile(urlReal, ajob.getOutputImagePath(), checkpoint, this.gui);
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case OK:
|
case OK:
|
||||||
// no issue, exit the loop
|
// no issue, exit the loop
|
||||||
@@ -1024,11 +1017,11 @@ import okhttp3.HttpUrl;
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean shouldWaitBeforeRender() {
|
protected boolean shouldWaitBeforeRender() {
|
||||||
int concurrent_job = this.jobsToValidate.size();
|
int concurrentJob = this.jobsToValidate.size();
|
||||||
if (this.isValidatingJob) {
|
if (this.isValidatingJob) {
|
||||||
concurrent_job++;
|
concurrentJob++;
|
||||||
}
|
}
|
||||||
return (concurrent_job >= this.configuration.getMaxUploadingJob());
|
return (concurrentJob >= this.configuration.getMaxUploadingJob());
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
@@ -1036,7 +1029,7 @@ import okhttp3.HttpUrl;
|
|||||||
* @int checkpoint - the checkpoint associated with the job (to add any additional log to the render output)
|
* @int checkpoint - the checkpoint associated with the job (to add any additional log to the render output)
|
||||||
* @Job job - the job to be validated
|
* @Job job - the job to be validated
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor class QueuedJob {
|
@AllArgsConstructor private class QueuedJob {
|
||||||
final private int checkpoint;
|
final private int checkpoint;
|
||||||
final private Job job;
|
final private Job job;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ import java.util.regex.Pattern;
|
|||||||
archiveChunks = archiveChunks_;
|
archiveChunks = archiveChunks_;
|
||||||
rendererMD5 = rendererMd5_;
|
rendererMD5 = rendererMd5_;
|
||||||
name = name_;
|
name = name_;
|
||||||
password = password_;
|
password = password_.clone();
|
||||||
synchronousUpload = synchronous_upload_;
|
synchronousUpload = synchronous_upload_;
|
||||||
gui = gui_;
|
gui = gui_;
|
||||||
outputImagePath = null;
|
outputImagePath = null;
|
||||||
@@ -344,8 +344,7 @@ import java.util.regex.Pattern;
|
|||||||
getProcessRender().setOsProcess(OS.operatingSystem.getProcess((int) getProcessRender().getProcess().pid()));
|
getProcessRender().setOsProcess(OS.operatingSystem.getProcess((int) getProcessRender().getProcess().pid()));
|
||||||
BufferedReader input = new BufferedReader(new InputStreamReader(getProcessRender().getProcess().getInputStream()));
|
BufferedReader input = new BufferedReader(new InputStreamReader(getProcessRender().getProcess().getInputStream()));
|
||||||
memoryCheck.scheduleAtFixedRate(new TimerTask() {
|
memoryCheck.scheduleAtFixedRate(new TimerTask() {
|
||||||
@Override
|
@Override public void run() {
|
||||||
public void run() {
|
|
||||||
updateProcess();
|
updateProcess();
|
||||||
}
|
}
|
||||||
}, 0L, 200L);
|
}, 0L, 200L);
|
||||||
@@ -464,7 +463,7 @@ import java.util.regex.Pattern;
|
|||||||
return Error.Type.RENDERER_OUT_OF_MEMORY;
|
return Error.Type.RENDERER_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSpeedSamplesRendered(line, progress);
|
updateSpeedSamplesRendered(line);
|
||||||
updateRenderingStatus(line, progress);
|
updateRenderingStatus(line, progress);
|
||||||
Type error = detectError(line);
|
Type error = detectError(line);
|
||||||
if (error != Error.Type.OK) {
|
if (error != Error.Type.OK) {
|
||||||
@@ -681,7 +680,7 @@ import java.util.regex.Pattern;
|
|||||||
return newProgress;
|
return newProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSpeedSamplesRendered(String line, int progress) {
|
private void updateSpeedSamplesRendered(String line) {
|
||||||
// Looking for "Rendered 1281 samples in 66.319402 seconds"
|
// Looking for "Rendered 1281 samples in 66.319402 seconds"
|
||||||
Pattern pattern = Pattern.compile("^Rendered (\\d+) samples in ([\\d.]+) seconds$");
|
Pattern pattern = Pattern.compile("^Rendered (\\d+) samples in ([\\d.]+) seconds$");
|
||||||
Matcher matcher = pattern.matcher(line);
|
Matcher matcher = pattern.matcher(line);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public class Log {
|
|||||||
int checkpointToWrite = (point_ > 0 ? point_ : this.lastCheckPoint);
|
int checkpointToWrite = (point_ > 0 ? point_ : this.lastCheckPoint);
|
||||||
|
|
||||||
if (msg_.equals("") == false) {
|
if (msg_.equals("") == false) {
|
||||||
line = this.dateFormat.format(new java.util.Date()) + " (" + level_ + ") " + msg_;
|
line = this.dateFormat.format(new Date()) + " (" + level_ + ") " + msg_;
|
||||||
if (this.checkpoints.containsKey(checkpointToWrite) && this.checkpoints.get(checkpointToWrite) != null) {
|
if (this.checkpoints.containsKey(checkpointToWrite) && this.checkpoints.get(checkpointToWrite) != null) {
|
||||||
this.checkpoints.get(checkpointToWrite).add(line);
|
this.checkpoints.get(checkpointToWrite).add(line);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,9 @@ public class Md5 {
|
|||||||
InputStream is = Files.newInputStream(Paths.get(path));
|
InputStream is = Files.newInputStream(Paths.get(path));
|
||||||
DigestInputStream dis = new DigestInputStream(is, md);
|
DigestInputStream dis = new DigestInputStream(is, md);
|
||||||
byte[] buffer = new byte[8192];
|
byte[] buffer = new byte[8192];
|
||||||
while (dis.read(buffer) > 0)
|
while (dis.read(buffer) > 0) {
|
||||||
; // process the entire file
|
// process the entire file
|
||||||
|
}
|
||||||
String data = Utils.convertBinaryToHex(md.digest());
|
String data = Utils.convertBinaryToHex(md.digest());
|
||||||
dis.close();
|
dis.close();
|
||||||
is.close();
|
is.close();
|
||||||
|
|||||||
@@ -314,7 +314,6 @@ public class Server extends Thread {
|
|||||||
|
|
||||||
public Job requestJob() throws SheepItException {
|
public Job requestJob() throws SheepItException {
|
||||||
this.log.debug("Server::requestJob");
|
this.log.debug("Server::requestJob");
|
||||||
String url_contents = "";
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
OS os = OS.getOS();
|
OS os = OS.getOS();
|
||||||
@@ -404,7 +403,7 @@ public class Server extends Thread {
|
|||||||
jobData.getRenderTask().getUseGpu() == 1, jobData.getRenderTask().getRendererInfos().getCommandline(), validationUrl,
|
jobData.getRenderTask().getUseGpu() == 1, jobData.getRenderTask().getRendererInfos().getCommandline(), validationUrl,
|
||||||
jobData.getRenderTask().getScript(), jobData.getRenderTask().getChunks(), jobData.getRenderTask().getRendererInfos().getMd5(),
|
jobData.getRenderTask().getScript(), jobData.getRenderTask().getChunks(), jobData.getRenderTask().getRendererInfos().getMd5(),
|
||||||
jobData.getRenderTask().getName(), jobData.getRenderTask().getPassword(),
|
jobData.getRenderTask().getName(), jobData.getRenderTask().getPassword(),
|
||||||
jobData.getRenderTask().getSynchronous_upload().equals("1"), jobData.getRenderTask().getRendererInfos().getUpdate_method());
|
jobData.getRenderTask().getSynchronousUpload().equals("1"), jobData.getRenderTask().getRendererInfos().getUpdateMethod());
|
||||||
}
|
}
|
||||||
catch (SheepItException e) {
|
catch (SheepItException e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@@ -74,8 +74,7 @@ public class SettingsLoader {
|
|||||||
this.propertyName = prop;
|
this.propertyName = prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String toString() {
|
||||||
public String toString() {
|
|
||||||
return propertyName;
|
return propertyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,8 +475,7 @@ public class SettingsLoader {
|
|||||||
if (config.getComputeMethod() == null && computeMethod == null) {
|
if (config.getComputeMethod() == null && computeMethod == null) {
|
||||||
config.setComputeMethod(ComputeType.CPU);
|
config.setComputeMethod(ComputeType.CPU);
|
||||||
}
|
}
|
||||||
else if ((config.getComputeMethod() == null && computeMethod != null) || (computeMethod != null && config.getComputeMethod() != ComputeType
|
else if ((config.getComputeMethod() == null && computeMethod != null) || (computeMethod != null && config.getComputeMethod() != ComputeType.valueOf(computeMethod.getValue()))) {
|
||||||
.valueOf(computeMethod.getValue()))) {
|
|
||||||
if (config.getComputeMethod() == null) {
|
if (config.getComputeMethod() == null) {
|
||||||
config.setComputeMethod(ComputeType.valueOf(computeMethod.getValue()));
|
config.setComputeMethod(ComputeType.valueOf(computeMethod.getValue()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ import net.lingala.zip4j.io.inputstream.ZipInputStream;
|
|||||||
import net.lingala.zip4j.model.LocalFileHeader;
|
import net.lingala.zip4j.model.LocalFileHeader;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@@ -217,15 +215,13 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
String[] files = file.list();
|
String[] files = file.list();
|
||||||
if (files != null) {
|
if (files != null && files.length != 0) {
|
||||||
if (files.length != 0) {
|
|
||||||
for (String temp : files) {
|
for (String temp : files) {
|
||||||
File fileDelete = new File(file, temp);
|
File fileDelete = new File(file, temp);
|
||||||
delete(fileDelete);
|
delete(fileDelete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,4 @@ import java.util.List;
|
|||||||
|
|
||||||
@ElementList(inline = true) private List<FileMD5> md5s;
|
@ElementList(inline = true) private List<FileMD5> md5s;
|
||||||
|
|
||||||
public CacheFileMD5() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,4 @@ import org.simpleframework.xml.Root;
|
|||||||
|
|
||||||
@Attribute private String id;
|
@Attribute private String id;
|
||||||
|
|
||||||
public Chunk() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,4 @@ import org.simpleframework.xml.Root;
|
|||||||
|
|
||||||
@Attribute(required = false) private String action;
|
@Attribute(required = false) private String action;
|
||||||
|
|
||||||
public FileMD5() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.sheepit.client.datamodel;
|
package com.sheepit.client.datamodel;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.ToString;
|
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") @ToString public class HeartBeatInfos {
|
@NoArgsConstructor @Root(strict = false, name = "keepmealive") @ToString public class HeartBeatInfos {
|
||||||
@Attribute @Getter private int status;
|
@Attribute @Getter private int status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.sheepit.client.datamodel;
|
package com.sheepit.client.datamodel;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.simpleframework.xml.Attribute;
|
import org.simpleframework.xml.Attribute;
|
||||||
import org.simpleframework.xml.Element;
|
import org.simpleframework.xml.Element;
|
||||||
@@ -9,7 +10,7 @@ import org.simpleframework.xml.Root;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Root(strict = false, name = "jobrequest") @ToString public class JobInfos {
|
@NoArgsConstructor @Root(strict = false, name = "jobrequest") @ToString public class JobInfos {
|
||||||
|
|
||||||
@Attribute @Getter private int status;
|
@Attribute @Getter private int status;
|
||||||
|
|
||||||
@@ -19,6 +20,4 @@ import java.util.List;
|
|||||||
|
|
||||||
@ElementList(name = "file", inline = true, required = false) @Getter private List<FileMD5> fileMD5s;
|
@ElementList(name = "file", inline = true, required = false) @Getter private List<FileMD5> fileMD5s;
|
||||||
|
|
||||||
public JobInfos() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
package com.sheepit.client.datamodel;
|
package com.sheepit.client.datamodel;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.ToString;
|
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") @ToString public class JobValidation {
|
@NoArgsConstructor @Root(strict = false, name = "jobvalidate") @ToString public class JobValidation {
|
||||||
|
|
||||||
@Attribute @Getter private int status;
|
@Attribute @Getter private int status;
|
||||||
|
|
||||||
public JobValidation() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.sheepit.client.datamodel;
|
package com.sheepit.client.datamodel;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.simpleframework.xml.Attribute;
|
import org.simpleframework.xml.Attribute;
|
||||||
import org.simpleframework.xml.Element;
|
import org.simpleframework.xml.Element;
|
||||||
@@ -9,7 +10,7 @@ import org.simpleframework.xml.Root;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Root(strict = false, name = "job") @Getter @ToString public class RenderTask {
|
@NoArgsConstructor @Root(strict = false, name = "job") @Getter @ToString public class RenderTask {
|
||||||
|
|
||||||
@Attribute(name = "id") private String id;
|
@Attribute(name = "id") private String id;
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Attribute(name = "frame") private String frame;
|
@Attribute(name = "frame") private String frame;
|
||||||
|
|
||||||
@Attribute(name = "synchronous_upload") private String synchronous_upload;
|
@Attribute(name = "synchronous_upload") private String synchronousUpload;
|
||||||
|
|
||||||
@Attribute(name = "validation_url") private String validationUrl;
|
@Attribute(name = "validation_url") private String validationUrl;
|
||||||
|
|
||||||
@@ -33,7 +34,4 @@ import java.util.List;
|
|||||||
|
|
||||||
@Element(name = "script", data = true) private String script;
|
@Element(name = "script", data = true) private String script;
|
||||||
|
|
||||||
public RenderTask() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
package com.sheepit.client.datamodel;
|
package com.sheepit.client.datamodel;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.ToString;
|
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") @ToString public class RendererInfos {
|
@NoArgsConstructor @Root(strict = false, name = "renderer") @ToString public class RendererInfos {
|
||||||
|
|
||||||
@Attribute(name = "md5") @Getter private String md5;
|
@Attribute(name = "md5") @Getter private String md5;
|
||||||
|
|
||||||
@Attribute(name = "commandline") @Getter private String commandline;
|
@Attribute(name = "commandline") @Getter private String commandline;
|
||||||
|
|
||||||
@Attribute(name = "update_method") @Getter private String update_method;
|
@Attribute(name = "update_method") @Getter private String updateMethod;
|
||||||
|
|
||||||
public RendererInfos() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.sheepit.client.datamodel;
|
package com.sheepit.client.datamodel;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.ToString;
|
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") @ToString public class RequestEndPoint {
|
@NoArgsConstructor @Root(strict = false, name = "request") @ToString public class RequestEndPoint {
|
||||||
|
|
||||||
@Attribute @Getter private String type;
|
@Attribute @Getter private String type;
|
||||||
|
|
||||||
@@ -13,6 +14,4 @@ import org.simpleframework.xml.Root;
|
|||||||
|
|
||||||
@Attribute(name = "max-period", required = false) @Getter private int maxPeriod;
|
@Attribute(name = "max-period", required = false) @Getter private int maxPeriod;
|
||||||
|
|
||||||
public RequestEndPoint() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.sheepit.client.datamodel;
|
package com.sheepit.client.datamodel;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.simpleframework.xml.Attribute;
|
import org.simpleframework.xml.Attribute;
|
||||||
@@ -9,7 +10,7 @@ import org.simpleframework.xml.Root;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Root(strict = false, name = "config") @ToString public class ServerConfig {
|
@NoArgsConstructor @Root(strict = false, name = "config") @ToString public class ServerConfig {
|
||||||
|
|
||||||
@Attribute @Getter private int status;
|
@Attribute @Getter private int status;
|
||||||
|
|
||||||
@@ -17,11 +18,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@ElementList(name = "request", inline = true, required = false) private List<RequestEndPoint> requestEndPoints;
|
@ElementList(name = "request", inline = true, required = false) private List<RequestEndPoint> requestEndPoints;
|
||||||
|
|
||||||
@Getter @Setter
|
@Getter @Setter @ElementList(name = "speedtest", required = false) private List<SpeedTestTarget> speedTestTargets;
|
||||||
@ElementList(name = "speedtest", required = false) private List<SpeedTestTarget> speedTestTargets;
|
|
||||||
|
|
||||||
public ServerConfig() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public RequestEndPoint getRequestEndPoint(String type) {
|
public RequestEndPoint getRequestEndPoint(String type) {
|
||||||
if (requestEndPoints != null) {
|
if (requestEndPoints != null) {
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.sheepit.client.datamodel;
|
package com.sheepit.client.datamodel;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.ToString;
|
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") @ToString public class SessionStats {
|
@NoArgsConstructor @Root(strict = false, name = "stats") @ToString public class SessionStats {
|
||||||
|
|
||||||
@Attribute(name = "credits_session") @Getter private int pointsEarnedOnSession;
|
@Attribute(name = "credits_session") @Getter private int pointsEarnedOnSession;
|
||||||
|
|
||||||
@@ -19,7 +20,4 @@ import org.simpleframework.xml.Root;
|
|||||||
|
|
||||||
@Attribute(name = "connected_machine") @Getter private int connectedMachines;
|
@Attribute(name = "connected_machine") @Getter private int connectedMachines;
|
||||||
|
|
||||||
public SessionStats() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.sheepit.client.datamodel;
|
package com.sheepit.client.datamodel;
|
||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.simpleframework.xml.ElementList;
|
import org.simpleframework.xml.ElementList;
|
||||||
@@ -12,7 +11,5 @@ import java.util.List;
|
|||||||
|
|
||||||
@ElementList(inline = true) private List<SpeedTestTargetResult> results;
|
@ElementList(inline = true) private List<SpeedTestTargetResult> results;
|
||||||
|
|
||||||
public SpeedTestResult() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,4 @@ import org.simpleframework.xml.Root;
|
|||||||
|
|
||||||
@Attribute private Integer ping;
|
@Attribute private Integer ping;
|
||||||
|
|
||||||
public SpeedTestTargetResult() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class SheepItException extends Exception {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItException(String message_) {
|
public SheepItException(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,15 +26,15 @@ public class SheepItExceptionBadResponseFromServer extends SheepItExceptionWithR
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItExceptionBadResponseFromServer(String message_) {
|
public SheepItExceptionBadResponseFromServer(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHumanText() {
|
@Override public String getHumanText() {
|
||||||
return "Bad answer from the server. Will try again at %tR";
|
return "Bad answer from the server. Will try again at %tR";
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWaitDuration() {
|
@Override public int getWaitDuration() {
|
||||||
return 1000 * 60 * ThreadLocalRandom.current().nextInt(15, 30 + 1);
|
return 1000 * 60 * ThreadLocalRandom.current().nextInt(15, 30 + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class SheepItExceptionNoRendererAvailable extends SheepItException {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItExceptionNoRendererAvailable(String message_) {
|
public SheepItExceptionNoRendererAvailable(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class SheepItExceptionNoRightToRender extends SheepItException {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItExceptionNoRightToRender(String message_) {
|
public SheepItExceptionNoRightToRender(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class SheepItExceptionNoSession extends SheepItException {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItExceptionNoSession(String message_) {
|
public SheepItExceptionNoSession(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class SheepItExceptionNoSpaceLeftOnDevice extends SheepItException {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItExceptionNoSpaceLeftOnDevice(String message_) {
|
public SheepItExceptionNoSpaceLeftOnDevice(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class SheepItExceptionNoWritePermission extends SheepItException {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItExceptionNoWritePermission(String message_) {
|
public SheepItExceptionNoWritePermission(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class SheepItExceptionPathInvalid extends SheepItException {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItExceptionPathInvalid(String message_) {
|
public SheepItExceptionPathInvalid(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,15 +26,15 @@ public class SheepItExceptionServerInMaintenance extends SheepItExceptionWithReq
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItExceptionServerInMaintenance(String message_) {
|
public SheepItExceptionServerInMaintenance(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHumanText() {
|
@Override public String getHumanText() {
|
||||||
return "The server is under maintenance and cannot allocate a job. Will try again at %tR";
|
return "The server is under maintenance and cannot allocate a job. Will try again at %tR";
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWaitDuration() {
|
@Override public int getWaitDuration() {
|
||||||
return 1000 * 60 * ThreadLocalRandom.current().nextInt(20, 30 + 1);
|
return 1000 * 60 * ThreadLocalRandom.current().nextInt(20, 30 + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,15 +26,15 @@ public class SheepItExceptionServerOverloaded extends SheepItExceptionWithRequir
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItExceptionServerOverloaded(String message_) {
|
public SheepItExceptionServerOverloaded(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHumanText() {
|
@Override public String getHumanText() {
|
||||||
return "The server is overloaded and cannot allocate a job. Will try again at %tR";
|
return "The server is overloaded and cannot allocate a job. Will try again at %tR";
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWaitDuration() {
|
@Override public int getWaitDuration() {
|
||||||
return 1000 * 60 * ThreadLocalRandom.current().nextInt(10, 30 + 1);
|
return 1000 * 60 * ThreadLocalRandom.current().nextInt(10, 30 + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class SheepItExceptionSessionDisabled extends SheepItException {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItExceptionSessionDisabled(String message_) {
|
public SheepItExceptionSessionDisabled(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class SheepItExceptionSessionDisabledDenoisingNotSupported extends SheepI
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItExceptionSessionDisabledDenoisingNotSupported(String message_) {
|
public SheepItExceptionSessionDisabledDenoisingNotSupported(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ public class SheepItExceptionWithRequiredWait extends SheepItException {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItExceptionWithRequiredWait(String message_) {
|
public SheepItExceptionWithRequiredWait(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHumanText() {
|
public String getHumanText() {
|
||||||
|
|||||||
@@ -29,15 +29,15 @@ public class SheepItServerDown extends SheepItExceptionWithRequiredWait {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SheepItServerDown(String message_) {
|
public SheepItServerDown(String message) {
|
||||||
super(message_);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHumanText() {
|
@Override public String getHumanText() {
|
||||||
return "Cannot connect to the server. Please check your connectivity. Will try again at %tR";
|
return "Cannot connect to the server. Please check your connectivity. Will try again at %tR";
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWaitDuration() {
|
@Override public int getWaitDuration() {
|
||||||
return 1000 * 60 * ThreadLocalRandom.current().nextInt(10, 30 + 1);
|
return 1000 * 60 * ThreadLocalRandom.current().nextInt(10, 30 + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ public class HIP {
|
|||||||
HIPLib hip = (HIPLib) Native.load(HIP_LIBRARY, HIPLib.class);
|
HIPLib hip = (HIPLib) Native.load(HIP_LIBRARY, HIPLib.class);
|
||||||
HIP_DEVICES_CACHED = getNumberOfDevices(hip);
|
HIP_DEVICES_CACHED = getNumberOfDevices(hip);
|
||||||
}
|
}
|
||||||
catch (java.lang.UnsatisfiedLinkError e) {
|
catch (UnsatisfiedLinkError e) {
|
||||||
System.out.println("HIP::getGpus failed(A) to load HIP lib (path: " + HIP_LIBRARY + ")");
|
System.out.println("HIP::getGpus failed(A) to load HIP lib (path: " + HIP_LIBRARY + ")");
|
||||||
}
|
}
|
||||||
catch (java.lang.ExceptionInInitializerError e) {
|
catch (ExceptionInInitializerError e) {
|
||||||
System.out.println("HIP::getGpus failed(B) ExceptionInInitializerError " + e);
|
System.out.println("HIP::getGpus failed(B) ExceptionInInitializerError " + e);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.sheepit.client.hardware.gpu.nvidia;
|
package com.sheepit.client.hardware.gpu.nvidia;
|
||||||
|
|
||||||
import com.sun.jna.Library;
|
import com.sun.jna.Library;
|
||||||
import com.sun.jna.ptr.IntByReference;
|
|
||||||
|
|
||||||
//https://docs.nvidia.com/deploy/nvml-api/group__nvmlSystemQueries.html#group__nvmlSystemQueries
|
//https://docs.nvidia.com/deploy/nvml-api/group__nvmlSystemQueries.html#group__nvmlSystemQueries
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import java.util.Map;
|
|||||||
import com.sheepit.client.hardware.gpu.GPUDevice;
|
import com.sheepit.client.hardware.gpu.GPUDevice;
|
||||||
import com.sheepit.client.hardware.gpu.GPULister;
|
import com.sheepit.client.hardware.gpu.GPULister;
|
||||||
import com.sheepit.client.os.OS;
|
import com.sheepit.client.os.OS;
|
||||||
import com.sun.jna.Memory;
|
|
||||||
import com.sun.jna.Native;
|
import com.sun.jna.Native;
|
||||||
import com.sun.jna.ptr.IntByReference;
|
import com.sun.jna.ptr.IntByReference;
|
||||||
import com.sun.jna.ptr.LongByReference;
|
import com.sun.jna.ptr.LongByReference;
|
||||||
@@ -169,10 +168,10 @@ public class Nvidia implements GPULister {
|
|||||||
try {
|
try {
|
||||||
cudalib = (CUDA) Native.load(path, CUDA.class);
|
cudalib = (CUDA) Native.load(path, CUDA.class);
|
||||||
}
|
}
|
||||||
catch (java.lang.UnsatisfiedLinkError e) {
|
catch (UnsatisfiedLinkError e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
catch (java.lang.ExceptionInInitializerError e) {
|
catch (ExceptionInInitializerError e) {
|
||||||
System.out.println("Nvidia::getGpus ExceptionInInitializerError " + e);
|
System.out.println("Nvidia::getGpus ExceptionInInitializerError " + e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -220,8 +219,7 @@ public class Nvidia implements GPULister {
|
|||||||
IntByReference computeCapabilityMajor = new IntByReference();
|
IntByReference computeCapabilityMajor = new IntByReference();
|
||||||
result = cudalib.cuDeviceGetAttribute(computeCapabilityMajor, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, aDevice.getValue());
|
result = cudalib.cuDeviceGetAttribute(computeCapabilityMajor, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, aDevice.getValue());
|
||||||
if (result != CUresult.CUDA_SUCCESS) {
|
if (result != CUresult.CUDA_SUCCESS) {
|
||||||
System.out
|
System.out.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR failed (ret: " + CUresult.stringFor(result) + ")");
|
||||||
.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR failed (ret: " + CUresult.stringFor(result) + ")");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,8 +233,7 @@ public class Nvidia implements GPULister {
|
|||||||
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
|
System.out.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID failed (ret: " + CUresult.stringFor(result) + ")");
|
||||||
.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());
|
||||||
@@ -246,8 +243,7 @@ public class Nvidia implements GPULister {
|
|||||||
}
|
}
|
||||||
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
|
System.out.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID failed (ret: " + CUresult.stringFor(result) + ")");
|
||||||
.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID failed (ret: " + CUresult.stringFor(result) + ")");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,8 +303,7 @@ public class Nvidia implements GPULister {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String blenderId = String
|
String blenderId = String.format("CUDA_%s_%04x:%02x:%02x_OptiX", new String(name).trim(), pciDomainId.getValue(), pciBusId.getValue(), pciDeviceId.getValue());
|
||||||
.format("CUDA_%s_%04x:%02x:%02x_OptiX", new String(name).trim(), 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);
|
||||||
gpu.setDriverVersion(driverVersion);
|
gpu.setDriverVersion(driverVersion);
|
||||||
// for backward compatibility generate a CUDA_N id
|
// for backward compatibility generate a CUDA_N id
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ public class BaseHWInfoImpl implements BasicHWInfoStrategy {
|
|||||||
hardware = new SystemInfo().getHardware();
|
hardware = new SystemInfo().getHardware();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public Optional<String> getMAC() {
|
||||||
public Optional<String> getMAC() {
|
|
||||||
List<String> macs = new ArrayList<>();
|
List<String> macs = new ArrayList<>();
|
||||||
List<NetworkIF> nics = hardware.getNetworkIFs();
|
List<NetworkIF> nics = hardware.getNetworkIFs();
|
||||||
for (NetworkIF nic : nics) {
|
for (NetworkIF nic : nics) {
|
||||||
@@ -32,8 +31,7 @@ public class BaseHWInfoImpl implements BasicHWInfoStrategy {
|
|||||||
return Optional.of(String.join(" ", macs));
|
return Optional.of(String.join(" ", macs));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public Optional<String> getProcessorName() {
|
||||||
public Optional<String> getProcessorName() {
|
|
||||||
return Optional.of(hardware.getProcessor().getProcessorIdentifier().getName());
|
return Optional.of(hardware.getProcessor().getProcessorIdentifier().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,6 @@ public class Linux extends OS {
|
|||||||
private final String NICE_BINARY_PATH = "nice";
|
private final String NICE_BINARY_PATH = "nice";
|
||||||
private final String ID_COMMAND_INVOCATION = "id -u";
|
private final String ID_COMMAND_INVOCATION = "id -u";
|
||||||
|
|
||||||
public Linux() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String name() {
|
@Override public String name() {
|
||||||
return "linux";
|
return "linux";
|
||||||
}
|
}
|
||||||
@@ -55,7 +51,7 @@ public class Linux extends OS {
|
|||||||
|
|
||||||
@Override public Process exec(List<String> command, Map<String, String> env_overight) throws IOException {
|
@Override 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(System.getenv()); // clone the env
|
||||||
|
|
||||||
// if Blender is already loading an OpenGL library, don't need to load Blender's default one (it will
|
// if Blender is already loading an OpenGL library, don't need to load Blender's default one (it will
|
||||||
// create system incompatibilities). If no OpenGL library is found, then load the one included in the binary
|
// create system incompatibilities). If no OpenGL library is found, then load the one included in the binary
|
||||||
@@ -200,7 +196,7 @@ public class Linux extends OS {
|
|||||||
try {
|
try {
|
||||||
// Shutdown the computer waiting delayInMinutes minutes to allow all SheepIt threads to close and exit the app
|
// Shutdown the computer waiting delayInMinutes minutes to allow all SheepIt threads to close and exit the app
|
||||||
ProcessBuilder builder = new ProcessBuilder("shutdown", "-h", String.valueOf(delayInMinutes));
|
ProcessBuilder builder = new ProcessBuilder("shutdown", "-h", String.valueOf(delayInMinutes));
|
||||||
Process process = builder.inheritIO().start();
|
builder.inheritIO().start();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
System.err.println(String.format("Linux::shutdownComputer Unable to execute the 'shutdown -h 1' command. Exception %s", e.getMessage()));
|
System.err.println(String.format("Linux::shutdownComputer Unable to execute the 'shutdown -h 1' command. Exception %s", e.getMessage()));
|
||||||
|
|||||||
@@ -32,10 +32,6 @@ public class Mac extends OS {
|
|||||||
private final String NICE_BINARY_PATH = "nice";
|
private final String NICE_BINARY_PATH = "nice";
|
||||||
private final String ID_COMMAND_INVOCATION = "id -u";
|
private final String ID_COMMAND_INVOCATION = "id -u";
|
||||||
|
|
||||||
public Mac() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String name() {
|
@Override public String name() {
|
||||||
return "mac";
|
return "mac";
|
||||||
}
|
}
|
||||||
@@ -128,7 +124,7 @@ public class Mac extends OS {
|
|||||||
try {
|
try {
|
||||||
// Shutdown the computer waiting delayInMinutes minutes to allow all SheepIt threads to close and exit the app
|
// Shutdown the computer waiting delayInMinutes minutes to allow all SheepIt threads to close and exit the app
|
||||||
ProcessBuilder builder = new ProcessBuilder("shutdown", "-h", String.valueOf(delayInMinutes));
|
ProcessBuilder builder = new ProcessBuilder("shutdown", "-h", String.valueOf(delayInMinutes));
|
||||||
Process process = builder.inheritIO().start();
|
builder.inheritIO().start();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
System.err.println(String.format("Mac::shutdownComputer Unable to execute the 'shutdown -h 1' command. Exception %s", e.getMessage()));
|
System.err.println(String.format("Mac::shutdownComputer Unable to execute the 'shutdown -h 1' command. Exception %s", e.getMessage()));
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public abstract class OS {
|
|||||||
if (proc.isAlive() == false) {
|
if (proc.isAlive() == false) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
java.lang.Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
proc.destroyForcibly();
|
proc.destroyForcibly();
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ public class Windows extends OS {
|
|||||||
kernel32lib = (Kernel32Lib) Native.load(Kernel32Lib.path, Kernel32Lib.class);
|
kernel32lib = (Kernel32Lib) Native.load(Kernel32Lib.path, Kernel32Lib.class);
|
||||||
kernel32lib.SetErrorMode(Kernel32Lib.SEM_NOGPFAULTERRORBOX);
|
kernel32lib.SetErrorMode(Kernel32Lib.SEM_NOGPFAULTERRORBOX);
|
||||||
}
|
}
|
||||||
catch (java.lang.UnsatisfiedLinkError e) {
|
catch (UnsatisfiedLinkError e) {
|
||||||
System.out.println("OS.Windows::exec failed to load kernel32lib " + e);
|
System.out.println("OS.Windows::exec failed to load kernel32lib " + e);
|
||||||
}
|
}
|
||||||
catch (java.lang.ExceptionInInitializerError e) {
|
catch (ExceptionInInitializerError e) {
|
||||||
System.out.println("OS.Windows::exec failed to load kernel32lib " + e);
|
System.out.println("OS.Windows::exec failed to load kernel32lib " + e);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
@@ -192,7 +192,7 @@ public class Windows extends OS {
|
|||||||
try {
|
try {
|
||||||
// Shutdown the computer, waiting delayInMinutes minutes, force app closure and on the shutdown screen indicate that was initiated by SheepIt app
|
// Shutdown the computer, waiting delayInMinutes minutes, force app closure and on the shutdown screen indicate that was initiated by SheepIt app
|
||||||
ProcessBuilder builder = new ProcessBuilder("shutdown", "/s", "/f", "/t", String.valueOf(delayInMinutes * 60), "/c", "\"SheepIt App has initiated this computer shutdown.\"");
|
ProcessBuilder builder = new ProcessBuilder("shutdown", "/s", "/f", "/t", String.valueOf(delayInMinutes * 60), "/c", "\"SheepIt App has initiated this computer shutdown.\"");
|
||||||
Process process = builder.inheritIO().start();
|
builder.inheritIO().start();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
System.err.println(
|
System.err.println(
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ public class WinProcess {
|
|||||||
try {
|
try {
|
||||||
this.kernel32lib = (Kernel32Lib) Native.load(Kernel32Lib.path, Kernel32Lib.class);
|
this.kernel32lib = (Kernel32Lib) Native.load(Kernel32Lib.path, Kernel32Lib.class);
|
||||||
}
|
}
|
||||||
catch (java.lang.UnsatisfiedLinkError e) {
|
catch (UnsatisfiedLinkError e) {
|
||||||
System.out.println("WinProcess::construct " + e);
|
System.out.println("WinProcess::construct " + e);
|
||||||
}
|
}
|
||||||
catch (java.lang.ExceptionInInitializerError e) {
|
catch (ExceptionInInitializerError e) {
|
||||||
System.out.println("WinProcess::construct " + e);
|
System.out.println("WinProcess::construct " + e);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|||||||
@@ -136,7 +136,6 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
private DownloadProgress downloadProgress;
|
private DownloadProgress downloadProgress;
|
||||||
|
|
||||||
private BufferedImage iconSprites;
|
private BufferedImage iconSprites;
|
||||||
private BufferedImage[] trayIconSprites;
|
|
||||||
|
|
||||||
@Getter @Setter private SettingsLoader settingsLoader;
|
@Getter @Setter private SettingsLoader settingsLoader;
|
||||||
|
|
||||||
@@ -183,7 +182,6 @@ 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
|
|
||||||
|
|
||||||
setIconImage(extractImageFromSprite(-1)); // sprite 0 is standard Sheep It! icon
|
setIconImage(extractImageFromSprite(-1)); // sprite 0 is standard Sheep It! icon
|
||||||
}
|
}
|
||||||
@@ -483,14 +481,12 @@ public class GuiSwing extends JFrame implements Gui {
|
|||||||
setIconImage(img);
|
setIconImage(img);
|
||||||
|
|
||||||
// if the app supports the system tray, update as well
|
// if the app supports the system tray, update as well
|
||||||
if (sysTray != null && SystemTray.isSupported()) {
|
if (sysTray != null && SystemTray.isSupported() && 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 public void run() {
|
@Override public void run() {
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ public class GuiTextOneLine implements Gui {
|
|||||||
|
|
||||||
private String project;
|
private String project;
|
||||||
private int rendered;
|
private int rendered;
|
||||||
private int remaining;
|
|
||||||
private String creditsEarned;
|
private String creditsEarned;
|
||||||
private int sigIntCount = 0;
|
private int sigIntCount = 0;
|
||||||
private DateFormat df;
|
private DateFormat df;
|
||||||
@@ -62,7 +61,6 @@ public class GuiTextOneLine implements Gui {
|
|||||||
downloadProgress = new DownloadProgress(this);
|
downloadProgress = new DownloadProgress(this);
|
||||||
project = "";
|
project = "";
|
||||||
rendered = 0;
|
rendered = 0;
|
||||||
remaining = 0;
|
|
||||||
creditsEarned = null;
|
creditsEarned = null;
|
||||||
status = "";
|
status = "";
|
||||||
computeMethod = "";
|
computeMethod = "";
|
||||||
@@ -162,7 +160,6 @@ public class GuiTextOneLine implements Gui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void displayStats(Stats stats) {
|
@Override public void displayStats(Stats stats) {
|
||||||
remaining = stats.getRemainingFrame();
|
|
||||||
creditsEarned = String.valueOf(stats.getCreditsEarnedDuringSession());
|
creditsEarned = String.valueOf(stats.getCreditsEarnedDuringSession());
|
||||||
updateLine();
|
updateLine();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class VersionParameterHandler<T> extends OptionHandler<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public int parseArguments(Parameters params) throws CmdLineException {
|
@Override public int parseArguments(Parameters params) throws CmdLineException {
|
||||||
Configuration config = new Configuration(null, "", "");
|
|
||||||
System.out.println("Version: " + Configuration.jarVersion);
|
System.out.println("Version: " + Configuration.jarVersion);
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ public class Worker {
|
|||||||
try {
|
try {
|
||||||
config.setMaxAllowedMemory(Utils.parseNumber(max_ram) / 1024); // internal value is in KiB
|
config.setMaxAllowedMemory(Utils.parseNumber(max_ram) / 1024); // internal value is in KiB
|
||||||
}
|
}
|
||||||
catch (java.lang.IllegalStateException e) {
|
catch (IllegalStateException e) {
|
||||||
System.err.println(
|
System.err.println(
|
||||||
String.format("ERROR: The entered value of maximum memory (-memory parameter) doesn't seem to be a valid number [%s]", e.getMessage()));
|
String.format("ERROR: The entered value of maximum memory (-memory parameter) doesn't seem to be a valid number [%s]", e.getMessage()));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -62,8 +62,6 @@ import com.sheepit.client.Configuration.ComputeType;
|
|||||||
import com.sheepit.client.hardware.cpu.CPU;
|
import com.sheepit.client.hardware.cpu.CPU;
|
||||||
import com.sheepit.client.hardware.gpu.GPU;
|
import com.sheepit.client.hardware.gpu.GPU;
|
||||||
import com.sheepit.client.hardware.gpu.GPUDevice;
|
import com.sheepit.client.hardware.gpu.GPUDevice;
|
||||||
import com.sheepit.client.hardware.gpu.GPULister;
|
|
||||||
import com.sheepit.client.hardware.gpu.nvidia.Nvidia;
|
|
||||||
import com.sheepit.client.network.Proxy;
|
import com.sheepit.client.network.Proxy;
|
||||||
import com.sheepit.client.os.OS;
|
import com.sheepit.client.os.OS;
|
||||||
import com.sheepit.client.standalone.GuiSwing;
|
import com.sheepit.client.standalone.GuiSwing;
|
||||||
@@ -632,25 +630,16 @@ public class Settings implements Activity {
|
|||||||
class GpuChangeAction implements ActionListener {
|
class GpuChangeAction implements ActionListener {
|
||||||
|
|
||||||
@Override public void actionPerformed(ActionEvent e) {
|
@Override public void actionPerformed(ActionEvent e) {
|
||||||
int counter = 0;
|
|
||||||
for (JCheckBox box : useGPUs) {
|
for (JCheckBox box : useGPUs) {
|
||||||
if (!box.isSelected()) {
|
if (!box.isSelected()) {
|
||||||
box.setSelected(false);
|
box.setSelected(false);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
GPULister gpu;
|
|
||||||
if (useGPUs.get(counter).getGPUDevice().getType().equals(Nvidia.TYPE)) {
|
|
||||||
gpu = new Nvidia();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Simulate a radio button behavior with check buttons while only 1 GPU
|
// Simulate a radio button behavior with check buttons while only 1 GPU
|
||||||
// can be selected at a time
|
// can be selected at a time
|
||||||
if (box.equals(e.getSource()) == false) {
|
if (box.equals(e.getSource()) == false) {
|
||||||
box.setSelected(false);
|
box.setSelected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
counter++;
|
|
||||||
}
|
}
|
||||||
checkDisplaySaveButton();
|
checkDisplaySaveButton();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
package com.sheepit.client.standalone.swing.activity;
|
package com.sheepit.client.standalone.swing.activity;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Container;
|
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.awt.GridLayout;
|
import java.awt.GridLayout;
|
||||||
@@ -31,7 +30,6 @@ import java.awt.event.WindowEvent;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -46,8 +44,6 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.Spring;
|
|
||||||
import javax.swing.SpringLayout;
|
|
||||||
|
|
||||||
import com.sheepit.client.Client;
|
import com.sheepit.client.Client;
|
||||||
import com.sheepit.client.Job;
|
import com.sheepit.client.Job;
|
||||||
@@ -370,11 +366,9 @@ public class Working implements Activity {
|
|||||||
if (this.exitAfterFrame.getText().startsWith("Cancel")) {
|
if (this.exitAfterFrame.getText().startsWith("Cancel")) {
|
||||||
Client client = parent.getClient();
|
Client client = parent.getClient();
|
||||||
|
|
||||||
if (client != null) {
|
if (client != null && client.isRunning()) {
|
||||||
if (client.isRunning()) {
|
|
||||||
queueSize++;
|
queueSize++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)", queueSize, (queueSize > 1 ? "s" : "")));
|
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)", queueSize, (queueSize > 1 ? "s" : "")));
|
||||||
}
|
}
|
||||||
@@ -457,64 +451,6 @@ public class Working implements Activity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void alignPanel(Container parent, int rows, int cols, Spring width) {
|
|
||||||
SpringLayout layout;
|
|
||||||
try {
|
|
||||||
layout = (SpringLayout) parent.getLayout();
|
|
||||||
}
|
|
||||||
catch (ClassCastException exc) {
|
|
||||||
System.err.println("The first argument to makeCompactGrid must use SpringLayout.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Spring x = Spring.constant(0);
|
|
||||||
for (int c = 0; c < cols; c++) {
|
|
||||||
for (int r = 0; r < rows; r++) {
|
|
||||||
SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols);
|
|
||||||
constraints.setX(x);
|
|
||||||
constraints.setWidth(width);
|
|
||||||
}
|
|
||||||
x = Spring.sum(x, width);
|
|
||||||
}
|
|
||||||
|
|
||||||
Spring y = Spring.constant(0);
|
|
||||||
for (int r = 0; r < rows; r++) {
|
|
||||||
Spring height = Spring.constant(0);
|
|
||||||
for (int c = 0; c < cols; c++) {
|
|
||||||
height = Spring.max(height, getConstraintsForCell(r, c, parent, cols).getHeight());
|
|
||||||
}
|
|
||||||
for (int c = 0; c < cols; c++) {
|
|
||||||
SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols);
|
|
||||||
constraints.setY(y);
|
|
||||||
constraints.setHeight(height);
|
|
||||||
}
|
|
||||||
y = Spring.sum(y, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
SpringLayout.Constraints pCons = layout.getConstraints(parent);
|
|
||||||
pCons.setConstraint(SpringLayout.SOUTH, y);
|
|
||||||
pCons.setConstraint(SpringLayout.EAST, x);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Spring getBestWidth(Container parent, int rows, int cols) {
|
|
||||||
Spring x = Spring.constant(0);
|
|
||||||
Spring width = Spring.constant(0);
|
|
||||||
for (int c = 0; c < cols; c++) {
|
|
||||||
|
|
||||||
for (int r = 0; r < rows; r++) {
|
|
||||||
width = Spring.max(width, getConstraintsForCell(r, c, parent, cols).getWidth());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SpringLayout.Constraints getConstraintsForCell(int row, int col, Container parent, int cols) {
|
|
||||||
SpringLayout layout = (SpringLayout) parent.getLayout();
|
|
||||||
Component c = parent.getComponent(row * cols + col);
|
|
||||||
return layout.getConstraints(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getJobsQueueSize(Client client) {
|
private int getJobsQueueSize(Client client) {
|
||||||
return client.getUploadQueueSize() + (client.getRenderingJob() != null ? 1 : 0);
|
return client.getUploadQueueSize() + (client.getRenderingJob() != null ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user