ARC Graphical Clients: /home/jonas/Development/arc-gui-clients/src/arcsub-ui/jobdefinitions.h Source File

- Main Page
- Classes
- Files

- File List

# /home/jonas/Development/arc-gui-clients/src/arcsub-ui/jobdefinitions.h

    00001 #ifndef JOBDEFINITIONS_H
    00002 #define JOBDEFINITIONS_H
    00003
    00004 #include <QObject>
    00005 #include <QString>
    00006 #include <QStringList>
    00007 #include <QSettings>
    00008 #include <QList>
    00009
    00010 #include "arc-gui-config.h"
    00011
    00012 #if ARC_VERSION_MAJOR >= 3
    00013 #include <arc/compute/JobDescription.h>
    00014 #else
    00015 #include <arc/client/JobDescription.h>
    00016 #endif
    00017
    00018 // Directory/file structure
    00019 //
    00020 // directory [m_jobName].jobdef]
    00021 //             |
    00022 //             +-- [inputFiles]
    00023 //             +-- run.sh [template]
    00024 //             +-- dir param000
    00025 //             |        ...
    00026 //             +-- dir param[m_paraSize-1]
    00027 //                      |
    00028 //                      +-- run.sh [subtituted %(paramId)d %(paramSize)d]
    00029
    00030 class JobDefinitionBase : public QObject
    00031 {
    00032     Q_OBJECT
    00033 public:
    00034     enum TSweepType {ST_SINGLE_INPUT, ST_MULTIPLE_INPUT};
    00035 private:
    00036     Arc::JobDescription m_jobDescription;
    00037     int m_paramSize;
    00038     QString m_name;
    00039     std::string m_xrsl;
    00040     QString m_jobDir;
    00041     QStringList m_inputFiles;
    00042     QStringList m_inputFileUrls;
    00043     QStringList m_perJobFiles;
    00044     QStringList m_perJobFileUrls;
    00045     QStringList m_outputFiles;
    00046     QStringList m_outputFileUrls;
    00047     QStringList m_runtimeEnvironments;
    00048     int m_wallTime;
    00049     int m_memory;
    00050     int m_processorCount;
    00051     QString m_email;
    00052     QString m_executable;
    00053
    00054     TSweepType m_sweepType;
    00055
    00056     void setupJobDir(QString createPath = "");
    00057     void setupParamDirs();
    00058     void setupJobDescription(int param = -1);
    00059 public:
    00060     explicit JobDefinitionBase(QObject *parent = 0, QString name = "");
    00061
    00062     void setParamSize(int nSize);
    00063     int paramSize();
    00064
    00065     void setExecutable(QString name);
    00066     QString executable();
    00067
    00068     void clearArguments();
    00069     void addArgument(QString argument);
    00070
    00071     void setName(QString name);
    00072     QString name();
    00073
    00074     void setEmail(QString email);
    00075     QString email();
    00076
    00077     void setProcessorCount(int count);
    00078     int processorCount();
    00079
    00080     void setSweepType(TSweepType sweepType);
    00081     TSweepType sweepType();
    00082
    00083     void clearInputFiles();
    00084     void addInputFile(QString filename, QString sourceLocation = "");
    00085     void setInputFileAt(int idx, QString filename, QString sourceLocation = "");
    00086     void setInputSourceAt(int idx, QString sourceLocation);
    00087     int inputFileCount();
    00088     QString inputFileAt(int idx);
    00089     QString inputFileSourceAt(int idx);
    00090     void removeInputFile(int idx);
    00091
    00092     void clearPerJobFiles();
    00093     void addPerJobFile(QString filename, QString sourceLocation = "");
    00094     void setPerJobFileAt(int idx, QString filename, QString sourceLocation = "");
    00095     void setPerJobSourceAt(int idx, QString sourceLocation);
    00096     int perJobFileCount();
    00097     QString perJobFileAt(int idx);
    00098     QString perJobFileSourceAt(int idx);
    00099     void removePerJobFile(int idx);
    00100
    00101     void clearOutputFiles();
    00102     void addOutputFile(QString filename, QString targetLocation = "");
    00103     void setOutputFileAt(int idx, QString filename, QString targetLocation = "");
    00104     void setOutputTargetAt(int idx, QString targetLocation);
    00105     int outputFileCount();
    00106     QString outputFileAt(int idx);
    00107     QString outputFileTargetAt(int idx);
    00108     void removeOutputFile(int idx);
    00109
    00110     void clearRuntimes();
    00111     void addRuntime(QString runtimeName, QString runtimeVersion);
    00112     int runtimeCount();
    00113     QString runtimeAt(int idx);
    00114     void removeRuntime(int idx);
    00115
    00116     void setWalltime(int t);
    00117     int walltime();
    00118
    00119     void setMemory(int m);
    00120     int memory();
    00121
    00122     QString jobDir();
    00123
    00124     void clear();
    00125     bool setup();
    00126     bool load(QString jobDefDir);
    00127     bool save(QString saveDir);
    00128     void print();
    00129
    00130     QString xrslString(QString jobName="");
    00131     QString xrslStringParam(int param);
    00132     QString runScript(int param);
    00133
    00134     Arc::JobDescription& jobDescription();
    00135
    00136     Arc::JobDescription& jobDescriptionParam(int i);
    00137
    00138 protected:
    00139     virtual void doCreateRunScript(int paramNumber, int paramSize, QString jobName, QString perJobFilename, QString& script);
    00140     virtual void doProcessInputFile(QString& inputFilename, QString& inputSourceURL, int paramNumber, int paramSize, QString jobName, QString perJobFilename);
    00141     virtual void doProcessOutputFile(QString& outputFilename, QString& outputTargetURL, int paramNumber, int paramSize, QString jobName, QString perJobFilename);
    00142     virtual void doSaveSettings(QSettings& settings);
    00143     virtual void doLoadSettings(QSettings& settings);
    00144
    00145 Q_SIGNALS:
    00146
    00147 public Q_SLOTS:
    00148
    00149 };
    00150
    00151 class ShellScriptDefinition : public JobDefinitionBase
    00152 {
    00153     Q_OBJECT
    00154 private:
    00155     QString m_script;
    00156 public:
    00157     explicit ShellScriptDefinition(QObject *parent = 0, QString name = "");
    00158
    00159     void setScript(QString script);
    00160     QString script();
    00161
    00162 protected:
    00163     virtual void doCreateRunScript(int paramNumber, int paramSize, QString jobName, QString perJobFilename, QString& script);
    00164     virtual void doSaveSettings(QSettings& settings);
    00165     virtual void doLoadSettings(QSettings& settings);
    00166 };
    00167
    00168 #endif // JOBDEFINITIONS_H

All Classes Functions Variables