Changeset 3567 for palm/trunk/SCRIPTS


Ignore:
Timestamp:
Nov 27, 2018 1:59:21 PM (6 years ago)
Author:
maronga
Message:

added first version of palm_csd (preprocessing tool for creating static drivers)

Location:
palm/trunk/SCRIPTS
Files:
6 added
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palm_wd

    r2825 r3567  
    2525# -----------------
    2626# $Id$
     27# Adjustments and bugfixes
     28#
     29#
     30# 2825 2018-02-20 21:48:27Z maronga
    2731# Modified header
    2832#
     
    9195
    9296# Determine PALM directories
    93 try:
    94    devnull = open(os.devnull, 'w')
    95    out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)
    96    palm_bin = out.rstrip()
    97    palm_dir = out.split("palm")[0] + "palm/" + out.split("palm")[1].split("/")[1]
    98    out = None
    99 except:   
    100    print "Error. $PALM_BIN is not set."
    101    raise SystemExit
    102 
    103 
    104 # Read configuration file
    105 # First check if the configuration file exists
    106 if ( os.path.exists(palm_dir + '/.wd.config') == False ):
    107     print "Error. No configuration file .wd.config found in " + palm_dir
    108     raise SystemExit     
    109 
    110 config = ConfigParser.RawConfigParser()
    111 config.read(palm_dir + '/.wd.config')
     97#  Check if configuration files exists and quit otherwise
     98input_config = ".wd.config"
     99for i in range(1,len(sys.argv)):
     100   input_config = str(sys.argv[i])
     101       
     102config = configparser.RawConfigParser(allow_no_value=True)
     103
     104if ( os.path.isfile(input_config) == False ):
     105   print ("Error. No configuration file " + input_config + " found.")
     106   raise SystemExit   
     107else:
     108   print(os.path.isfile(input_config))
     109
     110config.read(input_config) 
     111
    112112
    113113description = []
    114114hostname = []
    115115username = []
     116pycall = []
    116117
    117118for i in range(0,len(config.sections())):
     
    125126          hostname.append(config.get(description_tmp, 'hostname'))
    126127          username.append(config.get(description_tmp, 'username'))
     128          pycall.append(config.get(description_tmp, 'pycall'))
    127129    else:
    128130       update_frequency = int(config.get(description_tmp, 'update_frequency'))*60000
     
    401403            # Perform ssh command
    402404            host    = username[h] + "@" + hostname[h]
    403             ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd queue " + username[h]],
     405            ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd queue " + username[h]],
    404406                           shell=False,
    405407                           stdout=sub.PIPE,
     
    692694                  host = username[h] + "@" + hostname[h]
    693695
    694            ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd cancel " + jobname],
     696           ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd cancel " + jobname],
    695697                              shell=False,
    696698                              stdout=sub.PIPE,
     
    719721                host = username[h] + "@" + hostname[h]
    720722
    721         ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd check " + jobname],
     723        ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd check " + jobname],
    722724                           shell=False,
    723725                           stdout=sub.PIPE,
     
    746748                user = username[h]
    747749
    748         ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd stop " + jobrealname],
     750        ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd stop " + jobrealname],
    749751                           shell=False,
    750752                           stdout=sub.PIPE,
     
    778780                user = username[h]
    779781
    780         ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd restart " + jobrealname],
     782        ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd restart " + jobrealname],
    781783                           shell=False,
    782784                           stdout=sub.PIPE,
     
    810812                user = username[h]
    811813
    812         ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd parin " + jobrealname],
     814        ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd parin " + jobrealname],
    813815                           shell=False,
    814816                           stdout=sub.PIPE,
     
    843845                user = username[h]
    844846
    845         ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd rc " + jobrealname],
     847        ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd rc " + jobrealname],
    846848                           shell=False,
    847849                           stdout=sub.PIPE,
Note: See TracChangeset for help on using the changeset viewer.