diff --git a/src/com/sheepit/client/Client.java b/src/com/sheepit/client/Client.java index 6e6b9f6..51b9ba2 100644 --- a/src/com/sheepit/client/Client.java +++ b/src/com/sheepit/client/Client.java @@ -224,6 +224,11 @@ public class Client { this.log.debug("Got work to do id: " + this.renderingJob.getId() + " frame: " + this.renderingJob.getFrameNumber()); ret = this.work(this.renderingJob); + if (ret == Error.Type.RENDERER_KILLED) { + this.log.removeCheckPoint(step); + continue; + } + if (ret != Error.Type.OK) { Job frame_to_reset = this.renderingJob; // copie it because the sendError will take ~5min to execute this.renderingJob = null; @@ -280,6 +285,7 @@ public class Client { if (this.renderingJob != null) { if (this.renderingJob.getProcess() != null) { OS.getOS().kill(this.renderingJob.getProcess()); + this.renderingJob.setAskForRendererKill(true); } } @@ -633,6 +639,11 @@ public class Client { if (files.length == 0) { this.log.error("Client::runRenderer no picture file found (after finished render (namefile_without_extension " + namefile_without_extension + ")"); + if (ajob.getAskForRendererKill()) { + this.log.debug("Client::runRenderer renderer didn't generate any frame but it due to a kill request"); + return Error.Type.RENDERER_KILLED; + } + String basename = ""; try { basename = ajob.getPath().substring(0, ajob.getPath().lastIndexOf('.')); diff --git a/src/com/sheepit/client/Error.java b/src/com/sheepit/client/Error.java index a2cae96..7aca9c2 100644 --- a/src/com/sheepit/client/Error.java +++ b/src/com/sheepit/client/Error.java @@ -32,6 +32,7 @@ public class Error { DOWNLOAD_FILE, CAN_NOT_CREATE_DIRECTORY, NETWORK_ISSUE, RENDERER_CRASHED, + RENDERER_KILLED, RENDERER_MISSING_LIBRARIES, FAILED_TO_EXECUTE, UNKNOWN @@ -122,6 +123,8 @@ public class Error { return "Renderer have crashed. It's mostly due to a bad project or not enough memory. There is nothing you can do about it. Will try an another project in few minutes."; case RENDERER_MISSING_LIBRARIES: return "Failed to launch runderer. Please check if you have necessary libraries installed and if you have enough free place in working directory."; + case RENDERER_KILLED: + return "The render stop because either you ask to stop or the server (usually render time too high)."; case SESSION_DISABLED: return "The server have disabled your session. It's mostly because your client generate broken frame (gpu not compatible for example)."; default: diff --git a/src/com/sheepit/client/Job.java b/src/com/sheepit/client/Job.java index cab9fbf..921c183 100644 --- a/src/com/sheepit/client/Job.java +++ b/src/com/sheepit/client/Job.java @@ -41,6 +41,7 @@ public class Job { private String updateRenderingStatusMethod; private Process process; + private boolean askForRendererKill; private Configuration config; @@ -63,6 +64,7 @@ public class Job { maxOutputNbLines = 0; updateRenderingStatusMethod = null; process = null; + askForRendererKill = false; } @@ -110,6 +112,14 @@ public class Job { return maxOutputNbLines; } + public void setAskForRendererKill(boolean val) { + askForRendererKill = val; + } + + public boolean getAskForRendererKill() { + return askForRendererKill; + } + public void setProcess(Process val) { process = val; } diff --git a/src/com/sheepit/client/Server.java b/src/com/sheepit/client/Server.java index 11b4a98..09dcef7 100644 --- a/src/com/sheepit/client/Server.java +++ b/src/com/sheepit/client/Server.java @@ -129,6 +129,7 @@ public class Server extends Thread implements HostnameVerifier, X509TrustManager // kill the current process, it will generate an error but it's okay if (this.client != null && this.client.getRenderingJob() != null && this.client.getRenderingJob().getProcess() != null) { OS.getOS().kill(this.client.getRenderingJob().getProcess()); + this.client.getRenderingJob().setAskForRendererKill(true); } } }