JobQueue Class Reference

#include <jobqueue.h>

List of all members.


Detailed Description

Definition at line 98 of file jobqueue.h.


Public Member Functions

 JobQueue (bool master)
 ~JobQueue (void)
void customEvent (QCustomEvent *e)

Static Public Member Functions

static bool QueueRecordingJobs (ProgramInfo *pinfo, int jobTypes=JOB_NONE)
static bool QueueJob (int jobType, QString chanid, QDateTime starttime, QString args="", QString comment="", QString host="", int flags=0, int status=JOB_QUEUED, QDateTime schedruntime=QDateTime())
static bool QueueJobs (int jobTypes, QString chanid, QDateTime starttime, QString args="", QString comment="", QString host="")
static int GetJobID (int jobType, QString chanid, QDateTime starttime)
static bool GetJobInfoFromID (int jobID, int &jobType, QString &chanid, QDateTime &starttime)
static bool GetJobInfoFromID (int jobID, int &jobType, QString &chanid, QString &starttime)
static bool ChangeJobCmds (int jobID, int newCmds)
static bool ChangeJobCmds (int jobType, QString chanid, QDateTime starttime, int newCmds)
static bool ChangeJobFlags (int jobID, int newFlags)
static bool ChangeJobStatus (int jobID, int newStatus, QString comment="")
static bool ChangeJobHost (int jobID, QString newHostname)
static bool ChangeJobComment (int jobID, QString comment="")
static bool ChangeJobArgs (int jobID, QString args="")
static bool IsJobQueuedOrRunning (int jobType, QString chanid, QDateTime starttime)
static bool IsJobRunning (int jobType, QString chanid, QDateTime starttime)
static bool IsJobRunning (int jobType, ProgramInfo *pginfo)
static bool IsJobQueued (int jobType, QString chanid, QDateTime starttime)
static bool PauseJob (int jobID)
static bool ResumeJob (int jobID)
static bool RestartJob (int jobID)
static bool StopJob (int jobID)
static bool DeleteJob (int jobID)
static enum JobCmds GetJobCmd (int jobID)
static enum JobFlags GetJobFlags (int jobID)
static enum JobStatus GetJobStatus (int jobID)
static enum JobStatus GetJobStatus (int jobType, QString chanid, QDateTime starttime)
static QString GetJobArgs (int jobID)
static int UserJobTypeToIndex (int JobType)
static bool DeleteAllJobs (QString chanid, QDateTime starttime)
static void ClearJobMask (int &mask)
static bool JobIsInMask (int job, int mask)
static bool JobIsNotInMask (int job, int mask)
static void AddJobsToMask (int jobs, int &mask)
static void RemoveJobsFromMask (int jobs, int &mask)
static QString JobText (int jobType)
static QString StatusText (int status)
static bool HasRunningOrPendingJobs (int startingWithinMins=0)
static int GetJobsInQueue (QMap< int, JobQueueEntry > &jobs, int findJobs=JOB_LIST_NOT_DONE)
static void RecoverQueue (bool justOld=false)
static void RecoverOldJobsInQueue ()
static void CleanupOldJobsInQueue ()

Private Member Functions

void RunQueueProcesser (void)
void ProcessQueue (void)
void ProcessJob (int id, int jobType, QString chanid, QDateTime starttime)
bool AllowedToRun (JobQueueEntry job)
void StartChildJob (void *(*start_routine)(void *), ProgramInfo *tmpInfo)
QString GetJobDescription (int jobType)
QString GetJobCommand (int id, int jobType, ProgramInfo *tmpInfo)
void DoTranscodeThread (void)
void DoFlagCommercialsThread (void)
void DoUserJobThread (void)

Static Private Member Functions

static void * QueueProcesserThread (void *param)
static bool InJobRunWindow (int orStartingWithinMins=0)
static QString GetJobQueueKey (QString chanid, QString startts)
static QString GetJobQueueKey (QString chanid, QDateTime starttime)
static QString GetJobQueueKey (ProgramInfo *pginfo)
static void * TranscodeThread (void *param)
static QString PrettyPrint (off_t bytes)
static void * FlagCommercialsThread (void *param)
static void * UserJobThread (void *param)

