OpendTect-6_4  6.4
Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
JobRunner Class Reference

Runs all jobs defined by JobDescProv. More...

Inheritance diagram for JobRunner:
[legend]

Public Member Functions

 JobRunner (JobDescProv *, const char *cmd)
 JobDescProv becomes mine. Never pass null. More...
 
 ~JobRunner ()
 
const JobDescProvdescProv () const
 
const ObjectSet< HostNFailInfo > & hostInfo () const
 
bool addHost (const HostData &)
 
void removeHost (int)
 
void pauseHost (int, bool)
 
bool stopAll ()
 
bool hostFailed (int) const
 
bool isPaused (int) const
 
bool isAssigned (const JobInfo &ji) const
 
int nrJobs (bool failed=false) const
 
const JobInfojobInfo (int idx, bool failed=false) const
 
int jobsDone () const
 
int jobsInProgress () const
 
int jobsLeft () const
 
int totalJobs () const
 
JobInfocurrentJob (const HostNFailInfo *) const
 
int nextStep ()
 
od_int64 nrDone () const
 
od_int64 totalNr () const
 
uiString uiMessage () const
 will be message() again in 7.x More...
 
uiString nrDoneMessage () const
 
void setFirstPort (int n)
 
void setRshComm (const char *s)
 
void setProg (const char *s)
 
void setNiceNess (int n)
 
void showMachStatus (BufferStringSet &) const
 
const FilePathgetBaseFilePath (JobInfo &, const HostData &)
 
const JobInfocurJobInfo () const
 
IOParcurJobIOPar ()
 
const FilePathcurJobFilePath ()
 
int getLastReceivedTime (JobInfo &)
 
const char * procDir () const
 
uiString errorMsg () const
 
- Public Member Functions inherited from Executor
 Executor (const char *nm)
 
virtual ~Executor ()
 
virtual int doStep ()
 
bool go (od_ostream *s=0, bool isfirst=true, bool islast=true, int delaybtwnstepsinms=0)
 
bool go (od_ostream &s, bool isfirst=true, bool islast=true, int delaybtwnstepsinms=0)
 
virtual bool execute ()
 
- Public Member Functions inherited from SequentialTask
 SequentialTask (const char *nm=0)
 
virtual ~SequentialTask ()
 
void setProgressMeter (ProgressMeter *)
 Must be called before execute() More...
 
ProgressMeterprogressMeter ()
 
const ProgressMeterprogressMeter () const
 
bool execute ()
 
- Public Member Functions inherited from Task
virtual ~Task ()
 
virtual uiString uiNrDoneText () const
 will be nrDoneText() in 7.x More...
 
virtual void enableWorkControl (bool=true)
 Must be called before execute() More...
 
bool workControlEnabled () const
 
virtual void controlWork (Control)
 
virtual Control getState () const
 
- Public Member Functions inherited from NamedObject
 NamedObject (const char *nm=0)
 
 NamedObject (const NamedObject *linkedto)
 
 NamedObject (const NamedObject &)
 
virtual ~NamedObject ()
 
void setLinkedTo (NamedObject *)
 
bool operator== (const NamedObject &oth) const
 
virtual const OD::Stringname () const
 
virtual const OD::StringannotName () const
 
virtual void setName (const char *)
 
void setCleanName (const char *)
 cleans string first More...
 
void deleteNotify (const CallBack &)
 
- Public Member Functions inherited from CallBacker
 CallBacker ()
 
 CallBacker (const CallBacker &)
 
virtual ~CallBacker ()
 
bool attachCB (NotifierAccess &, const CallBack &, bool onlyifnew=false)
 
bool attachCB (NotifierAccess *notif, const CallBack &cb, bool onlyifnew=false)
 
void detachCB (NotifierAccess &, const CallBack &)
 
void detachCB (NotifierAccess *notif, const CallBack &cb)
 
bool isNotifierAttached (NotifierAccess *) const
 Only for debugging purposes, don't use. More...
 

Public Attributes

Notifier< JobRunnerpreJobStart
 
Notifier< JobRunnerpostJobStart
 
Notifier< JobRunnerjobFailed
 
Notifier< JobRunnermsgAvail
 
- Public Attributes inherited from Executor
Notifier< Executorprestep
 
Notifier< Executorpoststep
 Only when MoreToDo will be returned. More...
 

Protected Types

