OpendTect-6_4  6.4
batchjobdispatch.h
Go to the documentation of this file.
1 #ifndef batchjobdispatch_h
2 #define batchjobdispatch_h
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Bert
8  Date: Dec 2013
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "generalmod.h"
15 #include "factory.h"
16 #include "oscommand.h"
17 #include "iopar.h"
18 #include "uistring.h"
19 
20 
21 namespace Batch
22 {
23 
27 { mODTextTranslationClass(JobSpec);
28 public:
29 
30  enum ProcType { NonODBase, Attrib, AttribEM, Grid2D,
31  PreStack, SEGY, T2D, TwoDto3D, VelConv, Vol };
32 
33  JobSpec(ProcType);
34  JobSpec( const char* pnm=0 )
35  : prognm_(pnm), execpars_(true) {}
36  JobSpec(const IOPar&);
37 
38  static const char* progNameFor(ProcType);
39  static ProcType procTypeFor(const char*);
40 
45 
46  void usePar(const IOPar&);
47  void fillPar(IOPar&) const;
48 
49 };
50 
51 
71 { mODTextTranslationClass(JobDispatcher);
72 public:
73 
75 
76  virtual ~JobDispatcher() {}
77 
78  virtual uiString description() const = 0;
79  virtual bool isSuitedFor(const char* prognm) const = 0;
80  virtual bool canHandle(const JobSpec&) const;
81  virtual bool canResume(const JobSpec&) const { return false; }
82 
83  bool go(const JobSpec&);
84  uiString errMsg() const { return errmsg_; }
85 
86  mDefineFactoryInClass(JobDispatcher,factory);
87 
88  static void getDefParFilename(const char* prognm,BufferString&);
90  { getDefParFilename(jobspec_.prognm_,parfnm_); }
91 
92  static void getJobNames(BufferStringSet&);
93  static BufferString getJobName(const char*);
94  void setJobName(const char*);
95  BufferString jobName() const { return getJobName(parfnm_.buf()); }
96 
97  static void setUserWantsResume(IOPar&,bool);
98  static bool userWantsResume(const IOPar&);
99 
102 
103 protected:
104 
105  virtual bool init() { return true; }
106  virtual bool launch() = 0;
107 
108  mutable uiString errmsg_;
109 
110  bool writeParFile() const;
111 
112 };
113 
114 
119 public:
120 
122  virtual ~SingleJobDispatcher() {}
123 
124  virtual uiString description() const;
125  virtual bool isSuitedFor(const char*) const { return true; }
126 
128  "Single Process",tr("Single Process"));
129 
132 
133 protected:
134 
135  virtual bool init();
136  virtual bool launch();
137 
138 };
139 
140 
141 } // namespace Batch
142 
143 
144 #endif
#define mExpClass(module)
Definition: commondefs.h:160
Represents a grid of 2D lines in an Inl-Crl plane.
Definition: grid2d.h:27
BufferString parfnm_
Definition: batchjobdispatch.h:101
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
Specifies how to execute a command.
Definition: oscommand.h:34
BufferString clargs_
Definition: batchjobdispatch.h:42
virtual bool canResume(const JobSpec &) const
Definition: batchjobdispatch.h:81
virtual bool init()
Definition: batchjobdispatch.h:105
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
kicks off OD batch jobs in a single process.
Definition: batchjobdispatch.h:117
bool init()
Base class (with factory) for methods to kick-off an OD batch job.
Definition: batchjobdispatch.h:70
Definition: synthseis.h:36
#define mDefaultFactoryInstantiation(baseclss, clss, keywrd, usernm)
Definition: factory.h:289
Definition: uistring.h:89
Set of BufferString objects.
Definition: bufstringset.h:28
OS::CommandExecPars execpars_
just a hint for some dispatchers
Definition: batchjobdispatch.h:44
the data we need to specify an OD batch job.
Definition: batchjobdispatch.h:26
uiString errmsg_
Definition: batchjobdispatch.h:108
BufferString prognm_
Definition: batchjobdispatch.h:41
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
JobSpec jobspec_
Definition: batchjobdispatch.h:100
void setToDefParFileName()
Definition: batchjobdispatch.h:89
BufferString remotehost_
Definition: batchjobdispatch.h:130
JobDispatcher()
Definition: batchjobdispatch.h:74
virtual ~SingleJobDispatcher()
Definition: batchjobdispatch.h:122
uiString errMsg() const
Definition: batchjobdispatch.h:84
#define mDefineFactoryInClass(T, funcname)
Definition: factory.h:426
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
BufferString jobName() const
Definition: batchjobdispatch.h:95
Definition: batchjobdispatch.h:21
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
IOPar pars_
Definition: batchjobdispatch.h:43
BufferString errmsg_
Definition: horizontracker.h:119
Definition: seistype.h:33
Keys that should be used with od_process_segyio.cc.
Definition: segybatchio.h:22
virtual bool isSuitedFor(const char *) const
Definition: batchjobdispatch.h:125
ProcType
Definition: batchjobdispatch.h:30
JobSpec(const char *pnm=0)
Definition: batchjobdispatch.h:34
BufferString remoteexec_
Definition: batchjobdispatch.h:131
Semblance Attribute.
Definition: attribdataholder.h:25
virtual ~JobDispatcher()
Definition: batchjobdispatch.h:76

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019