Private Attributes

QString m_hostname
int jobsRunning
int jobQueueCPU
ProgramInfom_pginfo
QMutex controlFlagsLock
QMap< QString, int * > jobControlFlags
QMap< QString, int > runningJobIDs
QMap< QString, int > runningJobTypes
QMap< QString, QString > runningJobDescs
QMap< QString, QString > runningJobCommands
bool childThreadStarted
bool isMaster
pthread_t queueThread
QWaitCondition queueThreadCond
QMutex queueThreadCondLock

Constructor & Destructor Documentation

JobQueue::JobQueue ( bool  master  ) 

Definition at line 29 of file jobqueue.cpp.

JobQueue::~JobQueue ( void   ) 

Definition at line 51 of file jobqueue.cpp.


Member Function Documentation

void JobQueue::customEvent ( QCustomEvent *  e  ) 

Definition at line 59 of file jobqueue.cpp.

bool JobQueue::QueueRecordingJobs ( ProgramInfo pinfo,
int  jobTypes = JOB_NONE 
) [static]

bool JobQueue::QueueJob ( int  jobType,
QString  chanid,
QDateTime  starttime,
QString  args = "",
QString  comment = "",
QString  host = "",
int  flags = 0,
int  status = JOB_QUEUED,
QDateTime  schedruntime = QDateTime() 
) [static]

bool JobQueue::QueueJobs ( int  jobTypes,
QString  chanid,
QDateTime  starttime,
QString  args = "",
QString  comment = "",
QString  host = "" 
) [static]

Definition at line 575 of file jobqueue.cpp.

Referenced by QueueRecordingJobs().

int JobQueue::GetJobID ( int  jobType,
QString  chanid,
QDateTime  starttime 
) [static]

Definition at line 617 of file jobqueue.cpp.

Referenced by DoFlagCommercials(), and FlagCommercials().

bool JobQueue::GetJobInfoFromID ( int  jobID,
int &  jobType,
QString &  chanid,
QDateTime &  starttime 
) [static]

Definition at line 644 of file jobqueue.cpp.

Referenced by customEvent(), GetJobInfoFromID(), and main().

bool JobQueue::GetJobInfoFromID ( int  jobID,
int &  jobType,
QString &  chanid,
QString &  starttime 
) [static]

Definition at line 675 of file jobqueue.cpp.

bool JobQueue::ChangeJobCmds ( int  jobID,
int  newCmds 
) [static]

bool JobQueue::ChangeJobCmds ( int  jobType,
QString  chanid,
QDateTime  starttime,
int  newCmds 
) [static]

Definition at line 900 of file jobqueue.cpp.

bool JobQueue::ChangeJobFlags ( int  jobID,
int  newFlags 
) [static]

Definition at line 924 of file jobqueue.cpp.

bool JobQueue::ChangeJobStatus ( int  jobID,
int  newStatus,
QString  comment = "" 
) [static]

bool JobQueue::ChangeJobHost ( int  jobID,
QString  newHostname 
) [static]

Definition at line 1351 of file jobqueue.cpp.

Referenced by ProcessQueue(), and RecoverQueue().

bool JobQueue::ChangeJobComment ( int  jobID,
QString  comment = "" 
) [static]

bool JobQueue::ChangeJobArgs ( int  jobID,
QString  args = "" 
) [static]

Definition at line 1002 of file jobqueue.cpp.

Referenced by main().

bool JobQueue::IsJobQueuedOrRunning ( int  jobType,
QString  chanid,
QDateTime  starttime 
) [static]

bool JobQueue::IsJobRunning ( int  jobType,
QString  chanid,
QDateTime  starttime 
) [static]

bool JobQueue::IsJobRunning ( int  jobType,
ProgramInfo pginfo 
) [static]

Definition at line 1037 of file jobqueue.cpp.

bool JobQueue::IsJobQueued ( int  jobType,
QString  chanid,
QDateTime  starttime 
) [static]

Definition at line 1053 of file jobqueue.cpp.

bool JobQueue::PauseJob ( int  jobID  )  [static]

Definition at line 687 of file jobqueue.cpp.

Referenced by StatusBox::clicked().

