Include more possible errors and revise NO_SPACE_LEFT_ON_DEVICE error
This commit is contained in:
committed by
Sheepit Renderfarm
parent
83ad43a334
commit
fe39f289e2
@@ -50,6 +50,8 @@ import com.sheepit.client.exception.FermeExceptionNoRendererAvailable;
|
||||
import com.sheepit.client.exception.FermeExceptionNoRightToRender;
|
||||
import com.sheepit.client.exception.FermeExceptionNoSession;
|
||||
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
|
||||
import com.sheepit.client.exception.FermeExceptionPathInvalid;
|
||||
import com.sheepit.client.exception.FermeExceptionNoWritePermission;
|
||||
import com.sheepit.client.exception.FermeExceptionServerInMaintenance;
|
||||
import com.sheepit.client.exception.FermeExceptionServerOverloaded;
|
||||
import com.sheepit.client.exception.FermeExceptionSessionDisabled;
|
||||
@@ -390,7 +392,7 @@ import okhttp3.HttpUrl;
|
||||
this.noJobRetryIter = 0;
|
||||
|
||||
ret = this.work(this.renderingJob);
|
||||
if (ret == Error.Type.NO_SPACE_LEFT_ON_DEVICE) {
|
||||
if (ret == Error.Type.NO_SPACE_LEFT_ON_DEVICE || ret == Error.Type.PATH_INVALID || ret == Error.Type.NO_WRITE_PERMISSION ) {
|
||||
Job frame_to_reset = this.renderingJob; // copy it because the sendError will take ~5min to execute
|
||||
this.renderingJob = null;
|
||||
this.gui.error(Error.humanString(ret));
|
||||
@@ -746,9 +748,20 @@ import okhttp3.HttpUrl;
|
||||
return Error.Type.CAN_NOT_CREATE_DIRECTORY;
|
||||
}
|
||||
}
|
||||
catch (FermeExceptionNoSpaceLeftOnDevice e) {
|
||||
catch (FermeException e) {
|
||||
gui.setRenderingProjectName("");
|
||||
return Error.Type.NO_SPACE_LEFT_ON_DEVICE;
|
||||
if (e instanceof FermeExceptionNoSpaceLeftOnDevice) {
|
||||
return Error.Type.NO_SPACE_LEFT_ON_DEVICE;
|
||||
}
|
||||
else if (e instanceof FermeExceptionPathInvalid) {
|
||||
return Error.Type.PATH_INVALID;
|
||||
}
|
||||
else if (e instanceof FermeExceptionNoWritePermission) {
|
||||
return Error.Type.NO_WRITE_PERMISSION;
|
||||
}
|
||||
else {
|
||||
return Error.Type.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
final File scene_file = new File(ajob.getScenePath());
|
||||
@@ -797,17 +810,17 @@ import okhttp3.HttpUrl;
|
||||
return Error.Type.OK;
|
||||
}
|
||||
|
||||
protected Error.Type downloadSceneFile(Job ajob_) throws FermeExceptionNoSpaceLeftOnDevice {
|
||||
protected Error.Type downloadSceneFile(Job ajob_) throws FermeException {
|
||||
return this.downloadFile(ajob_, ajob_.getRequiredSceneArchivePath(), ajob_.getSceneMD5(),
|
||||
String.format(LOCALE, "%s?type=job&job=%s", this.server.getPage("download-archive"), ajob_.getId()), "project");
|
||||
}
|
||||
|
||||
protected Error.Type downloadExecutable(Job ajob) throws FermeExceptionNoSpaceLeftOnDevice {
|
||||
protected Error.Type downloadExecutable(Job ajob) throws FermeException {
|
||||
return this.downloadFile(ajob, ajob.getRequiredRendererArchivePath(), ajob.getRendererMD5(),
|
||||
String.format(LOCALE, "%s?type=binary&job=%s", this.server.getPage("download-archive"), ajob.getId()), "renderer");
|
||||
}
|
||||
|
||||
private Error.Type downloadFile(Job ajob, String local_path, String md5_server, String url, String download_type) throws FermeExceptionNoSpaceLeftOnDevice {
|
||||
private Error.Type downloadFile(Job ajob, String local_path, String md5_server, String url, String download_type) throws FermeException {
|
||||
File local_path_file = new File(local_path);
|
||||
String update_ui = "Downloading " + download_type;
|
||||
|
||||
@@ -937,7 +950,7 @@ import okhttp3.HttpUrl;
|
||||
Utils.delete(new File(ajob.getSceneDirectory()));
|
||||
}
|
||||
|
||||
protected int prepareWorkingDirectory(Job ajob) throws FermeExceptionNoSpaceLeftOnDevice {
|
||||
protected int prepareWorkingDirectory(Job ajob) {
|
||||
int ret;
|
||||
String bestRendererArchive = ajob.getRequiredRendererArchivePath();
|
||||
String renderer_archive = ajob.getRendererArchivePath();
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Error {
|
||||
IMAGE_WRONG_DIMENSION(26),
|
||||
|
||||
// internal error handling
|
||||
NO_SPACE_LEFT_ON_DEVICE(100), ERROR_BAD_RESPONSE(101),
|
||||
NO_SPACE_LEFT_ON_DEVICE(100), ERROR_BAD_RESPONSE(101), PATH_INVALID(102), NO_WRITE_PERMISSION(103)
|
||||
;
|
||||
|
||||
private final int id;
|
||||
@@ -195,7 +195,11 @@ public class Error {
|
||||
case ENGINE_NOT_AVAILABLE:
|
||||
return "Project requires a rendering engine that isn't supported on this machine. Will try another project in a few minutes.";
|
||||
case NO_SPACE_LEFT_ON_DEVICE:
|
||||
return "No space left on hard disk.";
|
||||
return "Your storage medium does not have enough free space available.";
|
||||
case PATH_INVALID:
|
||||
return "The working directory path is not valid";
|
||||
case NO_WRITE_PERMISSION:
|
||||
return "Can't create/modify files due to missing write permissions in working directory.";
|
||||
case IMAGE_WRONG_DIMENSION:
|
||||
return "Rendered image was the wrong resolution. Project is configured incorrectly. Switching to another project.";
|
||||
default:
|
||||
|
||||
@@ -72,6 +72,8 @@ import com.sheepit.client.exception.FermeExceptionNoRendererAvailable;
|
||||
import com.sheepit.client.exception.FermeExceptionNoRightToRender;
|
||||
import com.sheepit.client.exception.FermeExceptionNoSession;
|
||||
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
|
||||
import com.sheepit.client.exception.FermeExceptionPathInvalid;
|
||||
import com.sheepit.client.exception.FermeExceptionNoWritePermission;
|
||||
import com.sheepit.client.exception.FermeExceptionServerInMaintenance;
|
||||
import com.sheepit.client.exception.FermeExceptionServerOverloaded;
|
||||
import com.sheepit.client.exception.FermeExceptionSessionDisabled;
|
||||
@@ -448,7 +450,7 @@ public class Server extends Thread {
|
||||
}
|
||||
}
|
||||
|
||||
public Error.Type HTTPGetFile(String url_, String destination_, Gui gui_, String status_) throws FermeExceptionNoSpaceLeftOnDevice {
|
||||
public Error.Type HTTPGetFile(String url_, String destination_, Gui gui_, String status_) throws FermeException {
|
||||
InputStream is = null;
|
||||
OutputStream output = null;
|
||||
|
||||
@@ -503,7 +505,14 @@ public class Server extends Thread {
|
||||
return Error.Type.OK;
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (Utils.noFreeSpaceOnDisk(new File(destination_).getParent(), log)) {
|
||||
File destFile = new File(destination_);
|
||||
if (destFile.getParentFile().isDirectory() == false) {
|
||||
throw new FermeExceptionPathInvalid();
|
||||
}
|
||||
else if (destFile.canWrite() == false) {
|
||||
throw new FermeExceptionNoWritePermission();
|
||||
}
|
||||
else if (Utils.noFreeSpaceOnDisk(destFile.getParent(), log)) {
|
||||
throw new FermeExceptionNoSpaceLeftOnDevice();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
package com.sheepit.client;
|
||||
|
||||
import com.sheepit.client.Error.ServerCode;
|
||||
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
|
||||
import net.lingala.zip4j.ZipFile;
|
||||
import net.lingala.zip4j.exception.ZipException;
|
||||
import org.w3c.dom.Document;
|
||||
@@ -48,8 +47,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class Utils {
|
||||
public static int unzipFileIntoDirectory(String zipFileName_, String destinationDirectory, char[] password, Log log)
|
||||
throws FermeExceptionNoSpaceLeftOnDevice {
|
||||
public static int unzipFileIntoDirectory(String zipFileName_, String destinationDirectory, char[] password, Log log) {
|
||||
try {
|
||||
ZipFile zipFile = new ZipFile(zipFileName_);
|
||||
// unzipParameters.setIgnoreDateTimeAttributes(true);
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Laurent CLOUET
|
||||
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package com.sheepit.client.exception;
|
||||
|
||||
public class FermeExceptionNoWritePermission extends FermeException {
|
||||
public FermeExceptionNoWritePermission() {
|
||||
super();
|
||||
}
|
||||
|
||||
public FermeExceptionNoWritePermission(String message_) {
|
||||
super(message_);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Laurent CLOUET
|
||||
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package com.sheepit.client.exception;
|
||||
|
||||
public class FermeExceptionPathInvalid extends FermeException {
|
||||
public FermeExceptionPathInvalid() {
|
||||
super();
|
||||
}
|
||||
|
||||
public FermeExceptionPathInvalid(String message_) {
|
||||
super(message_);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user