Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
Include a header in error log with the information summarised for eas…
Browse files Browse the repository at this point in the history
…ier admin analysis (#238)
  • Loading branch information
luguina authored Jun 2, 2020
1 parent 9ea2a1d commit f8c092d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/com/sheepit/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import com.sheepit.client.exception.FermeExceptionServerOverloaded;
import com.sheepit.client.exception.FermeExceptionSessionDisabled;
import com.sheepit.client.exception.FermeServerDown;
import com.sheepit.client.hardware.cpu.CPU;
import com.sheepit.client.os.OS;

import lombok.Data;
Expand Down Expand Up @@ -512,6 +513,28 @@ protected void sendError(int step_, Job job_to_reset_, Error.Type error) {
temp_file.deleteOnExit();
FileOutputStream writer = new FileOutputStream(temp_file);

// Create a header with the information summarised for easier admin error analysis
Configuration conf = this.configuration;
CPU cpu = OS.getOS().getCPU();

StringBuilder logHeader = new StringBuilder()
.append("====================================================================================================\n")
.append(String.format("%s / %s / %s / SheepIt v%s\n", conf.getLogin(), conf.getHostname(), OS.getOS().name(), conf.getJarVersion()))
.append(String.format("%s x%d %.1f GB RAM\n", cpu.name(), conf.getNbCores(), conf.getMaxMemory() / 1024.0 / 1024.0));

if (conf.getComputeMethod() == Configuration.ComputeType.GPU || conf.getComputeMethod() == Configuration.ComputeType.CPU_GPU) {
logHeader
.append(String.format("%s %.1f GB VRAM\n", conf.getGPUDevice().getModel(), conf.getGPUDevice().getMemory() / 1024.0 / 1024.0 / 1024.0));
}

logHeader.append("====================================================================================================\n")
.append(String.format("Project ::: %s\n", job_to_reset_.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("====================================================================================================\n\n");

writer.write(logHeader.toString().getBytes());

ArrayList<String> logs = this.log.getForCheckPoint(step_);
for (String line : logs) {
writer.write(line.getBytes());
Expand Down
15 changes: 15 additions & 0 deletions src/com/sheepit/client/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
private String password;
private String extras;
private String updateRenderingStatusMethod;
private String blenderShortVersion;
private String blenderLongVersion;
private boolean synchronousUpload;
private RenderProcess render;
private boolean askForRendererKill;
Expand Down Expand Up @@ -108,6 +110,8 @@ public Job(Configuration config_, Gui gui_, Log log_, String id_, String frame_,
serverBlockJob = false;
log = log_;
render = new RenderProcess();
blenderShortVersion = null;
blenderLongVersion = null;
}

public void block() {
Expand Down Expand Up @@ -297,6 +301,17 @@ public Error.Type render(Observer renderStarted) {
while ((line = input.readLine()) != null) {
log.debug(line);

// Process lines until the version is loaded (usually first or second line of log)
if (blenderLongVersion == null) {
Pattern blenderPattern = Pattern.compile("Blender (([0-9]{1,3}\\.[0-9]{0,3}).*)$");
Matcher blendDetectedVersion = blenderPattern.matcher(line);

if (blendDetectedVersion.find()) {
blenderLongVersion = blendDetectedVersion.group(1);
blenderShortVersion = blendDetectedVersion.group(2);
}
}

progress = computeRenderingProgress(line, tilePattern, progress);

updateRenderingMemoryPeak(line);
Expand Down

0 comments on commit f8c092d

Please sign in to comment.