StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
TxLogging::TxUCMCollector Class Reference
Inheritance diagram for TxLogging::TxUCMCollector:
TxLogging::TxEventLog

Public Member Functions

 TxUCMCollector ()
 
boolean initDb ()
 
void startProcess ()
 
void processMessage (const std::string &message)
 
void processMessage (const char *message)
 
virtual StUcmTasksgetTaskList ()
 
virtual StUcmTasksgetTaskList (int limit)
 
virtual StUcmTasksgetTaskList (int limit, int offset)
 
virtual StUcmJobsgetJobList ()
 
virtual StUcmJobsgetJobList (StRecord *task)
 
virtual StUcmJobsgetJobList (StRecord *task, int limit)
 
virtual StUcmJobsgetJobList (int limit)
 
virtual StUcmJobsgetJobList (int limit, int offset)
 
virtual StUcmJobsgetJobList (StRecord *task, int limit, int offset)
 
virtual int getJobId (const char *reqName, const char *taskBrokerId, int jobBrokerId)
 
virtual StUcmEventsgetEventList ()
 
virtual StUcmEventsgetEventList (StRecord *job)
 
virtual StUcmEventsgetEventList (StRecord *job, int limit)
 
virtual StUcmEventsgetEventList (int limit)
 
virtual StUcmEventsgetEventList (int limit, int offset)
 
virtual StUcmEventsgetEventList (StRecord *job, int limit, int offset)
 
int fillTaskList (StUcmTasks &tasks, int limit=0, int offset=0)
 
int fillJobList (StUcmJobs &jobs, int limit=0, int offset=0)
 
int fillJobList (StUcmJobs &jobs, int limit, int offset, const StRecord *task)
 
int fillEventList (StUcmEvents &event, int limit=0, int offset=0, const StRecord *job=0)
 
void fillFields (FieldList &fields)
 
int fillUcmList (const char *type, RecordList &records, int limit=0, int offset=0)
 
int queryTableSize (const char *tableName)
 
int queryTableSize (const char *tableName, const char *where)
 
int queryTableSize (const char *tableName, const StRecord *where)
 
void queryTable (const char *tableName, int limit=0, int offset=0, const char *where=0)
 
void queryTaskTable (int limit=0, int offset=0)
 
void queryJobTable (int limit=0, int offset=0)
 
void queryJobTable (const char *taskID, int limit=0, int offset=0)
 
void queryEventTable (int limit=0, int offset=0)
 
void queryEventTable (const char *jobID, int limit=0, int offset=0)
 
virtual void setEnvBrokerTaskID (const std::string &envBrokerTaskID)
 
virtual void setEnvBrokerJobID (const std::string &envBrokerJobID)
 
virtual void setBrokerTaskID (const std::string &brokerTaskID)
 
virtual void setBrokerJobID (int brokerJobID)
 
virtual void setDbJobID (int dbJobID)
 
virtual void setRequesterName (const std::string &requester)
 
virtual void setContext (const std::string &context)
 
virtual void logStart (const std::string &key, const std::string &value)
 
virtual void logJobAttribute (const std::string &key, const std::string &value)
 
virtual void logJobSubmitLocation (const std::string &url)
 
virtual void setJobSubmitLocation (const std::string &url)
 
virtual void logTask (unsigned int size=1)
 
virtual void logTask (const std::string &taskAttributes)
 
virtual void logJobSubmitState (State state)
 
virtual void setJobSubmitState (State state)
 
virtual void logJobSubmitID (const std::string &ID)
 
virtual void setJobSubmitID (const std::string &ID)
 
virtual void logEvent (const std::string &logMsg, Level level=LEVEL_INFO, Stage stage=STATUS, const std::string &msgContext=TxUCMConstants::defaultContext)
 
virtual void logEvent (const std::string &userKey, const std::string &userValue, Level level=LEVEL_INFO, Stage stage=STATUS, const std::string &msgContext=TxUCMConstants::defaultContext)
 
virtual void logEnd (const std::string &key, const std::string &value)
 
- Public Member Functions inherited from TxLogging::TxEventLog
virtual ~TxEventLog ()
 
void setEnvBrokerTaskID (const char *envBrokerTaskID)
 
void setEnvBrokerJobID (const char *envBrokerJobID)
 
void setBrokerTaskID (const char *brokerTaskID)
 
void setRequesterName (const char *requester)
 
void setContext (const char *context)
 
void logStart (const char *key=TxUCMConstants::appStart, const char *value="application started")
 
void logJobSubmitLocation (const char *url)
 
