![]() |
KSquare Utilities
|
Responsable for keeping track of a list of jobs. More...
#include <KKJobManager.h>
Inheritance diagram for KKJobManagment::KKJobManager:Public Types | |
| typedef KKJobManager * | JobManagerPtr |
Public Types inherited from KKJobManagment::KKJob | |
| typedef map< KKStr, ConstructorPtr > | ConstructorIndex |
| typedef KKJobPtr(* | ConstructorPtr) (JobManagerPtr _manager) |
| enum | JobStatus { jsNULL, jsOpen, jsStarted, jsDone, jsExpanded } |
| enum | JobTypes { jtNULL, jtBinaryCombo, jtMultiClass, jtRandomSplit } |
| typedef KKJob * | KKJobPtr |
Public Member Functions | |
| KKJobManager (const KKJobManager &j) | |
| KKJobManager (JobManagerPtr _manager, kkint32 _jobId, kkint32 _parentId, kkint32 _numPorcessesAllowed, const KKStr &_managerName, kkint32 _numJobsAtATime, RunLog &_log) | |
| ~KKJobManager () | |
| kkint32 | AllocateNextJobId () |
| bool | AreAllJobsDone () |
| void | Block () |
| double | CpuTimeTotalUsed () const |
| virtual KKJobPtr | Duplicate () const =0 |
| void | EndBlock () |
| kkint32 | ExpansionCount () const |
| kkint32 | GetNextJobId () |
| void | InitilizeJobManager (bool &successful) |
| Initialize the KKJobManager object. More... | |
| KKJobListPtr | Jobs () const |
| virtual const char * | JobType () const |
| const KKStr & | ManagerName () const |
| kkint32 | NextJobId () const |
| bool | QuitRunning () const |
| void | Restart () |
| void | Run () |
| void | SetQuitRunningFlag () |
| bool | SupportCompletedJobData () const |
| void | SupportCompletedJobData (bool _supportCompletedJobData) |
| void | Update (JobManagerPtr p) |
Public Member Functions inherited from KKJobManagment::KKJob | |
| KKJob (const KKJob &j) | |
| KKJob (JobManagerPtr _manager, kkint32 _jobId, kkint32 _parentId, kkint32 _numPorcessesAllowed, RunLog &_log) | |
| KKJob (JobManagerPtr _manager) | |
| ~KKJob () | |
| void | AddPrerequisites (kkint32 _prerequisite) |
| void | AddPrerequisites (VectorInt _prerequisites) |
| virtual void | CompletedJobDataRead (istream &i) |
| Works with 'WriteCompletedJobData'; You use this to load in data written by 'WriteCompletedJobData'. More... | |
| virtual void | CompletedJobDataWrite (ostream &o) |
| Write out completed job results to status file. More... | |
| bool | InPrerequisites (kkint32 _jobId) |
| kkint32 | JobId () const |
| void | JobId (kkint32 _jobId) |
| RunLog & | Log () |
| JobManagerPtr | Manager () const |
| kkint32 | ParentId () const |
| const VectorInt & | Prerequisites () const |
| virtual void | ProcessNode () |
| virtual void | ProcessStatusField (const KKStr &fieldName, const KKStr &fieldValue) |
| Imjpelmentation specific field processing. More... | |
| virtual void | ReFresh (KKJob &j) |
| JobStatus | Status () const |
| void | Status (JobStatus _status) |
| KKStr | StatusStr () const |
Protected Member Functions | |
| virtual void | StatusFileProcessLine (const KKStr &ln, istream &statusFile) |
| virtual void | StatusFileProcessLineJobStatusChange (KKStr &statusLineStr) |
| virtual KKStr | ToStatusStr () |
Protected Member Functions inherited from KKJobManagment::KKJob | |
| void | PrerequisitesFromStr (const KKStr &s) |
| KKStr | PrerequisitesToStr () const |
| void | ProcessStatusStr (const KKStr &statusStr) |
Additional Inherited Members | |
Static Public Member Functions inherited from KKJobManagment::KKJob | |
| static KKJobPtr | CallAppropriateConstructor (JobManagerPtr _manager, const KKStr &_jobTypeName, const KKStr &_statusStr) |
| static JobStatus | JobStatusFromStr (const KKStr &statusStr) |
| static KKStr | JobStatusToStr (JobStatus status) |
| static void | JobTypeFromStr (const KKStr &s) |
| static KKStr | JobTypeToStr (JobTypes jt) |
| static void | RegisterConstructor (const KKStr &_name, ConstructorPtr _constructor) |
Public Attributes inherited from KKJobManagment::KKJob | |
| RunLog & | log |
Static Public Attributes inherited from KKJobManagment::KKJob | |
| static ConstructorIndex | registeredConstructors |
Protected Attributes inherited from KKJobManagment::KKJob | |
| kkint32 | jobId |
| JobManagerPtr | manager |
| kkint32 | numPorcessesAllowed |
| kkint32 | numProcessors |
| kkint32 | parentId |
| VectorInt | prerequisites |
| JobStatus | status |
Responsable for keeping track of a list of jobs.
See the application called RandomSplitsJobManager. It is the first alplication to use this library; any class that is derived from this class are required to implement these method "StatusFileProcessLine", "StatusFileProcessLineJobStatusChange", "ToStatusStr"
Definition at line 29 of file KKJobManager.h.
Definition at line 32 of file KKJobManager.h.
| KKJobManager::KKJobManager | ( | const KKJobManager & | j | ) |
Definition at line 43 of file KKJobManager.cpp.
References KKJobManagment::KKJob::AddPrerequisites(), KKB::DateTime::DateTime(), KKJobManagment::KKJob::KKJob(), KKJobManagment::KKJobList::KKJobList(), and KKB::KKStr::KKStr().
| KKJobManagment::KKJobManager::KKJobManager | ( | JobManagerPtr | _manager, |
| kkint32 | _jobId, | ||
| kkint32 | _parentId, | ||
| kkint32 | _numPorcessesAllowed, | ||
| const KKStr & | _managerName, | ||
| kkint32 | _numJobsAtATime, | ||
| RunLog & | _log | ||
| ) |
| _manager | Ptr to job that is managing this 'KKJobManager' |
| _managerName | Name of this 'KKJobManager' ; status and lock file will be based on it. |
| _numJobsAtATime | The number of jobs that can be allocatd at one time for a single process to execute. |
| KKJobManager::~KKJobManager | ( | ) |
Definition at line 126 of file KKJobManager.cpp.
| kkint32 KKJobManager::AllocateNextJobId | ( | ) |
Definition at line 709 of file KKJobManager.cpp.
| bool KKJobManager::AreAllJobsDone | ( | ) |
Definition at line 954 of file KKJobManager.cpp.
References KKJobManagment::KKJobList::AreAllJobsDone().
| void KKJobManager::Block | ( | ) |
Definition at line 191 of file KKJobManager.cpp.
References KKB::osSleep().
Referenced by InitilizeJobManager(), Run(), and SetQuitRunningFlag().
|
inline |
Definition at line 65 of file KKJobManager.h.
|
pure virtual |
Create a duplicate instance.
Reimplemented from KKJobManagment::KKJob.
| void KKJobManager::EndBlock | ( | ) |
Definition at line 235 of file KKJobManager.cpp.
Referenced by InitilizeJobManager(), Run(), SetQuitRunningFlag(), and StatusFileProcessLineJobStatusChange().
|
inline |
Definition at line 66 of file KKJobManager.h.
| kkint32 KKJobManager::GetNextJobId | ( | ) |
Definition at line 292 of file KKJobManager.cpp.
| void KKJobManager::InitilizeJobManager | ( | bool & | successful | ) |
Initialize the KKJobManager object.
This is the first Method that needs to be called right after the object is constructed.
Definition at line 134 of file KKJobManager.cpp.
References Block(), KKB::KKStr::Concat(), EndBlock(), KKB::osFileExists(), and KKB::osGetSystemTimeUsed().
|
inline |
Definition at line 67 of file KKJobManager.h.
|
virtual |
Allows us to know which specific implementaion of 'KKJob' an instance really is.
Reimplemented from KKJobManagment::KKJob.
Definition at line 184 of file KKJobManager.cpp.
|
inline |
Definition at line 68 of file KKJobManager.h.
|
inline |
Definition at line 69 of file KKJobManager.h.
|
inline |
Definition at line 70 of file KKJobManager.h.
| void KKJobManagment::KKJobManager::Restart | ( | ) |
| void KKJobManager::Run | ( | ) |
Definition at line 970 of file KKJobManager.cpp.
References KKJobManagment::KKJob::AddPrerequisites(), Block(), KKJobManagment::KKJob::Duplicate(), EndBlock(), KKJobManagment::KKJobList::JobsStillRunning(), KKJobManagment::KKJob::jsDone, KKJobManagment::KKJobList::KKJobList(), KKJobManagment::KKJob::ProcessNode(), KKJobManagment::KKJobList::PushOnBack(), and KKJobManagment::KKJob::status.
| void KKJobManager::SetQuitRunningFlag | ( | ) |
|
protectedvirtual |
Definition at line 341 of file KKJobManager.cpp.
References KKJobManagment::KKJob::AddPrerequisites(), KKJobManagment::KKJob::CallAppropriateConstructor(), KKB::KKStr::CompareIgnoreCase(), KKB::KKStr::Concat(), KKB::DateTime::DateTime(), KKB::KKStr::Empty(), KKB::KKStr::EqualIgnoreCase(), KKB::KKStr::ExtractToken2(), KKB::KKStr::ExtractTokenDouble(), KKB::KKStr::ExtractTokenInt(), KKJobManagment::KKJob::JobId(), KKJobManagment::KKJob::JobStatusFromStr(), KKB::KKStr::KKStr(), KKJobManagment::KKJobList::LookUpByJobId(), KKB::KKStr::operator=(), KKB::DateTime::operator=(), KKB::KKStr::operator==(), KKJobManagment::KKJobList::PushOnBack(), KKJobManagment::KKJob::ReFresh(), KKJobManagment::KKJob::status, StatusFileProcessLineJobStatusChange(), KKB::KKStr::SubStrPart(), KKB::KKStr::ToInt(), KKB::KKStr::TrimLeft(), and KKB::KKStr::TrimRight().
|
protectedvirtual |
Definition at line 302 of file KKJobManager.cpp.
References KKJobManagment::KKJob::AddPrerequisites(), KKB::KKStr::Concat(), EndBlock(), KKB::KKStr::ExtractToken2(), KKB::KKStr::ExtractTokenInt(), KKJobManagment::KKJob::JobStatusFromStr(), KKJobManagment::KKJob::jsNULL, KKJobManagment::KKJobList::LookUpByJobId(), KKB::osWaitForEnter(), KKJobManagment::KKJob::Status(), KKB::KKStr::TrimLeft(), and KKB::KKStr::TrimRight().
Referenced by StatusFileProcessLine().
|
inline |
Definition at line 60 of file KKJobManager.h.
|
inline |
Definition at line 62 of file KKJobManager.h.
|
protectedvirtual |
derived classes should implement this method. They need to return a tab delimietd string with all there parameters <FieldName1> <> <FieldValue1> <> <fieldName2> <> <FieldValue2> etc etc etc ... They should call the base Class version of this method and return that string first. ex: return KKJobManager::ToStatusStr () + "\t" + "FieldName1" + "\t" + "Value1" + "\t" + "FieldName2" + "\t" + "Value2";
Reimplemented from KKJobManagment::KKJob.
Definition at line 728 of file KKJobManager.cpp.
References KKJobManagment::KKJob::AddPrerequisites(), KKB::KKStr::Concat(), KKJobManagment::KKJob::JobStatusToStr(), KKB::KKStr::KKStr(), KKJobManagment::KKJob::status, and KKJobManagment::KKJob::ToStatusStr().
| void KKJobManager::Update | ( | JobManagerPtr | p | ) |