bool JobQueue::ResumeJob ( int  jobID  )  [static]

Definition at line 696 of file jobqueue.cpp.

Referenced by StatusBox::clicked().

bool JobQueue::RestartJob ( int  jobID  )  [static]

Definition at line 705 of file jobqueue.cpp.

bool JobQueue::StopJob ( int  jobID  )  [static]

Definition at line 714 of file jobqueue.cpp.

Referenced by StatusBox::clicked().

bool JobQueue::DeleteJob ( int  jobID  )  [static]

Definition at line 855 of file jobqueue.cpp.

Referenced by StatusBox::clicked(), and QueueJob().

enum JobCmds JobQueue::GetJobCmd ( int  jobID  )  [static]

enum JobFlags JobQueue::GetJobFlags ( int  jobID  )  [static]

Definition at line 1463 of file jobqueue.cpp.

Referenced by DoTranscodeThread().

enum JobStatus JobQueue::GetJobStatus ( int  jobID  )  [static]

enum JobStatus JobQueue::GetJobStatus ( int  jobType,
QString  chanid,
QDateTime  starttime 
) [static]

Definition at line 1508 of file jobqueue.cpp.

QString JobQueue::GetJobArgs ( int  jobID  )  [static]

Definition at line 1440 of file jobqueue.cpp.

Referenced by CompleteJob().

int JobQueue::UserJobTypeToIndex ( int  JobType  )  [static]

bool JobQueue::DeleteAllJobs ( QString  chanid,
QDateTime  starttime 
) [static]

Definition at line 723 of file jobqueue.cpp.

Referenced by MainServer::DoDeleteThread().

static void JobQueue::ClearJobMask ( int &  mask  )  [inline, static]

Definition at line 157 of file jobqueue.h.

static bool JobQueue::JobIsInMask ( int  job,
int  mask 
) [inline, static]

Definition at line 158 of file jobqueue.h.

Referenced by init_jobs().

static bool JobQueue::JobIsNotInMask ( int  job,
int  mask 
) [inline, static]

Definition at line 159 of file jobqueue.h.

Referenced by init_jobs().

static void JobQueue::AddJobsToMask ( int  jobs,
int &  mask 
) [inline, static]

Definition at line 161 of file jobqueue.h.

Referenced by init_jobs().

static void JobQueue::RemoveJobsFromMask ( int  jobs,
int &  mask 
) [inline, static]

QString JobQueue::JobText ( int  jobType  )  [static]

QString JobQueue::StatusText ( int  status  )  [static]

bool JobQueue::HasRunningOrPendingJobs ( int  startingWithinMins = 0  )  [static]

Definition at line 1183 of file jobqueue.cpp.

Referenced by getStatus().

int JobQueue::GetJobsInQueue ( QMap< int, JobQueueEntry > &  jobs,
int  findJobs = JOB_LIST_NOT_DONE 
) [static]

void JobQueue::RecoverQueue ( bool  justOld = false  )  [static]

Definition at line 1534 of file jobqueue.cpp.

Referenced by RunQueueProcesser().

static void JobQueue::RecoverOldJobsInQueue (  )  [inline, static]

Definition at line 173 of file jobqueue.h.

Referenced by HouseKeeper::RunHouseKeeping().

void JobQueue::CleanupOldJobsInQueue (  )  [static]

Definition at line 1595 of file jobqueue.cpp.

Referenced by HouseKeeper::RunHouseKeeping().

void * JobQueue::QueueProcesserThread ( void *  param  )  [static, private]

Definition at line 145 of file jobqueue.cpp.

Referenced by JobQueue().

void JobQueue::RunQueueProcesser ( void   )  [private]

Definition at line 132 of file jobqueue.cpp.

Referenced by QueueProcesserThread().

void JobQueue::ProcessQueue ( void   )  [private]

Definition at line 153 of file jobqueue.cpp.

Referenced by RunQueueProcesser().

void JobQueue::ProcessJob ( int  id,
int  jobType,
QString  chanid,
QDateTime  starttime 
) [private]

Definition at line 1620 of file jobqueue.cpp.

Referenced by ProcessQueue().

bool JobQueue::AllowedToRun ( JobQueueEntry  job  )  [private]