void setJobSubmitLocation (const char *url)
 
void logJobAttribute (const char *key, const char *value)
 
void logTask (const char *taskAttributes)
 
void logJobSubmitID (const char *ID)
 
void setJobSubmitID (const char *ID)
 
void logEvent (const char *logMsg, Level level=LEVEL_INFO, Stage stage=STATUS, const char *msgContext=TxUCMConstants::defaultContext)
 
void logEvent (const char *userKey, const char *userValue, Level level=LEVEL_INFO, Stage stage=STATUS, const char *msgContext=TxUCMConstants::defaultContext)
 
void logEnd (const char *key=TxUCMConstants::appEnd, const char *value="application ended")
 

Static Public Member Functions

static void main (const char *args[])
 

Protected Member Functions

virtual void writeDown (const std::string &message)
 
virtual void writeDown (const char *message)
 
- Protected Member Functions inherited from TxLogging::TxEventLog
 TxEventLog ()
 

Additional Inherited Members

- Public Types inherited from TxLogging::TxEventLog
enum  Stage { START = 1, STATUS = 2, END = 3 }
 
enum  Level {
  LEVEL_UNKNOWN = 0, LEVEL_TRACE = 1, LEVEL_DEBUG = 2, LEVEL_INFO = 3,
  LEVEL_NOTICE = 4, LEVEL_WARNING = 5, LEVEL_ERROR = 6, LEVEL_CRITICAL = 7,
  LEVEL_ALERT = 8, LEVEL_FATAL = 9, TOTAL_LEVELS
}
 
enum  State {
  UNKNOWN = 0, UNSUBMITTED = 1, STAGEIN = 2, PENDING = 3,
  ACTIVE = 4, SUSPENDED = 5, STAGEOUT = 6, CLEANUP = 7,
  DONE = 8, FAILED = 9, TOTAL_STATES
}
 

Detailed Description

Definition at line 38 of file TxUCMCollector.h.

Constructor & Destructor Documentation

TxUCMCollector::TxUCMCollector ( )

Constructor

Definition at line 183 of file TxUCMCollector.cxx.

Referenced by main().

Member Function Documentation

virtual StUcmTasks* TxLogging::TxUCMCollector::getTaskList ( )
virtual

Create a new record in Tasks table: the values are in the value field of the log message

Reimplemented from TxLogging::TxEventLog.

boolean TxUCMCollector::initDb ( )

Init Db properties and connection

Returns
true if successful, false, if failed

Definition at line 248 of file TxUCMCollector.cxx.

Referenced by main().

void TxUCMCollector::logEnd ( const std::string &  key,
const std::string &  value 
)
virtual

Called by the application to log an END event

Implements TxLogging::TxEventLog.

Definition at line 1627 of file TxUCMCollector.cxx.

void TxUCMCollector::logEvent ( const std::string &  logMsg,
Level  level = LEVEL_INFO,
Stage  stage = STATUS,
const std::string &  msgContext = TxUCMConstants::defaultContext 
)
virtual

Log a simple message event. This event is always associated with the currnet brokerTaskID and brokerJobID.

Parameters
logMsgThe message to log.
levelThe level of severity of the event.
stageThe stage of the application assocated with the event.
msgContextThe context in which the event occurs.

Implements TxLogging::TxEventLog.

Definition at line 1616 of file TxUCMCollector.cxx.

void TxUCMCollector::logEvent ( const std::string &  userKey,
const std::string &  userValue,
Level  level = LEVEL_INFO,
Stage  stage = STATUS,
const std::string &  msgContext = TxUCMConstants::defaultContext 
)
virtual

Log a key-value pair type event. This event is always associated with the current brokerTaskID and brokerJobID.

Parameters
userKey,Thekey of the key-value to log.
userValue,Thevalue of the key-value to log.
levelThe level of severity of the event.
stageThe stage of the application assocated with the event.
msgContextThe context in which the event occurs.

Implements TxLogging::TxEventLog.

Definition at line 1621 of file TxUCMCollector.cxx.

void TxUCMCollector::logJobAttribute ( const std::string &  key,
const std::string &  value 
)
virtual

Log the job attrbutes. This method will be called by the Broker.

Parameters
stringattrbutes key, For example: "que"
stringattrbutes value, For example queu name

Implements TxLogging::TxEventLog.

Definition at line 1571 of file TxUCMCollector.cxx.

void TxUCMCollector::logJobSubmitID ( const std::string &  ID)
virtual

Log the job submit ID. This method will be called by the Broker.

Parameters
stringID, Job submit ID.

