Include a header in error log with the information summarised for easier admin analysis (#238)

This commit is contained in:
Luis Uguina
2020-06-03 00:06:03 +10:00
committed by GitHub
parent 399cb9971f
commit c850a95ea4
2 changed files with 38 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ import com.sheepit.client.exception.FermeExceptionServerInMaintenance;
import com.sheepit.client.exception.FermeExceptionServerOverloaded; import com.sheepit.client.exception.FermeExceptionServerOverloaded;
import com.sheepit.client.exception.FermeExceptionSessionDisabled; import com.sheepit.client.exception.FermeExceptionSessionDisabled;
import com.sheepit.client.exception.FermeServerDown; import com.sheepit.client.exception.FermeServerDown;
import com.sheepit.client.hardware.cpu.CPU;
import com.sheepit.client.os.OS; import com.sheepit.client.os.OS;
import lombok.Data; import lombok.Data;
@@ -512,6 +513,28 @@ import lombok.Data;
temp_file.deleteOnExit(); temp_file.deleteOnExit();
FileOutputStream writer = new FileOutputStream(temp_file); 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_); ArrayList<String> logs = this.log.getForCheckPoint(step_);
for (String line : logs) { for (String line : logs) {
writer.write(line.getBytes()); writer.write(line.getBytes());

View File

@@ -73,6 +73,8 @@ import lombok.Getter;
private String password; private String password;
private String extras; private String extras;
private String updateRenderingStatusMethod; private String updateRenderingStatusMethod;
private String blenderShortVersion;
private String blenderLongVersion;
private boolean synchronousUpload; private boolean synchronousUpload;
private RenderProcess render; private RenderProcess render;
private boolean askForRendererKill; private boolean askForRendererKill;
@@ -108,6 +110,8 @@ import lombok.Getter;
serverBlockJob = false; serverBlockJob = false;
log = log_; log = log_;
render = new RenderProcess(); render = new RenderProcess();
blenderShortVersion = null;
blenderLongVersion = null;
} }
public void block() { public void block() {
@@ -297,6 +301,17 @@ import lombok.Getter;
while ((line = input.readLine()) != null) { while ((line = input.readLine()) != null) {
log.debug(line); 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); progress = computeRenderingProgress(line, tilePattern, progress);
updateRenderingMemoryPeak(line); updateRenderingMemoryPeak(line);