2014-11-20 13:21:19 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2010-2014 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;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
2014-11-30 23:42:57 +00:00
|
|
|
import com.sheepit.client.os.OS;
|
|
|
|
|
|
2014-11-20 13:21:19 +00:00
|
|
|
public class Job {
|
|
|
|
|
private String numFrame;
|
|
|
|
|
private String sceneMD5;
|
|
|
|
|
private String rendererMD5;
|
|
|
|
|
private String id;
|
|
|
|
|
private String revision;
|
|
|
|
|
private String pictureFilename;
|
|
|
|
|
private String path; // path inside of the archive
|
|
|
|
|
private String rendererCommand;
|
|
|
|
|
private String script;
|
|
|
|
|
private boolean useGPU;
|
|
|
|
|
private String extras;
|
|
|
|
|
private String updateRenderingStatusMethod;
|
2014-12-05 15:15:24 +00:00
|
|
|
private boolean synchronousUpload;
|
2015-04-27 20:10:36 +01:00
|
|
|
private RenderProcess render;
|
2014-12-03 20:09:50 +00:00
|
|
|
private boolean askForRendererKill;
|
2014-11-20 13:21:19 +00:00
|
|
|
|
|
|
|
|
private Configuration config;
|
|
|
|
|
|
2015-01-13 21:07:58 +01:00
|
|
|
public Job(Configuration config_, String id_, String frame_, String revision_, String path_, boolean use_gpu, String command_, String script_, String sceneMd5_, String rendererMd5_, String extras_, boolean synchronous_upload_, String update_method_) {
|
2014-11-20 13:21:19 +00:00
|
|
|
config = config_;
|
|
|
|
|
id = id_;
|
|
|
|
|
numFrame = frame_;
|
|
|
|
|
revision = revision_;
|
|
|
|
|
path = path_;
|
|
|
|
|
useGPU = use_gpu;
|
|
|
|
|
rendererCommand = command_;
|
|
|
|
|
sceneMD5 = sceneMd5_;
|
|
|
|
|
rendererMD5 = rendererMd5_;
|
|
|
|
|
extras = extras_;
|
2014-12-05 15:15:24 +00:00
|
|
|
synchronousUpload = synchronous_upload_;
|
2014-11-20 13:21:19 +00:00
|
|
|
|
|
|
|
|
pictureFilename = null;
|
|
|
|
|
script = script_;
|
2015-01-13 21:07:58 +01:00
|
|
|
updateRenderingStatusMethod = update_method_;
|
2014-12-03 20:09:50 +00:00
|
|
|
askForRendererKill = false;
|
2014-11-20 13:21:19 +00:00
|
|
|
|
2015-04-27 20:10:36 +01:00
|
|
|
render = new RenderProcess();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public RenderProcess getProcessRender() {
|
|
|
|
|
return render;
|
2014-11-20 13:21:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String toString() {
|
2015-04-27 20:10:36 +01:00
|
|
|
return String.format("Job (numFrame '%s' sceneMD5 '%s' rendererMD5 '%s' ID '%s' revision '%s' pictureFilename '%s' jobPath '%s' gpu %s extras '%s' updateRenderingStatusMethod '%s' render %s)", numFrame, sceneMD5, rendererMD5, id, revision, pictureFilename, path, useGPU, extras, updateRenderingStatusMethod, render);
|
2014-11-20 13:21:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getId() {
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getFrameNumber() {
|
|
|
|
|
return numFrame;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getExtras() {
|
|
|
|
|
return extras;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getScript() {
|
|
|
|
|
return script;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getSceneMD5() {
|
|
|
|
|
return sceneMD5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getRenderMd5() {
|
|
|
|
|
return rendererMD5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getPath() {
|
|
|
|
|
return path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getUpdateRenderingStatusMethod() {
|
|
|
|
|
return updateRenderingStatusMethod;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 20:09:50 +00:00
|
|
|
public void setAskForRendererKill(boolean val) {
|
2015-01-20 22:06:05 +01:00
|
|
|
askForRendererKill = val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean getAskForRendererKill() {
|
|
|
|
|
return askForRendererKill;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-20 13:21:19 +00:00
|
|
|
public String getRenderCommand() {
|
|
|
|
|
return rendererCommand;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean getUseGPU() {
|
|
|
|
|
return useGPU;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getRevision() {
|
|
|
|
|
return revision;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setOutputImagePath(String path) {
|
|
|
|
|
pictureFilename = path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getOutputImagePath() {
|
|
|
|
|
return pictureFilename;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getPrefixOutputImage() {
|
|
|
|
|
return id + "_";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getRendererDirectory() {
|
|
|
|
|
return config.workingDirectory.getAbsolutePath() + File.separator + rendererMD5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getRendererPath() {
|
2014-11-30 23:42:57 +00:00
|
|
|
return getRendererDirectory() + File.separator + OS.getOS().getRenderBinaryPath();
|
2014-11-20 13:21:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getRendererArchivePath() {
|
|
|
|
|
return config.getStorageDir().getAbsolutePath() + File.separator + rendererMD5 + ".zip";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getSceneDirectory() {
|
|
|
|
|
return config.workingDirectory.getAbsolutePath() + File.separator + sceneMD5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getScenePath() {
|
|
|
|
|
return getSceneDirectory() + File.separator + this.path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getSceneArchivePath() {
|
|
|
|
|
return config.workingDirectory.getAbsolutePath() + File.separator + sceneMD5 + ".zip";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean simultaneousUploadIsAllowed() {
|
2014-12-05 15:15:24 +00:00
|
|
|
return synchronousUpload;
|
2014-11-20 13:21:19 +00:00
|
|
|
}
|
|
|
|
|
}
|