Changeset 373
- Timestamp:
- 06/13/07 15:38:52 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jobmond/jobmond.py
r368 r373 24 24 import sys, getopt, ConfigParser 25 25 import time, os, socket, string, re 26 import xdrlib, socket 26 import xdrlib, socket, syslog 27 27 import xml, xml.sax 28 28 from xml.sax import saxutils, make_parser … … 117 117 global DEBUG_LEVEL, DAEMONIZE, BATCH_SERVER, BATCH_POLL_INTERVAL 118 118 global GMOND_CONF, DETECT_TIME_DIFFS, BATCH_HOST_TRANSLATE 119 global BATCH_API, QUEUE, GMETRIC_TARGET 119 global BATCH_API, QUEUE, GMETRIC_TARGET, USE_SYSLOG 120 global SYSLOG_LEVEL, SYSLOG_FACILITY 120 121 121 122 DEBUG_LEVEL = cfg.getint( 'DEFAULT', 'DEBUG_LEVEL' ) 122 123 123 124 DAEMONIZE = cfg.getboolean( 'DEFAULT', 'DAEMONIZE' ) 125 126 try: 127 USE_SYSLOG = cfg.getboolean( 'DEFAULT', 'USE_SYSLOG' ) 128 129 except ConfigParser.NoOptionError: 130 131 USE_SYSLOG = True 132 133 debug_msg( 0, 'ERROR: no option USE_SYSLOG found: assuming yes' ) 134 135 if USE_SYSLOG: 136 137 try: 138 SYSLOG_LEVEL = cfg.getint( 'DEFAULT', 'SYSLOG_LEVEL' ) 139 140 except ConfigParser.NoOptionError: 141 142 debug_msg( 0, 'ERROR: no option SYSLOG_LEVEL found: assuming level 0' ) 143 SYSLOG_LEVEL = 0 144 145 try: 146 147 SYSLOG_FACILITY = eval( 'syslog.LOG_' + cfg.get( 'DEFAULT', 'SYSLOG_FACILITY' ) ) 148 149 except AttributeError, detail: 150 151 SYSLOG_FACILITY = syslog.LOG_DAEMON 152 153 debug_msg( 0, 'ERROR: no option SYSLOG_FACILITY found: assuming facility DAEMON' ) 124 154 125 155 try: … … 169 199 BATCH_API = api_guess 170 200 else: 171 debug_msg( 0, " fatal error: BATCH_API not set and can't make guess" )201 debug_msg( 0, "FATAL ERROR: BATCH_API not set and can't make guess" ) 172 202 sys.exit( 1 ) 173 203 … … 190 220 if not GMOND_CONF: 191 221 192 debug_msg( 0, " fatal error: GMETRIC_TARGET or GMOND_CONF both not set!" )222 debug_msg( 0, "FATAL ERROR: GMETRIC_TARGET and GMOND_CONF both not set! Set at least one!" ) 193 223 sys.exit( 1 ) 194 224 else: 195 225 196 debug_msg( 0, " error: GMETRIC_TARGET not set: internel Gmetric handling aborted. Failing back to DEPRECATED use of gmond.conf/gmetric binary. This will slow down jobmond significantly!" )226 debug_msg( 0, "ERROR: GMETRIC_TARGET not set: internel Gmetric handling aborted. Failing back to DEPRECATED use of gmond.conf/gmetric binary. This will slow down jobmond significantly!" ) 197 227 198 228 return True … … 231 261 232 262 if not os.path.exists( gmond_file ): 233 debug_msg( 0, ' fatal error: ' + gmond_file + ' does not exist' )263 debug_msg( 0, 'FATAL ERROR: ' + gmond_file + ' does not exist' ) 234 264 sys.exit( 1 ) 235 265 … … 930 960 """Print msg if at or above current debug level""" 931 961 932 if (DEBUG_LEVEL >= level): 933 sys.stderr.write( msg + '\n' ) 962 if (not DAEMONIZE and DEBUG_LEVEL >= level): 963 sys.stderr.write( msg + '\n' ) 964 965 if (DAEMONIZE and USE_SYSLOG and SYSLOG_LEVEL >= level): 966 syslog.syslog( msg ) 934 967 935 968 def write_pidfile(): … … 950 983 951 984 global PBSQuery, PBSError 985 global SYSLOG_FACILITY, USE_SYSLOG, BATCH_API, DAEMONIZE 952 986 953 987 if not processArgs( sys.argv[1:] ): … … 962 996 except ImportError: 963 997 964 debug_msg( 0, " fatal error: BATCH_API set to 'pbs' but python module 'pbs_python' is not installed" )998 debug_msg( 0, "FATAL ERROR: BATCH_API set to 'pbs' but python module 'pbs_python' is not installed" ) 965 999 sys.exit( 1 ) 966 1000 … … 969 1003 elif BATCH_API == 'sge': 970 1004 971 debug_msg( 0, " fatal error: BATCH_API 'sge' implementation is currently broken, check future releases" )1005 debug_msg( 0, "FATAL ERROR: BATCH_API 'sge' implementation is currently broken, check future releases" ) 972 1006 973 1007 sys.exit( 1 ) … … 976 1010 977 1011 else: 978 debug_msg( 0, " fatal error: unknown BATCH_API '" + BATCH_API + "' is not supported" )1012 debug_msg( 0, "FATAL ERROR: unknown BATCH_API '" + BATCH_API + "' is not supported" ) 979 1013 980 1014 sys.exit( 1 ) 1015 1016 if( DAEMONIZE and USE_SYSLOG ): 1017 1018 syslog.openlog( 'jobmond', syslog.LOG_NOWAIT, SYSLOG_FACILITY ) 1019 981 1020 982 1021 if DAEMONIZE:
Note: See TracChangeset
for help on using the changeset viewer.