OpendTect  6.6
batchjobdispatch.h
Go to the documentation of this file.
1 #pragma once
2 /*+
3 ________________________________________________________________________
4 
5  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
6  Author: Bert
7  Date: Dec 2013
8  RCS: $Id$
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "enums.h"
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 
24 typedef int ID;
25 
30 public:
31 
32  enum ProcType { NonODBase, Attrib, AttribEM, Grid2D,
33  PreStack, SEGY, T2D, TwoDto3D, VelConv, Vol };
34 
36  JobSpec(const char* pnm=nullptr,
39 
40  static const char* progNameFor(ProcType);
41  static ProcType procTypeFor(const char*);
42 
48 
49  void usePar(const IOPar&);
50  void fillPar(IOPar&) const;
51 
52 };
53 
54 
78 public:
79 
80  static ID getInvalid() { return 0; }
81 
83 
84  virtual ~JobDispatcher() {}
85 
86  virtual uiString description() const = 0;
87  virtual bool isSuitedFor(const char* prognm) const = 0;
88  virtual bool canHandle(const JobSpec&) const;
89  virtual bool canResume(const JobSpec&) const { return false; }
90 
91  bool go(const JobSpec&,ID* =nullptr);
92  uiString errMsg() const { return errmsg_; }
93 
95 
96  static void getDefParFilename(const char* prognm,BufferString&);
98  { getDefParFilename(jobspec_.prognm_,parfnm_); }
99 
101  static BufferString getJobName(const char*);
102  void setJobName(const char*);
103  BufferString jobName() const { return getJobName(parfnm_.buf()); }
104 
105  static void setUserWantsResume(IOPar&,bool);
106  static bool userWantsResume(const IOPar&);
107 
110 
112 
113 protected:
114 
115  virtual bool init() { return true; }
116  virtual bool launch(ID*) = 0;
117  /*<! A provided ID will get a unique session number,
118  to identify the spawn command. Add it to the
119  command line using addIDTo function */
120 
121  mutable uiString errmsg_;
122 
123  bool writeParFile() const;
124 
125 };
126 
127 
128 } // namespace Batch
Batch::JobDispatcher::getInvalid
static ID getInvalid()
Definition: batchjobdispatch.h:80
OS::LaunchType
LaunchType
Definition: oscommand.h:26
Seis::Vol
@ Vol
Definition: seistype.h:32
factory.h
uistring.h
Batch::JobDispatcher::mDefineFactoryInClass
mDefineFactoryInClass(JobDispatcher, factory)
Batch::JobDispatcher::jobName
BufferString jobName() const
Definition: batchjobdispatch.h:103
Batch::JobDispatcher::canHandle
virtual bool canHandle(const JobSpec &) const
BufferStringSet
Set of BufferString objects.
Definition: bufstringset.h:26
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
Batch::JobSpec::progNameFor
static const char * progNameFor(ProcType)
Batch::JobDispatcher::isSuitedFor
virtual bool isSuitedFor(const char *prognm) const =0
Batch::JobSpec::pars_
IOPar pars_
Definition: batchjobdispatch.h:45
Batch::JobSpec::servernm_
BufferString servernm_
Definition: batchjobdispatch.h:46
Batch::JobSpec::ProcType
ProcType
Definition: batchjobdispatch.h:32
Batch::JobDispatcher::errMsg
uiString errMsg() const
Definition: batchjobdispatch.h:92
Batch::JobSpec::fillPar
void fillPar(IOPar &) const
OS::CommandExecPars
Specifies how to execute a command.
Definition: oscommand.h:36
Batch::JobDispatcher::userWantsResume
static bool userWantsResume(const IOPar &)
Batch::JobDispatcher::go
bool go(const JobSpec &, ID *=nullptr)
Batch::JobSpec::clargs_
BufferStringSet clargs_
Definition: batchjobdispatch.h:44
Batch::JobDispatcher::description
virtual uiString description() const =0
Batch::JobDispatcher::init
virtual bool init()
Definition: batchjobdispatch.h:115
Batch::JobDispatcher::getJobName
static BufferString getJobName(const char *)
Batch::JobDispatcher::addIDTo
static void addIDTo(ID, OS::MachineCommand &)
Batch::JobSpec::JobSpec
JobSpec(const char *pnm=nullptr, OS::LaunchType lt=OS::Batch)
Batch::JobDispatcher::setToDefParFileName
void setToDefParFileName()
Definition: batchjobdispatch.h:97
Batch::JobSpec::mODTextTranslationClass
mODTextTranslationClass(JobSpec)
Batch::JobSpec
the data we need to specify an OD batch job.
Definition: batchjobdispatch.h:29
Batch::JobDispatcher::mODTextTranslationClass
mODTextTranslationClass(JobDispatcher)
Batch::JobDispatcher::setUserWantsResume
static void setUserWantsResume(IOPar &, bool)
Batch::JobDispatcher::setJobName
void setJobName(const char *)
Batch::JobDispatcher
Base class (with factory) for methods to kick-off an OD batch job.
Definition: batchjobdispatch.h:77
OS::Batch
@ Batch
Definition: oscommand.h:26
Batch::JobDispatcher::jobspec_
JobSpec jobspec_
Definition: batchjobdispatch.h:108
PreStack
Definition: synthseis.h:35
Batch::JobDispatcher::errmsg_
uiString errmsg_
Definition: batchjobdispatch.h:121
BufferString
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
Batch::JobDispatcher::JobDispatcher
JobDispatcher()
Definition: batchjobdispatch.h:82
Batch::JobSpec::procTypeFor
static ProcType procTypeFor(const char *)
Batch::JobSpec::usePar
void usePar(const IOPar &)
Batch::JobDispatcher::~JobDispatcher
virtual ~JobDispatcher()
Definition: batchjobdispatch.h:84
uiString
String that is able to hold international (UTF-8) strings for the user interface.
Definition: uistring.h:121
Batch::JobDispatcher::getJobNames
static void getJobNames(BufferStringSet &)
enums.h
MPE::errmsg_
BufferString errmsg_
Definition: horizontracker.h:118
Batch::JobSpec::execpars_
OS::CommandExecPars execpars_
just a hint for some dispatchers
Definition: batchjobdispatch.h:47
Grid2D
Represents a grid of 2D lines in an Inl-Crl plane.
Definition: grid2d.h:27
OS::MachineCommand
Encapsulates an actual command to execute + the machine to run it on.
Definition: oscommand.h:94
SEGY
Keys that should be used with od_process_segyio.cc.
Definition: segybatchio.h:22
Batch::JobDispatcher::parfnm_
BufferString parfnm_
Definition: batchjobdispatch.h:109
Batch
Definition: batchjobdispatch.h:22
Batch::JobSpec::JobSpec
JobSpec(ProcType, OS::LaunchType lt=OS::Batch)
Batch::ID
int ID
Definition: batchjobdispatch.h:24
iopar.h
Batch::JobDispatcher::writeParFile
bool writeParFile() const
Batch::JobSpec::prognm_
BufferString prognm_
Definition: batchjobdispatch.h:43
Attrib
Semblance Attribute.
Definition: attribdataholder.h:25
Batch::JobDispatcher::canResume
virtual bool canResume(const JobSpec &) const
Definition: batchjobdispatch.h:89
Batch::JobDispatcher::getDefParFilename
static void getDefParFilename(const char *prognm, BufferString &)
oscommand.h
IOPar
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
Batch::JobDispatcher::launch
virtual bool launch(ID *)=0
Batch::JobSpec::JobSpec
JobSpec(const IOPar &, OS::LaunchType lt=OS::Batch)

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