Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Current »

Follow the PBS Pro Design Document Guidelines.

Overview

Right now, the different daemons log events differently.  The mom and server have log_events which you turn on which log bits you want to log.  The scheduler has a log_filter which you start with all bits and set which bits you want filtered out.  This RFE is to make the scheduler more like the other daemons.


Technical Details

New sched object attribute: log_events

This attribute will work similarly to server's log_events attribute, mom's $log_events config parameter, or the comm's PBS_COMM_LOG_EVENTS.  The value will be a decimal bitmask (e.g., 511 = all bits under 512). 

Since it is a sched attribute, each scheduler can have their own value of the log_events attribute.  The bits correspond to log events will be the events that are logged.

The default value of log_events is 767 (0x2FF).  This is the current default in log_events form.  If log_events is unset, it will be reset back to the default.

The default includes:

PBSEVENT_ERROR
PBSEVENT_SYSTEM 
PBSEVENT_ADMIN 
PBSEVENT_JOB 
PBSEVENT_JOB_USAGE 
PBSEVENT_SECURITY 
PBSEVENT_SCHED
PBSEVENT_DEBUG
PBSEVENT_RESV

This leaves out:

PBSEVENT_DEBUG2 
PBSEVENT_DEBUG3 
PBSEVENT_DEBUG4 

Internals:

The scheduler queries the its sched object on the first cycle.  It will use data from this query to set things like its log or priv directory.  It will also requery this data when that scheduler is sent a SCH_ATTRS_CONFIGURE command.  The log_events will be yet another thing queried from the sched object.  Once we have the log_events, we will set the 'log_event_mask' global variable to the value.  This global is used by the logging library to determine which events to log.  The scheduler's internal schdlog() function will replaced with calls to log_eventf() (see below).

Obsoleted sched_config parameter: log_filter

The log_filter sched_config parameter will be obsoleted. 

The following message will be logged if log_filter is in the sched_config file: "Obsolete config name log_filter, instead use nothing - set log_events via qmgr."

This message is printed when the scheduler is started and on a HUP.

This message is similar to the obsolete message for other sched_config parameters which were moved to qmgr.

New internal liblog function: void log_eventf(int eventtype, int objclass, int sev, const char *objname, const char *fmt, ...)

This new log event function is a combination of log_event() and sprintf().  The main purpose of this function is to eliminate all string manipulation for log messages that will ultimately be ignored because we're not logging that event.  This is important for the scheduler since it needs to avoid as much string manipulation as possible to be as fast as possible.


To implement this new function, pbs_asprintf() will be broken into three pieces.  Two of these pieces are internal helper functions.  The functionality of pbs_asprintf() will not be changed.

Function: int pbs_asprintf_len(const char *fmt, va_list *args):

This function will determine the length of the formatted string which is passed to pbs_asprintf().  The args parameter are the variable list arguments passed into pbs_asprintf().

Function: char *pbs_asprintf_format(int len, const char *fmt, va_list *args):

This function allocates the new buffer, and formats the string into the buffer.  The args parameter here is also the variable list arguments passed into pbs_asprintf().


pbs_asprintf() will now call pbs_asprintf_len() and then pass that length into pbs_asprintf_format() to get the string it will return.


log_eventf() has a local char * variable of the same length as log_buffer (4096).  It would probably be safe to use log_buffer, but to be on the safe side, we'll use a local variable.

log_eventf() will do the following:

  1. Call will_log_event() to determine if we are going to log the event.  If we aren't return.
  2. Call pbs_asprintf_len() to determine the length of the formatted string.
  3. If the length is less than 4096, we call snprintf() into our local buffer.  This avoids us having to allocate memory for smaller log messages.
  4. If the length is greater than 4096, we call pbs_asprintf_format() to allocate and format the string.
  5. We call log_record() to to log the buffer.
  6. If we allocated the buffer with pbs_asprintf_format(), we free the buffer.




OSS Site Map

Project Documentation Main Page

Developer Guide Pages



  • No labels