Merge branch 'feat/status' into 'master'
Feat: send current state to server See merge request sheepitrenderfarm/client!340
This commit is contained in:
@@ -79,6 +79,14 @@ import lombok.Data;
|
||||
import okhttp3.HttpUrl;
|
||||
|
||||
@Data public class Client {
|
||||
public enum State {
|
||||
DOWNLOADING,
|
||||
PREPARING,
|
||||
RENDERING,
|
||||
UPLOADING,
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
public static final int MIN_JOB_ID = 20; //to distinguish between actual jobs and test frames
|
||||
private static final Locale LOCALE = Locale.ENGLISH;
|
||||
private DirectoryManager directoryManager;
|
||||
@@ -86,6 +94,7 @@ import okhttp3.HttpUrl;
|
||||
private ServerRequest serverRequest;
|
||||
private Configuration configuration;
|
||||
private Log log;
|
||||
private State state;
|
||||
private Job renderingJob;
|
||||
private Job previousJob;
|
||||
private BlockingQueue<QueuedJob> jobsToValidate;
|
||||
@@ -109,6 +118,7 @@ import okhttp3.HttpUrl;
|
||||
this.log = Log.getInstance();
|
||||
this.gui = gui;
|
||||
this.directoryManager = new DirectoryManager(this.configuration);
|
||||
this.state = State.UNKNOWN;
|
||||
this.renderingJob = null;
|
||||
this.previousJob = null;
|
||||
this.jobsToValidate = new ArrayBlockingQueue<>(5);
|
||||
@@ -712,6 +722,7 @@ import okhttp3.HttpUrl;
|
||||
gui.setRenderingProjectName(ajob.getName());
|
||||
|
||||
try {
|
||||
this.state = State.DOWNLOADING;
|
||||
downloadRet = this.downloadExecutable(ajob);
|
||||
if (downloadRet != Error.Type.OK) {
|
||||
gui.setRenderingProjectName("");
|
||||
@@ -732,6 +743,8 @@ import okhttp3.HttpUrl;
|
||||
return downloadRet;
|
||||
}
|
||||
|
||||
this.state = State.PREPARING;
|
||||
|
||||
int ret = this.prepareWorkingDirectory(ajob); // decompress renderer and scene archives
|
||||
if (ret != 0) {
|
||||
gui.setRenderingProjectName("");
|
||||
@@ -743,6 +756,7 @@ import okhttp3.HttpUrl;
|
||||
}
|
||||
}
|
||||
catch (SheepItException e) {
|
||||
this.state = State.UNKNOWN;
|
||||
gui.setRenderingProjectName("");
|
||||
for (String logline : directoryManager.filesystemHealthCheck()) {
|
||||
log.debug(logline);
|
||||
@@ -794,6 +808,7 @@ import okhttp3.HttpUrl;
|
||||
}
|
||||
};
|
||||
|
||||
this.state = State.RENDERING;
|
||||
Error.Type err = ajob.render(removeSceneDirectoryOnceRenderHasStartedObserver);
|
||||
gui.setRenderingProjectName("");
|
||||
gui.setRemainingTime("");
|
||||
@@ -805,6 +820,7 @@ import okhttp3.HttpUrl;
|
||||
if (err != Error.Type.OK) {
|
||||
this.log.error("Client::work problem with runRenderer (ret " + err + ")");
|
||||
}
|
||||
this.state = State.UNKNOWN;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,7 @@ public class ServerRequest extends Thread {
|
||||
HttpUrl.Builder urlBuilder = Objects.requireNonNull(HttpUrl.parse(this.getPage("keepmealive"))).newBuilder();
|
||||
urlBuilder.addQueryParameter("paused", String.valueOf(this.client.isSuspended()));
|
||||
urlBuilder.addQueryParameter("sleeping", String.valueOf(this.client.nextJobRequest() != null));
|
||||
urlBuilder.addQueryParameter("state", String.valueOf(this.client.getState()));
|
||||
|
||||
if (this.client != null && this.client.getRenderingJob() != null) {
|
||||
Job job = this.client.getRenderingJob();
|
||||
|
||||
Reference in New Issue
Block a user