 |
OpendTect
6.6
|
Go to the documentation of this file.
69 enum Status { Start, ParseFail, ParseOK, CommFail, CommOK, LogFail, LogOK,
70 WorkWait, WorkStarted, WorkFail, WorkPaused, MoreToDo, WorkOK,
95 mExp(
Batch)
bool infoMsg(
const char*,
bool cc_stdout=
false);
123 mExp(
Batch)
float getPriority()
const {
return priority_; }
130 float priority_ = 0.f;
131 bool strmismine_ =
true;
179 #define mDefLoadModules() \
180 void BatchProgram::loadModules() {
182 #define mLoad1Module(mod1nm) \
184 OD::ModDeps().ensureLoaded( mod1nm ); }
185 #define mLoad2Modules(mod1nm,mod2nm) \
187 OD::ModDeps().ensureLoaded( mod1nm ); \
188 OD::ModDeps().ensureLoaded( mod2nm ); }
189 #define mLoad3Modules(mod1nm,mod2nm,mod3nm) \
191 OD::ModDeps().ensureLoaded( mod1nm ); \
192 OD::ModDeps().ensureLoaded( mod2nm ); \
193 OD::ModDeps().ensureLoaded( mod3nm ); }
195 #define mRetError(s) \
196 { errorMsg(::toUiString(s)); mDestroyWorkers; return false; }
198 #define mRetJobErr(s) \
201 comm_->setState( JobCommunic::JobError ); \
205 #define mRetHostErr(s) \
207 if ( comm_ ) comm_->setState( JobCommunic::HostError ); \
211 #define mStrmWithProcID(s) \
212 strm << "\n[" << process_id << "]: " << s << "." << od_newline
214 #define mMessage(s) \
215 strm << s << '.' << od_newline
217 #define mSetCommState(State) \
220 comm_->setState( JobCommunic::State ); \
221 if ( !comm_->updateState() ) \
222 mRetHostErr( comm_->errMsg() ) \
229 #define mMainIsDefined
230 int doMain(
int argc,
char** argv )
239 return ApplicationData::exec();
242 int main(
int argc,
char** argv )
void doWorkCB(CallBacker *)
Definition: _execbatch.h:117
::QTimerComm * comm_
Definition: timer.h:45
Notifier< BatchProgram > eventLoopStarted
Definition: batchprog.h:102
friend BatchProgram & BP()
Status
Definition: batchprog.h:69
mExp(Batch) void startTimer()
Batch::ID jobId()
Definition: batchprog.h:122
mExp(Batch) static void deleteInstance(int retcode)
CallBacker object with a name. Use if you want your object to be able to send and receive CallBack's,...
Definition: namedobj.h:72
mExp(Batch) void endWorkCB(CallBacker *)
Multi-machine socket communicator Handles the communication between a client and the primary host,...
Definition: jobcommunic.h:50
#define mGlobal(module)
Definition: commondefs.h:180
mExp(Batch) bool infoMsg(const char *
void doWorkCB(CallBacker *)
Notifier< BatchProgram > startDoWork
Definition: batchprog.h:103
#define mSCB(fn)
Definition: callback.h:45
static const char * sKeySimpleBatch()
Definition: batchprog.h:99
mExp(Batch) bool doWork(od_ostream &)
Service manager for all OpendTect batch programs. Allows informing od_main on the program of the batc...
Definition: batchserviceservermgr.h:26
Notifier< BatchProgram > pause
Definition: batchprog.h:104
mExp(Batch) void postWork(bool res)
void Execute_batch(int *pargc, char **argv)
Definition: _execbatch.h:96
void workMonitorCB(CallBacker *)
mExp(Batch) bool isOK() const
Main object for 'standard' batch programs.
Definition: batchprog.h:64
static const char * sKeySurveyDir()
Definition: batchprog.h:98
mExp(Batch) bool pauseRequested()
Threads::Lock batchprogthreadlock_
Definition: batchprog.h:134
bool canStartdoWork() const
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:185
void launchDoWorkCB(CallBacker *cb)
Definition: _execbatch.h:126
void loadModulesCB(CallBacker *)
Definition: _execbatch.h:110
Definition: commandlineparser.h:53
IOPar & pars()
Definition: batchprog.h:88
JobCommunic * mmComm()
Definition: batchprog.h:121
Timer class.
Definition: timer.h:25
int main(int argc, char **argv)
Definition: testprog.h:49
ObjectSet< OD::JSON::Object > requests_
Definition: batchprog.h:136
@ WorkWait
Definition: batchprog.h:70
Notifier< BatchProgram > resume
Definition: batchprog.h:105
@ BatchProgCtxt
Definition: odruncontext.h:27
mExp(Batch) void modulesLoaded()
#define mClass(module)
Definition: commondefs.h:181
mExp(Batch) void loadModules()
const IOPar & pars() const
Definition: batchprog.h:87
Batch::ID jobid_
Definition: batchprog.h:129
static const char * sKeyFinishMsg()
Definition: batchprog.h:100
static BatchProgram * inst_
Definition: batchprog.h:159
const CommandLineParser & clParser()
Definition: batchprog.h:86
mExp(Batch) void setResumed()
mExp(Batch) void initWork()
mExp(Batch) float getPriority() const
Definition: batchprog.h:123
mDeclareEnumUtils(Status)
String that is able to hold international (UTF-8) strings for the user interface.
Definition: uistring.h:121
Is the base class for all threads. Start it by creating it and give it the function or CallBack to ex...
Definition: thread.h:282
mODTextTranslationClass(BatchProgram)
static const char * sKeyDataDir()
Definition: batchprog.h:97
Threads::Lock statelock_
Definition: batchprog.h:126
void SetRunContext(RunCtxt)
Definition: batchjobdispatch.h:22
void eventLoopStartedCB(CallBacker *)
int ID
Definition: batchjobdispatch.h:24
Timer * timer_
Definition: batchprog.h:132
Notifier< BatchProgram > endWork
Definition: batchprog.h:107
Notifier< BatchProgram > killed
Definition: batchprog.h:106
void SetProgramArgs(int argc, char **argv, bool require_valid_dataroot=true)
void progKilled(CallBacker *)
OD class for stream write common access to the user log file, or std::cout in other than od_main.
Definition: od_ostream.h:26
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class.
Definition: threadlock.h:53
void notify(const CallBack &, bool first=false) const
mExp(Batch) bool canReceiveRequests() const
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
mExp(Batch) bool errorMsg(const uiString &
Generated at
for the OpendTect
seismic interpretation project.
Copyright (C): dGB Beheer B.V. 1995-2021