Changeset 1618


Ignore:
Timestamp:
Jul 13, 2015 6:52:15 AM (9 years ago)
Author:
maronga
Message:

watchdog is now steered via configuration file

Location:
palm/trunk/SCRIPTS
Files:
4 added
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palm_wd

    r1614 r1618  
    2020# Current revisions:
    2121# -----------------
    22 #
     22# Added steering via configuration file .wd.config, to be place in the local
     23# palm directory. Watchdog save files are automatically created upon first start.
    2324#
    2425# Former revisions:
     
    5556#------------------------------------------------------------------------------!
    5657
    57 import sys
    58 import subprocess as sub
     58import ConfigParser
     59import datetime
     60import os
    5961from PyQt4 import QtGui, QtCore, uic
    6062from PyQt4.QtCore import pyqtSlot,SIGNAL,SLOT
     63import shutil
     64import subprocess as sub
     65import sys
    6166import time
    62 import datetime
    63 import shutil
    64 import os
    65 
    66 # START OF HEADER
    67 # Each list must contain the login host, the username and a description
    68 hostname     = ["hlogin.hlrn.de", "blogin.hlrn.de"]
    69 username     = ["nikmaron"      , "nikmaron"      ]
    70 description  = ["Hannover"      , "Berlin"        ]
    71 
    72 update_frequency = 600*1000
    73 
    74 # END OF HEADER
    7567
    7668# Determine PALM directories
     
    8577   raise SystemExit
    8678
     79
     80# Read configuration file
     81# First check if the configuration file exists
     82if ( os.path.exists(palm_dir + '/.wd.config') == False ):
     83    print "Error. No configuration file .wd.config found in " + palm_dir
     84    raise SystemExit     
     85
     86config = ConfigParser.RawConfigParser()
     87config.read(palm_dir + '/.wd.config')
     88
     89description = []
     90hostname = []
     91username = []
     92
     93for i in range(0,len(config.sections())):
     94
     95    description_tmp = config.sections()[i]
     96 
     97    if ( description_tmp != 'Settings' ):
     98       description.append(description_tmp)
     99       hostname.append(config.get(description_tmp, 'hostname'))
     100       username.append(config.get(description_tmp, 'username'))
     101    else:
     102       update_frequency = int(config.get(description_tmp, 'update_frequency'))*60000
     103
     104# Check if .wd.olddata and .wd.newdata exist. Otherwise create the files
     105if ( os.path.exists(palm_dir + '/.wd.olddata') == False ):
     106   print "No .wd.olddata found. Creating..."
     107   file1 = open(palm_dir + '/.wd.olddata', 'a')
     108   file1.close()
     109   
     110
     111if ( os.path.exists(palm_dir + '/.wd.newdata') == False ):
     112   print "No .wd.newdata found. Creating..." 
     113   file1 = open(palm_dir + '/.wd.newdata', 'a')
     114   file1.close()
    87115
    88116# Dummy variables for the jobname and the progressbars
  • palm/trunk/SCRIPTS/palm_wdd

    r1614 r1618  
    2020# Current revisions:
    2121# -----------------
    22 #
     22# Added steering via configuration file, to be placed in the home directory of the
     23# remote host to be monitored.
    2324#
    2425# Former revisions:
     
    5657#------------------------------------------------------------------------------!
    5758
     59import ConfigParser
    5860import os
     61from subprocess import check_output
    5962import sys
    60 from subprocess import check_output
    61 
    62 # START OF HEADER
    63 
    64 # configuration for host
    65 cmd_readqueue      = "showq | egrep "
    66 cmd_tmpdir         = "/gfs1/tmp/"
    67 cmd_canceljob      = "canceljob"
    68 cmd_checkjob       = "checkjob"
    69 cmd_realname_grep  = "AName"
    70 cmd_starttime      = "showstart"
    71 cmd_starttime_grep = "start in"
    72 
    73 # END OF HEADER
     63
     64
     65# Read configuration file
     66# First check if the configuration file exists
     67if ( os.path.exists('.wdd.config') == False ):
     68    print "Error. No configuration file .wdd.config found."
     69    raise SystemExit     
     70
     71config = ConfigParser.RawConfigParser()
     72config.read('.wdd.config')
     73
     74cmd_readqueue      = config.get('Settings', 'readqueue').strip('"')
     75cmd_tmpdir         = config.get('Settings', 'tmpdir').strip('"')
     76cmd_canceljob      = config.get('Settings', 'canceljob').strip('"')
     77cmd_checkjob       = config.get('Settings', 'checkjob').strip('"')
     78cmd_realname_grep  = config.get('Settings', 'realname_grep').strip('"')
     79cmd_starttime      = config.get('Settings', 'starttime').strip('"')
     80cmd_starttime_grep = config.get('Settings', 'starttime_grep').strip('"')
    7481
    7582
     
    8087
    8188
    82 cmd_readqueue = cmd_readqueue + data
     89cmd_readqueue = cmd_readqueue + " " + data
    8390cmd_tmpdir    = cmd_tmpdir + data
    84 
    85 
    8691
    8792# reading queuing system
Note: See TracChangeset for help on using the changeset viewer.