Ref: split Job internal attribut in proper context class

This commit is contained in:
Sheepit Renderfarm
2024-11-20 17:43:26 +00:00
parent ce6aa7ecd4
commit e23ae562e8
7 changed files with 456 additions and 361 deletions

View File

@@ -324,7 +324,7 @@ import okhttp3.HttpUrl;
continue; // go back to ask job
}
this.log.debug("Got work to do id: " + this.renderingJob.getId() + " frame: " + this.renderingJob.getFrameNumber());
this.log.debug("Got work to do id: " + this.renderingJob.getId() + " frame: " + this.renderingJob.getRenderSettings().getFrameNumber());
// As the server allocated a new job to this client, reset the no_job waiting algorithm
this.noJobRetryIter = 0;
@@ -359,7 +359,7 @@ import okhttp3.HttpUrl;
}
if (this.renderingJob.isSynchronousUpload()) { // power or compute_method job, need to upload right away
this.gui.status(String.format("Uploading frame (%.2fMB)", (this.renderingJob.getOutputImageSize() / 1024.0 / 1024.0)));
this.gui.status(String.format("Uploading frame (%.2fMB)", (this.renderingJob.getRenderOutput().getFullImageSize() / 1024.0 / 1024.0)));
ret = confirmJob(this.renderingJob, step);
if (ret != Error.Type.OK) {
@@ -369,12 +369,12 @@ import okhttp3.HttpUrl;
this.renderingJob = null;
}
else {
this.gui.status(String.format("Queuing frame for upload (%.2fMB)", (this.renderingJob.getOutputImageSize() / 1024.0 / 1024.0)));
this.gui.status(String.format("Queuing frame for upload (%.2fMB)", (this.renderingJob.getRenderOutput().getFullImageSize() / 1024.0 / 1024.0)));
this.jobsToValidate.add(new QueuedJob(step, this.renderingJob));
this.uploadQueueSize++;
this.uploadQueueVolume += this.renderingJob.getOutputImageSize();
this.uploadQueueVolume += this.renderingJob.getRenderOutput().getFullImageSize();
this.gui.displayUploadQueueStats(uploadQueueSize, uploadQueueVolume);
this.renderingJob = null;
@@ -430,7 +430,7 @@ import okhttp3.HttpUrl;
this.gui.status("Stopping");
if (this.renderingJob.getProcessRender().getProcess() != null) {
this.renderingJob.setAskForRendererKill(true);
this.renderingJob.getRenderState().setAskForRendererKill(true);
this.renderingJob.getProcessRender().kill();
}
}
@@ -568,7 +568,7 @@ import okhttp3.HttpUrl;
this.uploadQueueSize--;
if (queuedJob.job != null) {
this.uploadQueueVolume -= queuedJob.job.getOutputImageSize();
this.uploadQueueVolume -= queuedJob.job.getRenderOutput().getFullImageSize();
}
this.gui.displayUploadQueueStats(this.uploadQueueSize, this.uploadQueueVolume);
@@ -610,7 +610,7 @@ import okhttp3.HttpUrl;
logHeader.append("====================================================================================================\n");
if (jobToReset != null) {
logHeader.append(String.format("Project ::: %s\n", jobToReset.getName()))
.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));
.append(String.format("Project id: %s frame: %s\n", jobToReset.getId(), jobToReset.getRenderSettings().getFrameNumber())).append(String.format("blender ::: %s\n\n", jobToReset.getRenderOutput().getBlenderLongVersion())).append(String.format("ERROR Type :: %s\n", error));
}
else {
logHeader.append("Project ::: No project allocated.\n")
@@ -633,7 +633,7 @@ import okhttp3.HttpUrl;
HttpUrl.Builder remoteURL = HttpUrl.parse(this.server.getPage("error")).newBuilder();
remoteURL.addQueryParameter("type", error == null ? "" : Integer.toString(error.getValue()));
if (jobToReset != null) {
remoteURL.addQueryParameter("frame", jobToReset.getFrameNumber());
remoteURL.addQueryParameter("frame", jobToReset.getRenderSettings().getFrameNumber());
remoteURL.addQueryParameter("job", jobToReset.getId());
remoteURL.addQueryParameter("render_time", Integer.toString(jobToReset.getProcessRender().getRenderDuration()));
remoteURL.addQueryParameter("memoryused", Long.toString(jobToReset.getProcessRender().getPeakMemoryUsed()));
@@ -929,11 +929,11 @@ import okhttp3.HttpUrl;
protected Error.Type confirmJob(Job ajob, int checkpoint) {
String urlReal = String.format(LOCALE, "%s&rendertime=%d&preptime=%d&memoryused=%s", ajob.getValidationUrl(), ajob.getProcessRender().getRenderDuration(), ajob.getProcessRender().getScenePrepDuration(),
ajob.getProcessRender().getPeakMemoryUsed());
if (ajob.getSpeedSamplesRendered() > 0.0) {
urlReal += String.format(LOCALE, "&speedsamples=%s", ajob.getSpeedSamplesRendered());
if (ajob.getRenderOutput().getSpeedSamplesRendered() > 0.0) {
urlReal += String.format(LOCALE, "&speedsamples=%s", ajob.getRenderOutput().getSpeedSamplesRendered());
}
this.log.debug(checkpoint, "Client::confirmeJob url " + urlReal);
this.log.debug(checkpoint, "path frame " + ajob.getOutputImagePath());
this.log.debug(checkpoint, "path frame " + ajob.getRenderOutput().getFullImagePath());
this.isValidatingJob = true;
int maxTries = 3;
@@ -954,7 +954,7 @@ import okhttp3.HttpUrl;
timeToSleep *= 2; // exponential backoff
}
ret = this.server.HTTPSendFile(urlReal, ajob.getOutputImagePath(), checkpoint, this.gui);
ret = this.server.HTTPSendFile(urlReal, ajob.getRenderOutput().getFullImagePath(), checkpoint, this.gui);
switch (ret) {
case OK:
// no issue, exit the loop
@@ -1003,12 +1003,12 @@ import okhttp3.HttpUrl;
}
// we can remove the frame file
Utils.deleteFile(new File(ajob.getOutputImagePath()));
ajob.setOutputImagePath(null);
Utils.deleteFile(new File(ajob.getRenderOutput().getFullImagePath()));
ajob.getRenderOutput().setFullImagePath(null);
if (ajob.getPreviewImagePath() != null) {
Utils.deleteFile(new File(ajob.getPreviewImagePath()));
ajob.setPreviewImagePath(null);
if (ajob.getRenderOutput().getPreviewImagePath() != null) {
Utils.deleteFile(new File(ajob.getRenderOutput().getPreviewImagePath()));
ajob.getRenderOutput().setPreviewImagePath(null);
}
return confirmJobReturnCode;