enum  StartRes { Started, NotStarted, JobBad, HostBad }
 
enum  AssignStat { NotReady, BadHost, JobStarted, NoJobs }
 
enum  HostStat { OK = 0, SomeFailed = 1, HostFailed = 2 }
 

Protected Member Functions

JobIOMgriomgr ()
 
int doCycle ()
 
HostNFailInfohostNFailInfoFor (const HostData *) const
 
void updateJobInfo ()
 
void handleStatusInfo (StatusInfo &)
 
JobInfogtJob (int descnr)
 
void failedJob (JobInfo &, JobInfo::State)
 
StartRes startJob (JobInfo &ji, HostNFailInfo &jhi)
 
bool runJob (JobInfo &, const HostData &)
 
AssignStat assignJob (HostNFailInfo &)
 
bool haveIncomplete () const
 
HostStat hostStatus (const HostNFailInfo *) const
 
void handleExitStatus (JobInfo &)
 
- Protected Member Functions inherited from Executor
virtual bool goImpl (od_ostream *, bool, bool, int)
 
- Protected Member Functions inherited from Task
 Task (const char *nm=0)
 
virtual bool shouldContinue ()
 
- Protected Member Functions inherited from CallBacker
void detachAllNotifiers ()
 Call from the destructor of your inherited object. More...
 

Protected Attributes

JobDescProvdescprov_
 
ObjectSet< JobInfojobinfos_
 
ObjectSet< HostNFailInfohostinfo_
 
ObjectSet< JobInfofailedjobs_
 
BufferString prog_
 
BufferString procdir_
 
FilePathcurjobfp_
 
IOParcurjobiop_
 
JobInfocurjobinfo_
 
JobIOMgriomgr_
 
int niceval_
 
int firstport_
 
BufferString rshcomm_
 
int maxhostfailures_
 host failrs B4 host bad More...
 
int maxjobfailures_
 job related job failrs More...
 
int maxjobhstfails_
 host related job failrs More...
 
int starttimeout_
 
int failtimeout_
 
int wrapuptimeout_
 
int hosttimeout_
 
int startwaittime_
 wait B4 next client start More...
 
uiString errmsg_
 
- Protected Attributes inherited from SequentialTask
ProgressMeterprogressmeter_
 
int lastupdate_
 
- Protected Attributes inherited from Task
Control control_
 
Threads::ConditionVarworkcontrolcondvar_
 
- Protected Attributes inherited from NamedObject
BufferStringname_
 
NamedObjectlinkedto_
 
CallBackSetdelnotify_
 

Private Member Functions

 mODTextTranslationClass (JobRunner)
 

Additional Inherited Members

- Public Types inherited from Task
enum  Control { Run, Pause, Stop }
 
- Static Public Member Functions inherited from SequentialTask
static int ErrorOccurred ()
 
static int Finished ()
 
static int MoreToDo ()
 
static int WarningAvailable ()
 
- Static Public Member Functions inherited from Task
static uiString stdNrDoneText ()
 
static uiString uiStdNrDoneText ()
 

Detailed Description

Runs all jobs defined by JobDescProv.

Member Enumeration Documentation

enum JobRunner::AssignStat
protected
Enumerator
NotReady 
BadHost 
JobStarted 
NoJobs 
enum JobRunner::HostStat
protected
Enumerator
OK 
SomeFailed 
HostFailed 
enum JobRunner::StartRes
protected
Enumerator
Started 
NotStarted 
JobBad 
HostBad 

Constructor & Destructor Documentation

JobRunner::JobRunner ( JobDescProv ,
const char *  cmd 
)

JobDescProv becomes mine. Never pass null.

JobRunner::~JobRunner ( )

Member Function Documentation

