def find_outfiles(options):
    """Determine output file absolut locations and return them in a list."""
    if options.files == None:
        outfiles = lgf.find_newest(curr_dir + "/" + expr_mgmt.config_option_value("outdir"))
    else:
        outfiles = lgf.find_given(options.files.split(','))
    return outfiles
def find_outfiles(options):
    """Determine output file absolute locations and return them in a list."""

    # If files were not given, find the youngest output files for today's date.
    if options.files == None:
        outfiles = lgf.find_newest(curr_dir + "/" + expr_mgmt.config_option_value("outdir"))
    else:
        # should only get one file thanks to the check in parse_args
        outfiles = lgf.find_given(options.files.split(','))
    return outfiles
示例#3
0
def find_outfiles(options):
    """Determine output file absolute locations and return them in a list."""

    # If files were not given, find the youngest output files for today's date.
    if options.files == None:
        # This will return a list of one element
        outfiles = lgf.find_newest(curr_dir + "/" + expr_mgmt.config_option_value("outdir"))
    else:
        # This should only return a list with one file thanks to the check in parse_args
        outfiles = lgf.find_given(options.files.split(","))
    # This test expects only one output file.
    return outfiles
def main(argv=None):
    if len(argv) != 2:
        print "Usage:"
        print "rs_exprmgmtrc_option_value.py OPTION\n"
        print ("where OPTION is the value to search for in "
            + "experiment_management's rc file.\n")
        return 1

    value = expr_mgmt.config_option_value(str(argv[1]))
    if value == None:
        return 1
    else:
        print value
        return 0
示例#5
0
def main(argv=None):
    """Main method for running this test.

    Return values:
     0: Test ran
    -1: Problem with opening the log file.
    """
    # Where the output of the test will be placed.
    out_dir = str(expr_mgmt.config_option_value("outdir")) + "/" + str(datetime.date.today())
    # Create the directory if needed
    if not os.path.isdir(out_dir):
        os.makedirs(out_dir)
    out_file = str(out_dir) + "/" + str(strftime("%H-%M-%S", localtime())) + ".log"
    try:
        of = open(out_file, "w")
    except OSError, detail:
        print("Error: unable to create log file " + str(out_file) + ": " + str(detail))
        return [-1]
def append_path(paths):
    """Append experiment_management's rs_mnt_append_path to all elements of paths.

    Input:
        paths: a list of paths to append to
    Output:
        A copy of paths that has rs_mnt_append_path appended to each element.
        If rs_mnt_append_path is not defined in experiment_management's rc
        file, a copy of paths is returned.
    """
    # Get the optional path from experiment_management
    append_path = expr_mgmt.config_option_value("rs_mnt_append_path")
    ret_list = []
    for path in paths:
        if append_path != None:
            if path[-1] != "/":
                path += "/"
            ret_list += [str(path) + str(append_path)]
        else:
            ret_list += [path]
    return ret_list
示例#7
0
#! /usr/bin/env python

import sys,expr_mgmt

try:
  ppns = expr_mgmt.config_option_value("ppn")

except KeyError, data:
  sys.stdout.write( str( data ) + ' is a nonexistent system.\n' )

else:
  sys.stdout.write( 'PPN for default system is "' + str( ppns ) + '".\n' ) 
示例#8
0
user = getpass.getuser()

# Add the directory that contains helper modules
utils_dir = basedir + "tests/utils"
if utils_dir not in sys.path:
    sys.path += [utils_dir]

# Import the needed common modules
import rs_exprmgmt_paths_add as em_p
# Add the experiment_management locations to sys.path
em_p.add_exprmgmt_paths(basedir)

# Import expr_mgmt to aid in computing how many processes we need. We want
# at least enough to cover two nodes.
import expr_mgmt
ppn = expr_mgmt.config_option_value("ppn")
nprocs = 4

# Need the runcommand from experiment_management
runcommand = expr_mgmt.config_option_value("runcommand")

# Import the module with functions for finding mount points.
import rs_plfs_config_query
import rs_exprmgmtrc_target_path_append as tpa


def get_mountpoint():
    mount_points = rs_plfs_config_query.get_mountpoints()
    if len(mount_points) > 0:
        mount_point = mount_points[-1]
    else:
示例#9
0
#! /usr/bin/env python

import sys, expr_mgmt

try:
    ppns = expr_mgmt.config_option_value("ppn")

except KeyError, data:
    sys.stdout.write(str(data) + ' is a nonexistent system.\n')

else:
    sys.stdout.write('PPN for default system is "' + str(ppns) + '".\n')