Changeset 212 for trunk/jobmond
- Timestamp:
- 02/23/06 16:15:20 (17 years ago)
- Location:
- trunk/jobmond
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jobmond/jobmond.py
r197 r212 1 1 #!/usr/bin/env python 2 2 3 # Specify debugging level here; 4 # 5 # 10 = gemtric cmd's 6 DEBUG_LEVEL = 0 7 8 # Wether or not to run as a daemon in background 9 # 10 DAEMONIZE = 1 11 12 # Which Torque server to monitor 13 # 14 TORQUE_SERVER = 'localhost' 15 16 # How many seconds interval for polling of jobs 17 # 18 # this will effect directly how accurate the 19 # end time of a job can be determined 20 # 21 TORQUE_POLL_INTERVAL = 10 22 23 # Alternate location of gmond.conf 24 # 25 # Default: /etc/gmond.conf 26 # 27 #GMOND_CONF = '/etc/gmond.conf' 28 29 # Wether or not to detect differences in 30 # time from Torque server and local time. 31 # 32 # Ideally both machines (if not the same) 33 # should have the same time (via ntp or whatever) 34 # 35 DETECT_TIME_DIFFS = 1 3 import sys, getopt, ConfigParser 4 5 def processArgs( args ): 6 7 SHORT_L = 'c:' 8 LONG_L = 'config=' 9 10 config_filename = None 11 12 try: 13 14 opts, args = getopt.getopt( args, SHORT_L, LONG_L ) 15 16 except getopt.error, detail: 17 18 print detail 19 sys.exit(1) 20 21 for opt, value in opts: 22 23 if opt in [ '--config', '-c' ]: 24 25 config_filename = value 26 27 if not config_filename: 28 29 config_filename = '/etc/jobmond.conf' 30 31 return loadConfig( config_filename ) 32 33 def loadConfig( filename ): 34 35 cfg = ConfigParser.ConfigParser() 36 37 cfg.read( filename ) 38 39 global DEBUG_LEVEL, DAEMONIZE, TORQUE_SERVER, TORQUE_POLL_INTERVAL, GMOND_CONF, DETECT_TIME_DIFFS 40 41 42 # Specify debugging level here; 43 # 44 # 10 = gemtric cmd's 45 DEBUG_LEVEL = cfg.getint( 'DEFAULT', 'DEBUG_LEVEL' ) 46 47 # Wether or not to run as a daemon in background 48 # 49 DAEMONIZE = cfg.getboolean( 'DEFAULT', 'DAEMONIZE' ) 50 51 # Which Torque server to monitor 52 # 53 TORQUE_SERVER = cfg.get( 'DEFAULT', 'TORQUE_SERVER' ) 54 55 # How many seconds interval for polling of jobs 56 # 57 # this will effect directly how accurate the 58 # end time of a job can be determined 59 # 60 TORQUE_POLL_INTERVAL = cfg.getint( 'DEFAULT', 'TORQUE_POLL_INTERVAL' ) 61 62 # Alternate location of gmond.conf 63 # 64 # Default: /etc/gmond.conf 65 # 66 GMOND_CONF = cfg.get( 'DEFAULT', 'GMOND_CONF' ) 67 68 # Wether or not to detect differences in 69 # time from Torque server and local time. 70 # 71 # Ideally both machines (if not the same) 72 # should have the same time (via ntp or whatever) 73 # 74 DETECT_TIME_DIFFS = cfg.getboolean( 'DEFAULT', 'DETECT_TIME_DIFFS' ) 75 76 return True 36 77 37 78 from PBSQuery import PBSQuery 38 import sys 39 import time 40 import os 41 import socket 42 import string 79 80 import time, os, socket, string 43 81 44 82 class DataProcessor: … … 416 454 pid = os.fork() 417 455 if pid > 0: 418 sys.exit(0) # end par rent456 sys.exit(0) # end parent 419 457 420 458 # creates a session and sets the process group ID … … 426 464 pid = os.fork() 427 465 if pid > 0: 428 sys.exit(0) # end par rent466 sys.exit(0) # end parent 429 467 430 468 # Go to the root directory and set the umask … … 466 504 """Application start""" 467 505 506 if not processArgs( sys.argv[1:] ): 507 sys.exit( 1 ) 508 468 509 gather = DataGatherer() 469 510 if DAEMONIZE:
Note: See TracChangeset
for help on using the changeset viewer.