|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Shinya Kitaoka |
810553 |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TFARMTASK_H
|
|
Toshihiro Shimizu |
890ddd |
#define TFARMTASK_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
262a92 |
#include <memory></memory>
|
|
Shinya Kitaoka |
262a92 |
|
|
Campbell Barton |
d0e335 |
#include <qdatetime></qdatetime>
|
|
Toshihiro Shimizu |
890ddd |
#include "tpersist.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfarmplatforms.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfilepath.h"
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TFARMAPI
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef TFARMAPI
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TFARM_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define TFARMAPI __declspec(dllexport)
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define TFARMAPI __declspec(dllimport)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define TFARMAPI
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
const int cPortNumber = 51005;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
enum TaskState {
|
|
Toshihiro Shimizu |
890ddd |
Suspended,
|
|
Toshihiro Shimizu |
890ddd |
Waiting,
|
|
Toshihiro Shimizu |
890ddd |
Running,
|
|
Toshihiro Shimizu |
890ddd |
Completed,
|
|
Toshihiro Shimizu |
890ddd |
Aborted,
|
|
Toshihiro Shimizu |
890ddd |
TaskUnknown
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
enum FrameState {
|
|
Toshihiro Shimizu |
890ddd |
FrameDone,
|
|
Toshihiro Shimizu |
890ddd |
FrameFailed
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
enum OverwriteBehavior {
|
|
Toshihiro Shimizu |
890ddd |
Overwrite_All = 0,
|
|
Toshihiro Shimizu |
890ddd |
Overwrite_NoPaint,
|
|
Toshihiro Shimizu |
890ddd |
Overwrite_Off
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define RENDER_LICENSE_NOT_FOUND 888
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFARMAPI TFarmTask : public TPersist
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
typedef QString Id;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFARMAPI Dependencies
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
Dependencies();
|
|
Toshihiro Shimizu |
890ddd |
~Dependencies();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Dependencies(const Dependencies &);
|
|
Toshihiro Shimizu |
890ddd |
Dependencies &operator=(const Dependencies &);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool operator==(const Dependencies &);
|
|
Toshihiro Shimizu |
890ddd |
bool operator!=(const Dependencies &);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void add(const QString &id);
|
|
Toshihiro Shimizu |
890ddd |
void remove(const QString &id);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int getTaskCount() const;
|
|
Toshihiro Shimizu |
890ddd |
QString getTaskId(int i) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
class Data;
|
|
Toshihiro Shimizu |
890ddd |
Data *m_data;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
Id m_id; //!< Internal task identifier
|
|
Toshihiro Shimizu |
890ddd |
Id m_parentId; //!< Task id of the parent task (if any)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool m_isComposerTask; //!< Whether this is a tcomposer task (opposed to tcleanupper task)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString m_name; //!< User-readable name
|
|
Toshihiro Shimizu |
890ddd |
TFilePath m_taskFilePath; //!< Path of the input file affected by the task
|
|
Toshihiro Shimizu |
890ddd |
TFilePath m_outputPath; //!< Path of the task's output file
|
|
Toshihiro Shimizu |
890ddd |
QString m_callerMachineName; //!< Name of the... caller (submitter?) machine
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int m_priority; //!< Priority value used for scheduling order
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString m_user; //!< User who submitted the task
|
|
Toshihiro Shimizu |
890ddd |
QString m_hostName; //!< Machine on which the task was submitted
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TaskState m_status; //!< The task's status (completed, work in progress... etc)
|
|
Toshihiro Shimizu |
890ddd |
QString m_server; //!< Server node (name) the task was supplied to
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QDateTime m_submissionDate;
|
|
Toshihiro Shimizu |
890ddd |
QDateTime m_startDate;
|
|
Toshihiro Shimizu |
890ddd |
QDateTime m_completionDate;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int m_successfullSteps; //
|
|
Toshihiro Shimizu |
890ddd |
int m_failedSteps; //
|
|
Toshihiro Shimizu |
890ddd |
int m_stepCount; // Why 3 values ? One should be found with the other 2!
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int m_from, m_to, m_step, m_shrink; //!< Range data
|
|
Toshihiro Shimizu |
890ddd |
int m_chunkSize; //!< Sub-tasks size
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int m_multimedia;
|
|
Toshihiro Shimizu |
890ddd |
int m_threadsIndex;
|
|
Toshihiro Shimizu |
890ddd |
int m_maxTileSizeIndex;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
OverwriteBehavior m_overwrite;
|
|
Toshihiro Shimizu |
890ddd |
bool m_onlyVisible;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmPlatform m_platform;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Dependencies *m_dependencies;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFarmTask(const QString &name = "");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmTask(const QString &id, const QString &name, const QString &cmdline,
|
|
Toshihiro Shimizu |
890ddd |
const QString &user, const QString &host, int stepCount, int priority);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmTask(
|
|
Toshihiro Shimizu |
890ddd |
const QString &id, const QString &name, bool composerTask,
|
|
Toshihiro Shimizu |
890ddd |
const QString &user, const QString &host,
|
|
Toshihiro Shimizu |
890ddd |
int stepCount, int priority, const TFilePath &taskFilePath,
|
|
Toshihiro Shimizu |
890ddd |
const TFilePath &outputPath,
|
|
Toshihiro Shimizu |
890ddd |
int from, int to, int step, int shrink, int multimedia, int chunksize,
|
|
Toshihiro Shimizu |
890ddd |
int threadsIndex, int maxTileSizeIndex,
|
|
Toshihiro Shimizu |
890ddd |
OverwriteBehavior overwrite, bool onlyvisible);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual ~TFarmTask() { delete m_dependencies; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmTask(const TFarmTask &);
|
|
Toshihiro Shimizu |
890ddd |
TFarmTask &operator=(const TFarmTask &);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool operator==(const TFarmTask &task);
|
|
Toshihiro Shimizu |
890ddd |
bool operator!=(const TFarmTask &task);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual int getTaskCount() const { return 1; }
|
|
Toshihiro Shimizu |
890ddd |
virtual TFarmTask *getTask(int index) { return this; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString getCommandLine(bool isFarmTask = false) const;
|
|
Toshihiro Shimizu |
890ddd |
void parseCommandLine(QString commandLine);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TPersist
|
|
Toshihiro Shimizu |
890ddd |
void loadData(TIStream &is);
|
|
Toshihiro Shimizu |
890ddd |
void saveData(TOStream &os);
|
|
Toshihiro Shimizu |
890ddd |
const TPersistDeclaration *getDeclaration() const;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TFARMAPI TFarmTaskGroup : public TFarmTask
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TFarmTaskGroup();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmTaskGroup(
|
|
Toshihiro Shimizu |
890ddd |
const QString &id, const QString &name,
|
|
Toshihiro Shimizu |
890ddd |
const QString &user,
|
|
Toshihiro Shimizu |
890ddd |
const QString &host, int stepCount, int priority, const TFilePath &taskFilePath,
|
|
Toshihiro Shimizu |
890ddd |
const TFilePath &outputPath,
|
|
Toshihiro Shimizu |
890ddd |
int from, int to, int step, int shrink, int multimedia, int chunksize,
|
|
Toshihiro Shimizu |
890ddd |
int threadsIndex, int maxTileSizeIndex);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmTaskGroup(
|
|
Toshihiro Shimizu |
890ddd |
const QString &id, const QString &name,
|
|
Toshihiro Shimizu |
890ddd |
const QString &user,
|
|
Toshihiro Shimizu |
890ddd |
const QString &host, int stepCount, int priority, const TFilePath &taskFilePath,
|
|
Toshihiro Shimizu |
890ddd |
OverwriteBehavior overwrite, bool onlyvisible);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmTaskGroup(const QString &id, const QString &name, const QString &cmdline,
|
|
Toshihiro Shimizu |
890ddd |
const QString &user, const QString &host, int stepCount, int priority);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmTaskGroup(const TFarmTaskGroup &src);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
~TFarmTaskGroup();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void addTask(TFarmTask *task);
|
|
Toshihiro Shimizu |
890ddd |
void removeTask(TFarmTask *task);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int getTaskCount() const;
|
|
Toshihiro Shimizu |
890ddd |
TFarmTask *getTask(int index);
|
|
Toshihiro Shimizu |
890ddd |
bool changeChunkSize(int chunksize);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TPersist
|
|
Toshihiro Shimizu |
890ddd |
void loadData(TIStream &is);
|
|
Toshihiro Shimizu |
890ddd |
void saveData(TOStream &os);
|
|
Toshihiro Shimizu |
890ddd |
const TPersistDeclaration *getDeclaration() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
class Imp;
|
|
Shinya Kitaoka |
262a92 |
std::unique_ptr<imp> m_imp;</imp>
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|