Definition at line 1386 of file jobqueue.cpp.

Referenced by ProcessQueue().

bool JobQueue::InJobRunWindow ( int  orStartingWithinMins = 0  )  [static, private]

Definition at line 1109 of file jobqueue.cpp.

Referenced by HasRunningOrPendingJobs(), and ProcessQueue().

void JobQueue::StartChildJob ( void *(*)(void *)  start_routine,
ProgramInfo tmpInfo 
) [private]

Definition at line 1686 of file jobqueue.cpp.

Referenced by ProcessJob().

QString JobQueue::GetJobQueueKey ( QString  chanid,
QString  startts 
) [static, private]

QString JobQueue::GetJobQueueKey ( QString  chanid,
QDateTime  starttime 
) [static, private]

Definition at line 1098 of file jobqueue.cpp.

QString JobQueue::GetJobQueueKey ( ProgramInfo pginfo  )  [static, private]

Definition at line 1104 of file jobqueue.cpp.

QString JobQueue::GetJobDescription ( int  jobType  )  [private]

Definition at line 1706 of file jobqueue.cpp.

Referenced by ProcessJob().

QString JobQueue::GetJobCommand ( int  id,
int  jobType,
ProgramInfo tmpInfo 
) [private]

Definition at line 1721 of file jobqueue.cpp.

Referenced by ProcessJob().

void * JobQueue::TranscodeThread ( void *  param  )  [static, private]

Definition at line 1837 of file jobqueue.cpp.

Referenced by ProcessJob().

QString JobQueue::PrettyPrint ( off_t  bytes  )  [static, private]

Definition at line 1804 of file jobqueue.cpp.

Referenced by DoTranscodeThread().

void JobQueue::DoTranscodeThread ( void   )  [private]

Definition at line 1845 of file jobqueue.cpp.

Referenced by TranscodeThread().

void * JobQueue::FlagCommercialsThread ( void *  param  )  [static, private]

Definition at line 2068 of file jobqueue.cpp.

Referenced by ProcessJob().

void JobQueue::DoFlagCommercialsThread ( void   )  [private]

Definition at line 2076 of file jobqueue.cpp.

Referenced by FlagCommercialsThread().

void * JobQueue::UserJobThread ( void *  param  )  [static, private]

Definition at line 2205 of file jobqueue.cpp.

Referenced by ProcessJob().

void JobQueue::DoUserJobThread ( void   )  [private]

Definition at line 2213 of file jobqueue.cpp.

Referenced by UserJobThread().


Member Data Documentation

QString JobQueue::m_hostname [private]

Definition at line 207 of file jobqueue.h.

Referenced by AllowedToRun(), JobQueue(), and ProcessQueue().

int JobQueue::jobsRunning [private]

Definition at line 209 of file jobqueue.h.

Referenced by JobQueue(), and ProcessQueue().

int JobQueue::jobQueueCPU [private]

Definition at line 210 of file jobqueue.h.

Referenced by DoTranscodeThread(), DoUserJobThread(), and JobQueue().

QMutex JobQueue::controlFlagsLock [private]

QMap<QString, int *> JobQueue::jobControlFlags [private]

Definition at line 215 of file jobqueue.h.

Referenced by customEvent(), DoFlagCommercialsThread(), DoTranscodeThread(), and ProcessQueue().

QMap<QString, int> JobQueue::runningJobIDs [private]

QMap<QString, int> JobQueue::runningJobTypes [private]

QMap<QString, QString> JobQueue::runningJobDescs [private]

QMap<QString, QString> JobQueue::runningJobCommands [private]

Definition at line 223 of file jobqueue.h.

Referenced by JobQueue().

Definition at line 225 of file jobqueue.h.

Referenced by JobQueue(), and ~JobQueue().

QWaitCondition JobQueue::queueThreadCond [private]

Definition at line 226 of file jobqueue.h.

Referenced by JobQueue(), and RunQueueProcesser().

Definition at line 227 of file jobqueue.h.

Referenced by JobQueue(), and RunQueueProcesser().


The documentation for this class was generated from the following files:

Generated on Sat Dec 18 05:16:04 2010 for MythTV by  doxygen 1.5.5