bool JobRunner::addHost ( const HostData )
AssignStat JobRunner::assignJob ( HostNFailInfo )
protected
const FilePath& JobRunner::curJobFilePath ( )
inline
const JobInfo& JobRunner::curJobInfo ( ) const
inline
IOPar& JobRunner::curJobIOPar ( )
inline
JobInfo* JobRunner::currentJob ( const HostNFailInfo ) const
const JobDescProv* JobRunner::descProv ( ) const
inline
int JobRunner::doCycle ( )
protected
uiString JobRunner::errorMsg ( ) const
void JobRunner::failedJob ( JobInfo ,
JobInfo::State   
)
protected
const FilePath& JobRunner::getBaseFilePath ( JobInfo ,
const HostData  
)
int JobRunner::getLastReceivedTime ( JobInfo )
JobInfo* JobRunner::gtJob ( int  descnr)
protected
void JobRunner::handleExitStatus ( JobInfo )
protected
void JobRunner::handleStatusInfo ( StatusInfo )
protected
bool JobRunner::haveIncomplete ( ) const
protected
bool JobRunner::hostFailed ( int  ) const
const ObjectSet<HostNFailInfo>& JobRunner::hostInfo ( ) const
inline
HostNFailInfo* JobRunner::hostNFailInfoFor ( const HostData ) const
protected
HostStat JobRunner::hostStatus ( const HostNFailInfo ) const
protected
JobIOMgr& JobRunner::iomgr ( )
protected
bool JobRunner::isAssigned ( const JobInfo ji) const
bool JobRunner::isPaused ( int  ) const
const JobInfo& JobRunner::jobInfo ( int  idx,
bool  failed = false 
) const
inline
int JobRunner::jobsDone ( ) const
int JobRunner::jobsInProgress ( ) const
int JobRunner::jobsLeft ( ) const
inline
JobRunner::mODTextTranslationClass ( JobRunner  )
private
int JobRunner::nextStep ( )
inlinevirtual
Return values
MoreToDo()Not finished. Call me again.
Finished()Nothing more to do.
ErrorOccurred()Something went wrong.
Note
if function returns a value greater than cMoreToDo(), it should be interpreted as cMoreToDo().

Implements SequentialTask.

od_int64 JobRunner::nrDone ( ) const
inlinevirtual
Note
nrDone is only used for displaying progress and will be compared to totalNr to show user how large part of the task that is finished.

Reimplemented from Task.

uiString JobRunner::nrDoneMessage ( ) const
int JobRunner::nrJobs ( bool  failed = false) const
inline
void JobRunner::pauseHost ( int  ,
bool   
)
const char* JobRunner::procDir ( ) const
inline
void JobRunner::removeHost ( int  )
bool JobRunner::runJob ( JobInfo ,
const HostData  
)
protected
void JobRunner::setFirstPort ( int  n)
inline
void JobRunner::setNiceNess ( int  n)
void JobRunner::setProg ( const char *  s)
inline
void JobRunner::setRshComm ( const char *  s)
inline
void JobRunner::showMachStatus ( BufferStringSet ) const
StartRes JobRunner::startJob ( JobInfo ji,
HostNFailInfo jhi 
)
protected
bool JobRunner::stopAll ( )
int JobRunner::totalJobs ( ) const
inline
od_int64 JobRunner::totalNr ( ) const
inlinevirtual

Reimplemented from Task.

uiString JobRunner::uiMessage ( ) const
virtual

will be message() again in 7.x

Note
totalNr is only used for displaying progress.

Reimplemented from Task.

void JobRunner::updateJobInfo ( )
protected

Member Data Documentation

FilePath& JobRunner::curjobfp_
protected
JobInfo* JobRunner::curjobinfo_
protected
IOPar& JobRunner::curjobiop_
protected
JobDescProv* JobRunner::descprov_
protected
uiString JobRunner::errmsg_
protected
ObjectSet<JobInfo> JobRunner::failedjobs_
protected
int JobRunner::failtimeout_
protected
int JobRunner::firstport_
protected
ObjectSet<HostNFailInfo> JobRunner::hostinfo_
protected
int JobRunner::hosttimeout_
protected
JobIOMgr* JobRunner::iomgr_
protected
Notifier<JobRunner> JobRunner::jobFailed
ObjectSet<JobInfo> JobRunner::jobinfos_
protected
int JobRunner::maxhostfailures_
protected

host failrs B4 host bad

int JobRunner::maxjobfailures_
protected

job related job failrs

int JobRunner::maxjobhstfails_
protected

host related job failrs

Notifier<JobRunner> JobRunner::msgAvail
int JobRunner::niceval_
protected
Notifier<JobRunner> JobRunner::postJobStart
Notifier<JobRunner> JobRunner::preJobStart
BufferString JobRunner::procdir_
protected
BufferString JobRunner::prog_
protected
BufferString JobRunner::rshcomm_
protected
int JobRunner::starttimeout_
protected
int JobRunner::startwaittime_
protected

wait B4 next client start

int JobRunner::wrapuptimeout_
protected

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