Implements TxLogging::TxEventLog.

Definition at line 1608 of file TxUCMCollector.cxx.

void TxUCMCollector::logJobSubmitLocation ( const std::string &  url)
virtual

Log the job submit location. This method will be called by the Broker.

Parameters
stringurl, Job submit location.

Implements TxLogging::TxEventLog.

Definition at line 1577 of file TxUCMCollector.cxx.

void TxUCMCollector::logJobSubmitState ( State  state)
virtual

Log the job state. This method will be called by the Broker.

Parameters
enumStage, Job state.

Implements TxLogging::TxEventLog.

Definition at line 1599 of file TxUCMCollector.cxx.

void TxUCMCollector::logStart ( const std::string &  key,
const std::string &  value 
)
virtual

Called by the application to log a START event

Implements TxLogging::TxEventLog.

Definition at line 1566 of file TxUCMCollector.cxx.

void TxUCMCollector::logTask ( unsigned int  size = 1)
virtual

Log the task size. This method will be called by the Broker to log the new task and its size.

Parameters
intsize, The new task size (the total number of the jobs)

Implements TxLogging::TxEventLog.

Definition at line 1589 of file TxUCMCollector.cxx.

void TxUCMCollector::logTask ( const std::string &  taskAttributes)
virtual

Log the task with the attributes. This method will be called by the Broker to log the new task and its attributes. The attribuites MUST match the "Task" MySQL table column names. The attribute types must match the mySql Task table column types

Parameters
stringattributes. Task attributes

Implements TxLogging::TxEventLog.

Definition at line 1594 of file TxUCMCollector.cxx.

void TxUCMCollector::main ( const char *  args[])
static

main to get things going

Definition at line 1280 of file TxUCMCollector.cxx.

References initDb(), processMessage(), startProcess(), and TxUCMCollector().

void TxUCMCollector::processMessage ( const std::string &  message)

Process the message and create a hash map with key value pairs Then process the hash map to create/update/insert tables

Parameters
constchar * message to process
Returns
boolean true if successful, false otherwise

Definition at line 568 of file TxUCMCollector.cxx.

Referenced by main().

void TxUCMCollector::setBrokerJobID ( int  brokerJobID)
virtual

The concept of a job ID and task ID assigned by broker is assumed to be available here. Set the value of Job ID here.

Parameters
intbrokerJobID, value of Job ID

Implements TxLogging::TxEventLog.

Definition at line 1543 of file TxUCMCollector.cxx.

void TxUCMCollector::setBrokerTaskID ( const std::string &  brokerTaskID)
virtual

The concept of a job ID and task ID assigned by broker is assumed to be available here. Set the value of Task ID here.

Parameters
stringbrokerTaskID, value of Task ID

Implements TxLogging::TxEventLog.

Definition at line 1537 of file TxUCMCollector.cxx.

void TxUCMCollector::setContext ( const std::string &  context)
virtual

Set context for this task/job

Parameters
context,themessage context

Implements TxLogging::TxEventLog.

Definition at line 1561 of file TxUCMCollector.cxx.

void TxUCMCollector::setDbJobID ( int  dbJobID)
virtual

The current Db if for the last selected job

Parameters
intdbJobID, value of Job ID

Implements TxLogging::TxEventLog.

Definition at line 1549 of file TxUCMCollector.cxx.

void TxUCMCollector::setEnvBrokerJobID ( const std::string &  envBrokerJobID)
virtual

The concept of a job ID and task ID assigned by broker is assumed to be available here. Set the job ID by passing the name of the environment variable

Parameters
stringenvBrokerJobID, Name of the environment variable

Implements TxLogging::TxEventLog.

Definition at line 1532 of file TxUCMCollector.cxx.

void TxUCMCollector::setEnvBrokerTaskID ( const std::string &  envBrokerTaskID)
virtual

The concept of a job ID and task ID assigned by broker is assumed to be available here. Set the task ID by passing the name of the environment variable

Parameters
stringenvBrokerTaskID, Name of the environment variable

Implements TxLogging::TxEventLog.

Definition at line 1527 of file TxUCMCollector.cxx.

void TxUCMCollector::setRequesterName ( const std::string &  requester)
virtual

Set the requester name

Parameters
stringrequesterName

Implements TxLogging::TxEventLog.

Definition at line 1555 of file TxUCMCollector.cxx.

void TxUCMCollector::startProcess ( )

startProcess: reads the todo list and starts processing the log file

Definition at line 370 of file TxUCMCollector.cxx.

Referenced by main().


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