OpendTect-6_4  6.4
jobiomgr.h
Go to the documentation of this file.
1 #ifndef jobiomgr_h
2 #define jobiomgr_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H.Lammertink
9  Date: Oct 2004
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "mmprocmod.h"
16 #include "callback.h"
17 #include "bufstring.h"
18 
19 class CommandString;
20 class FilePath;
21 class HostData;
22 class JobInfo;
23 class JobIOHandler;
24 template <class T> class ObjQueue;
25 namespace OS { class MachineCommand; }
26 
39 {
40 public:
41  StatusInfo( char tg, int desc, int stat, int pid,
42  const char* mg, const char* hostname,
43  int time )
44  : tag(tg), descnr(desc), status(stat), msg(mg)
45  , hostnm(hostname), timestamp(time), procid(pid) {}
46 
47  char tag;
48  int descnr;
49  int status;
50  int timestamp;
51  int procid;
54 };
55 
56 
63 {
64 public:
65  enum Mode { Work, Pause, Stop };
66 
67  JobIOMgr(int firstport=19345,int niceval=19);
68  virtual ~JobIOMgr();
69 
70  const char* peekMsg() { if ( msg_.size() ) return msg_; return 0; }
71  void fetchMsg( BufferString& bs ) { bs = msg_; msg_ = "";}
72 
73  bool startProg(const char*,IOPar&,const FilePath&,
74  const JobInfo&,const char*);
75 
76  void setNiceNess( int n ) { niceval_ = n; }
77  void reqModeForJob(const JobInfo&,Mode);
78  void removeJob(const char*,int);
79  bool isReady() const;
80 
81  ObjQueue<StatusInfo>& statusQueue();
82 
83  static bool mkIOParFile(const FilePath& basefnm,
84  const HostData&,const IOPar&,
85  FilePath&,BufferString& msg);
86  static BufferString mkRexecCmd(const char* prognm,
87  const HostData& machine,
88  const HostData& localhost);
97 protected:
98 
99  JobIOHandler& iohdlr_;
101  int niceval_;
102 
103  bool mkIOParFile(FilePath&,const FilePath& basefnm,
104  const HostData&,const IOPar&);
105  void mkCommand(CommandString&,const HostData&,
106  const char* progname,const FilePath& basefp,
107  const FilePath& iopfp,const JobInfo&,
108  const char* rshcomm);
109  void mkCommand(OS::MachineCommand&,const HostData&,
110  const char* progname,const FilePath& basefp,
111  const FilePath& iopfp,const JobInfo&,
112  const char* rshcomm);
113 
114 };
115 
116 
117 mGlobal(MMProc) const OD::String& getTempBaseNm();
118 mGlobal(MMProc) int mkTmpFileNr();
120 
121 
123 {
124 public:
125  CommandString(const HostData& targetmachine,
126  const char* init=0);
127 
128  CommandString& operator=(const char*);
129 
130  void addFlag(const char* flag,const char* value);
131  void addFlag(const char* flag,int value);
132  void addFilePath(const FilePath&);
133 
134  const OD::String& string() { return cmd_; }
135 
136 private:
137 
138  void add(const char*);
139 
142 
143 };
144 
145 #endif
#define mExpClass(module)
Definition: commondefs.h:160
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
BufferString cmd_
Definition: jobiomgr.h:140
#define mGlobal(module)
Definition: commondefs.h:163
Encapsulates status message from a running client.
Definition: jobiomgr.h:38
Definition: oscommand.h:24
int & MMJob_getTempFileNr()
bool init()
Encapsulates an actual command to execute + the machine to run it on.
Definition: oscommand.h:80
int status
Definition: jobiomgr.h:49
Definition: jobiomgr.h:122
int mkTmpFileNr()
Handles starting & stopping of jobs on client machines. Sets up a separate thread to maintain contact...
Definition: jobiomgr.h:62
Queue of objects.
Definition: queue.h:39
const OD::String & string()
Definition: jobiomgr.h:134
const OD::String & getTempBaseNm()
int niceval_
Definition: jobiomgr.h:101
JobIOHandler & iohdlr_
Definition: jobiomgr.h:99
BufferString msg_
Definition: jobiomgr.h:100
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
void fetchMsg(BufferString &bs)
Definition: jobiomgr.h:71
void setNiceNess(int n)
Definition: jobiomgr.h:76
encapsulates the read-access-only part of strings in OD.
Definition: odstring.h:31
int descnr
Definition: jobiomgr.h:48
char tag
Definition: jobiomgr.h:47
Mode
Definition: jobiomgr.h:65
Multi Machine Processing.
Definition: mmassetmgr.h:23
Definition: jobiomgr.h:65
const char * peekMsg()
Definition: jobiomgr.h:70
BufferString msg
Definition: jobiomgr.h:53
BufferString hostnm
Definition: jobiomgr.h:52
File pathname tools.
Definition: filepath.h:34
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
int timestamp
Definition: jobiomgr.h:50
int procid
Definition: jobiomgr.h:51
OpendTect.
Definition: commontypes.h:29
StatusInfo(char tg, int desc, int stat, int pid, const char *mg, const char *hostname, int time)
Definition: jobiomgr.h:41
const HostData & hstdata_
Definition: jobiomgr.h:141
Host name and aliases.
Definition: hostdata.h:36
#define mClass(module)
Definition: commondefs.h:164
All information on a job.
Definition: jobinfo.h:24

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