Source code for mojo.pavayo.computeOptions

# -*- coding: utf-8 -*-
"""
computeOptions
==============
Module containing the option parser and its arguments for pavayo.py
"""


import argparse
import os
import shlex
import sys
import re

from ..bricabrac import fileIO as fileIO
from . import computeData as constants
from .. import getMojoVersion
from .executables.version import getSoftwareVersionNumberString
from ..jobManagement.management.clusterInfo import ClusterInfo
from ..jobManagement.management.resources import DEFAULT_RESOURCES, PROCESSORS

try:
    import pysvn
except ImportError:
    pysvn = None


[docs]class AutorunAction(argparse.Action): """Action class for the autorun option of PAVAYO. """ def __init__(self, option_strings, dest, const=True, default=False, required=False, help=None, metavar=None): # pylint: disable=redefined-builtin """Default action constructor. Sets const to True. """ super(AutorunAction, self).__init__(option_strings=option_strings, dest=dest, nargs=0, const=const, default=default, required=required, help=help) def __call__(self, parser, namespace, values, option_string=None): """Sets download, computation, postprocessing and latex to true if the autorun argument is provided. """ namespace.download = namespace.compute = namespace.post = namespace.latex = True setattr(namespace, self.dest, self.const)
[docs]class PostProcAction(argparse.Action): """Action class for the --postProc/-p option of PAVAYO. """ def __init__(self, option_strings, dest, const=True, default=False, required=False, help=None, metavar=None): # pylint: disable=redefined-builtin """Default action constructor. Sets const to True. """ super(PostProcAction, self).__init__(option_strings=option_strings, dest=dest, nargs=0, const=const, default=default, required=required, help=help) def __call__(self, parser, namespace, values, option_string=None): """Sets download, computation, postprocessing and latex to true if the autorun argument is provided. """ setattr(namespace, self.dest, self.const)
[docs]class UpdateMeshDataAction(argparse.Action): """Action class for the --updateMeshData option of PAVAYO. """ def __init__(self, option_strings, dest, const=True, default=False, required=False, help=None, metavar=None): # pylint: disable=redefined-builtin """Default action constructor. Sets const to True. """ super(UpdateMeshDataAction, self).__init__(option_strings=option_strings, dest=dest, nargs=0, const=const, default=default, required=required, help=help) def __call__(self, parser, namespace, values, option_string=None): """Sets download, computation, postprocessing and latex to true if the autorun argument is provided. """ namespace.updateRestartData = True setattr(namespace, self.dest, self.const)
[docs]class AddExecutableAction(argparse.Action): """Action class for additional executables other than TRACE, PREP, POST, GMCPLAY or PYMESH """ def __call__(self, parser, namespace, values, option_string=None): """Add key to dictionary """ if len(values) == 1: curSplitter = shlex.shlex(values[0], posix=True) curSplitter.whitespace += '=' curSplitter.whitespace_split = True curVals = list(curSplitter) if len(curVals) != 2: raise argparse.ArgumentTypeError(f"Wrong type for argument '{values[0]}'. Either '<key>=<path>' or <key> <path>.") elif len(values) == 2: curVals = values else: raise argparse.ArgumentTypeError(f"Wrong number of arguments {values}. One or two arguments allowed. Either '<key>=<path>' or <key> <path>.") invalidKeys = (constants.TRACE_SUITE_TRACE_EXEC, constants.TRACE_SUITE_PREP_EXEC, constants.TRACE_SUITE_POST_EXEC, constants.GMCPLAY_TEMPLATE[1:], constants.PYMESH_TEMPLATE[1:]) key = str(curVals[0]) if key in invalidKeys: raise argparse.ArgumentTypeError(f"Invalid key {key}. Do not use one of the following keys {invalidKeys}") key = "$" + key # check whether key is already specified if key in getattr(namespace, self.dest): raise argparse.ArgumentError(parser, f"Key {key} is already in list.") else: # add absolute path to dictionary getattr(namespace, self.dest)[key] = fileIO.getAbsoluteFilePath(curVals[1])
[docs]class AddBasePathAction(argparse.Action): """Action class to fill base path dictionary """ def __call__(self, parser, namespace, values, option_string=None): """Add key(s) to dictionary """ curValues = list() for elem in values: if elem and elem != "=": curValues.extend(elem.split("=")) if len(curValues) % 2: raise argparse.ArgumentTypeError(f"Tuples cannot be recognized. ({curValues})") for i in range(0, len(curValues), 2): key = str(curValues[i]).upper() if key[0] != "$": key = "$" + key # check whether key is already specified if key in getattr(namespace, self.dest): raise argparse.ArgumentError(parser, f"Key {key} is already in list.") else: # add absolute path to dictionary getattr(namespace, self.dest)[key] = os.path.abspath(curValues[i + 1])
[docs]def getParser(): """Parses the command line arguments and saves them in a options instance. All paths have to be converted to absolute paths in routine 'getOptionsFromParser'! :return: a options instance containing all command line arguments :rtype: options instance """ parser = argparse.ArgumentParser(prog="pavayo.py", description="Perform a test on TRACE.", formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=40, width=120)) parser.set_defaults(tecplotLicense=None) parser.add_argument("-i", "--input", dest="inputFile", help="read the selected XML file", required=False, metavar="PATH") parser.add_argument("-w", "--workingDirectory", dest="workingDirectory", help="path for the working directory", default=os.curdir, metavar="PATH") group_selection = parser.add_argument_group("Test case selection") group_selection.add_argument("--testLevel", dest="testLevel", nargs="+", help="The test level you want to execute (3 (default) = test suite, 5 = validation)", default=["3"], metavar="LEVEL") group_execs = parser.add_argument_group("Executables") group_execs.add_argument("--basePath", dest="basePathDict", nargs='+', action=AddBasePathAction, help="list of base paths ({key}=<path> or {key} [path]", default=dict(), metavar=("KEY", "PATH")) group_execs.add_argument("--traceSuite", dest="traceSuitePath", help="path to the TRACE suite folder", default=None, metavar="PATH") group_execs.add_argument("--trace", dest="tracePath", help="path of the TRACE executable", default=None, metavar="PATH") group_execs.add_argument("--prep", dest="prepPath", help="path of the PREP executable", default=None, metavar="PATH") group_execs.add_argument("--post", dest="postPath", help="path of the POST executable", default=None, metavar="PATH") group_execs.add_argument("--addExecutable", dest="additionalExecutables", nargs='+', action=AddExecutableAction, help="path to additional executables ({key}=<path> or {key} [path]", default=dict(), metavar=("KEY", "PATH")) group_execs.add_argument("-g", "--gmcplay", dest="gmcPlayPath", help="path of the GMC_PLAY executable", default="", metavar="PATH") group_execs.add_argument("--noFixedGmcPlay", dest="noFixedGmcPlayVersion", action="store_true", help="gmcPlay version may differ from the version stated in the XML file", default=False) group_execs.add_argument("--pymesh", dest="pyMeshPath", help="path of the PyMesh executable", default=constants.PYMESH_EXEC, metavar="PATH") group_execs.add_argument("--noFixedPyMesh", dest="noFixedPyMeshVersion", action="store_true", help="PyMesh version may differ from the version stated in the XML file", default=False) group_execs.add_argument("--debug", dest="useDebugExecs", action="store_true", help="use the *debug versions of the TRACE suite executables; only works in combination with '--traceSuitePath'", default=False) group_execs.add_argument("--passCommandLineArgument", dest="commandLineArguments", nargs=2, action="append", help="Specify a flag for an executable; Only works for the test level 3; NB: Do not include the leading dashes; only works for long options", default=list(), metavar=("EXECUTABLE", "ARGUMENT")) group_execs.add_argument("-tbp", "--useThreadsInsteadOfProcesses", dest="useThreadsInsteadOfProcesses", action="store_true", help="Use shared memory parallelization only for TRACE; Warning: this may lead to invalid configurations!", default=False) group_execution = parser.add_argument_group("Execution (at least one option mandatory)") group_execution.add_argument("-d", "--download", dest="download", action="store_true", help="download the test cases") group_execution.add_argument("-c", "--compute", dest="compute", action="store_true", help="do the computation ", default=False) group_execution.add_argument("-p", "--postProc", dest="post", action=PostProcAction, help="do the post processing and check the results against references", default=False) group_execution.add_argument("-l", "--latex", dest="latex", action="store_true", help="create the report file", default=False) group_execution.add_argument("-a", "--autorun", dest="autorun", action=AutorunAction, help="perform all steps and do it without interaction", default=False) group_execution.add_argument("--skipReferenceChecks", dest="skipReferenceChecks", action="store_true", help="skip check of tolerances of results against references", default=False) group_execution.add_argument("--show", dest="show", nargs="?", const=constants.SHOW_TESTCASES, help=f"show available test cases (By adding the optional argument {constants.SHOW_KEYWORDS} the test cases are listed by keywords.)", choices=[constants.SHOW_TESTCASES, constants.SHOW_KEYWORDS]) group_execution.add_argument("--showSelected", dest="showSelected", nargs="?", const=constants.SHOW_TESTCASES, help=f"show the selected test cases (By adding the optional argument {constants.SHOW_KEYWORDS} the test cases are listed by keywords.)", choices=[constants.SHOW_TESTCASES, constants.SHOW_KEYWORDS, constants.SHOW_SVN_STATUS]) group_execution.add_argument("-o", "--outputTestcases", dest="outputFileShow", nargs=1, metavar="PATH", help="select output file for test case list", default=None) group_execution.add_argument("--forceReferencePlots", dest="forceReferencePlots", action="store_true", help="force the creation of reference plots even if checks succeed", default=False) group_execution.add_argument("--evaluateReferences", dest="evaluateReferences", action="store_true", help="compare current against original references without running the testcases", default=False) group_selective_compute = parser.add_argument_group("Sub-set for the 'compute' step (expert options)") group_selective_compute.add_argument("--selectiveCompute", dest="selectiveCompute", action="append", nargs="+", metavar="SELECTIVE_COMPUTE", help="use the specified list of job names", default=None) group_selective_compute.add_argument("--step", dest="step", action="append", nargs="+", help="execute the specified steps for validiation test cases", default=None, choices=[constants.COMPUTATION_STEP_RESET, constants.COMPUTATION_STEP_GMC, constants.COMPUTATION_STEP_PREP, constants.COMPUTATION_STEP_TRACE, constants.COMPUTATION_STEP_POST]) group_selection.add_argument("-t", "--testcase", dest="testcaseList", action="append", nargs="+", metavar="TESTCASE", help="select specific test cases", default=list()) group_selection.add_argument("-T", "--testcasesFromStdin", dest="readTestcasesFromStdin", action="store_true", help="select specific test cases by reading them from stdin") group_management = parser.add_argument_group("Job management") group_management.add_argument("-A", "--account", dest="account", help="Account for cluster costs") group_management.add_argument("--queue", dest="queue", help="queue for the queueing system when running on a cluster", metavar="QUEUE", default=constants.DEFAULT_QUEUE) group_management.add_argument("-n", "--nodeType", dest="nodeType", help="Choose a node type", default="ib", choices=["ib", "w", "sb"]) group_management.add_argument("--np", dest="nprocs", help="number of processes", type=int, metavar="NUM", default=DEFAULT_RESOURCES[PROCESSORS]) group_management.add_argument("--numberOfThreadsPerProc", dest="threadsPerProc", type=int, help="number of threads per processor for all TRACE jobs", default=None, metavar="NUM") group_management.add_argument("--numberOfProcsPerNode", dest="procsPerNode", type=int, help="number of processors per node for all TRACE jobs", default=None, metavar="NUM") group_management.add_argument("--allowFewerProcs", dest="allowFewerProcs", action="store_true", help="If there are less processes available than a job asks for use fewer processes", default=False) # @todo: baye_fe, 2022-06-09: While trace/mojo#617 is not fixed job grouping is deactivated by default group_management.add_argument("--deactivateClusterJobGrouping", dest="deactivateClusterJobGrouping", action="store_true", help="deactivates simultaneous execution of small jobs on shared cluster nodes", default=True) group_management.add_argument("--slurmSwitches", dest="slurmSwitches", type=str, help="<count>[@minutes] requests a node allocation with at most <count> network switches within <minutes> by SLURM", default=None) parser.add_argument("--literatureDatabase", dest="literatureDatabase", help="Specify the path to the checked out literature data base", default=None, metavar="PATH") parser.add_argument("--unusedLiteratureDatabase", dest="unusedLiteratureDatabase", action="store_true", help="Mark the database as unnecessary for the run. It will not be downloaded.", default=False) parser.add_argument("-m", "--mail", dest="mailAddress", help="Mail address to send mail to when job is finished", default=None) # parser.add_argument("--dontExpurgate", dest = "dontExpurgate", action = "store_true", help = "do not expurgate previous test case output") parser.add_argument("-f", "--forceUpdate", dest="forceUpdate", action="store_true", help="force update of all specified test cases, only available on test level 2 and 3", default=False) group_selection.add_argument("--maxPriority", dest="specPriority", type=int, help="maximal priority of test cases to run; only available for the test suite", metavar="MAX_PRIORITY", default=sys.maxsize) group_selection.add_argument("--confidentiality", dest="confidentiality", nargs="+", action="append", help="select only test cases which are free for the given group", default=list(), metavar="ALLOW") group_selection.add_argument("--keyword", dest="keywords", nargs="+", action="append", help="only handle test cases with (or without; see '--exclude') this keyword", metavar="KEYWORD", default=list()) group_selection.add_argument("--exclude", dest="exclude", action="store_true", help="exclude test cases with the keywords specified via '--keyword'", default=False) group_selection.add_argument("--knownErrorsFile", dest="known_errors_file", type=str, help="Path to JSON file containing known errors") group_selection.add_argument("--knownErrorsSuiteName", dest="known_errors_suite_name", type=str, help="Name of the suite to use from the knownErrorsFile") group_modification = parser.add_argument_group("Modifying test cases and prepare Trace Suite for check in") group_modification.add_argument("--updateReferenceData", dest="updateReferenceData", action="store_true", help="update reference data of selected test cases: only available for the test suite", default=False) group_modification.add_argument("--updateRestartData", dest="updateRestartData", action="store_true", help="update restart data of selected test cases: only available for the test suite", default=False) group_modification.add_argument("--updateMeshData", dest="updateMeshData", action=UpdateMeshDataAction, help="update mesh data of selected test cases and activates --updateRestartData: only available for the test suite", default=False) group_modification.add_argument("--prepareTraceSuiteXMLforUpload", dest="prepareTraceSuiteXMLforUpload", action="store_true", help="modify the 'referenceTraceSuite' version string in the <testcase>.xml as prepararation for the check-in according to changes in the test cases", default=False) group_execution.add_argument("-u", "--uploadTestcases", dest="uploadTestcases", metavar='PATH', help="Upload test cases. Don't forget to specify a file with a check-in message.", default='') group_execution.add_argument("--failedJobsFile", dest="writeFailedJobs", metavar='PATH', help="Specify file for failed jobs output.", default='failedJobs.json') group_execution.add_argument("--junitXml", dest="writeJUnitXML", metavar='PATH', help="Specify file for a JUnit compatible XML file.", default='junit_pavayo.xml') group_execution.add_argument("--retriesComputation", dest="retriesComputation", metavar="N_RETRIES", type=int, help="Number of times every computation is retried.", default=0) parser.add_argument("--releaseReports", dest="releaseReports", action="append", nargs="+", help="Generate additional validation reports in consideration of the confidentiality", default=list()) group_tecplot = parser.add_argument_group("Tecplot") groupTecplot = group_tecplot.add_mutually_exclusive_group() groupTecplot.add_argument("--singleTecplotLicense", dest="tecplotLicense", action="store_const", help="only one tecplot license is available", const=1) groupTecplot.add_argument("--ntecplot", dest="tecplotLicense", type=int, help="specify arbitrary number of Tecplot licenses") group_code_analysis = parser.add_argument_group("Code Analysis") group_code_analysis.add_argument("--valgrind", dest="valgrind", action="store_true", help="run all executables under observation of valgrind (for a specific executable use option 'valgrindExec')", default=False) group_code_analysis.add_argument("--valgrindExec", dest="valgrindExec", action="append", nargs="+", help="specify which executables are observed by their exact name", metavar="VALGRIND_EXEC", default=list()) group_code_analysis.add_argument("--valgrindSuppFile", dest="valgrindSuppFile", help="specify your own valgrind suppression file", metavar="VALGRIND_SUPP_FILE", default=str()) group_code_analysis.add_argument("--includeSanitizerLogs", dest="includeSanitizers", action="store_true", default=False, help="Include the logs from GCC sanitizers in the report") group_svn = parser.add_argument_group("SVN") group_svn.add_argument("--sshUser", dest="sshuser", type=str, help="Specify a different SSH username for accessing the Testcase SVN", default=None) group_metrics = parser.add_argument_group("Metrics") group_metrics.add_argument("--saveTestCaseRuntimes", dest="testCaseRunTimes", help="Dump TestCase runtimes to stdout and to testCaseTimings.json", default=False, action="store_true") parser.add_argument("--verbosity", dest="verbose", type=int, help="level of verbosity (0 - minimal output, 1 - Jenkins, 2 - default, 3 - debug)", default=constants.STANDARD_VERBOSITY_LEVEL) parser.add_argument("--additionalProcessStatus", dest="additionalProcessStatus", action="store_true", help="activates further process status output (i.e. RUNNING..., DONE...) as formerly known", default=False) parser.add_argument("--outputOnError", dest="outputOnError", action="store_true", help="write the output of failed jobs to stdout if available", default=False) parser.add_argument("--version", "-v", action="version", version=getMojoVersion()) return parser
[docs]def getOptionsFromParser(parser=None, args=None): """Reads the command line options and prepares the options instance for pavayo. Performs some sanity checks on the options. :param parser: option instance providing all arguments :param args: Provide arguments for parser; if None sys.argv is used :type parser: argparse.ArgumentParser :type args: string list :return: option instance for pavayo :rtype: Namespace """ if parser is None: parser = getParser() options = parser.parse_args(args) # try to use default path for the xml file located in the folder trace_suite if options.traceSuitePath: options.basePathDict.setdefault(constants.TRACE_SUITE_PATH_ENVIRONMENT_NAME, options.traceSuitePath) if not options.inputFile: setattr(options, "inputFile", os.path.join(options.traceSuitePath, constants.TESTING_DATA_ROOT, constants.DEFAULT_XML_FILE_NAME)) # pretend ArgumentParser() behavior for .add_argument("-i", "--input", ..., required = True) if not options.inputFile: raise RuntimeError("pavayo.py: error: argument -i/--input is required") if options.valgrind: options.post = False options.updateReferenceData = False options.uploadTestcases = False options.prepareTraceSuiteXMLforUpload = False if not any([options.evaluateReferences, options.download, options.compute, options.post, options.latex, options.show, options.showSelected, options.uploadTestcases, options.prepareTraceSuiteXMLforUpload, options.updateRestartData, options.updateMeshData]): neccessaryOptionList = ['-d', '-c', '-p', '-l', '-a', '--show', '--showSelected', '--uploadTestcases', '--prepareTraceSuiteXMLforUpload', '--updateRestartData', '--updateMeshData', '--evaluateReferences'] raise RuntimeError("Error: You have to choose a step to perform. Please choose one or more options:\n'{opts}'".format(opts="', '".join(neccessaryOptionList))) if options.evaluateReferences and any([options.compute, options.post, options.uploadTestcases, options.prepareTraceSuiteXMLforUpload, options.updateRestartData, options.updateMeshData]): raise RuntimeError("Error: cannot use any other execution step while evaluating references!") if pysvn is None and (options.download or options.uploadTestcases or options.showSelected == constants.SHOW_SVN_STATUS): raise RuntimeError("You are missing pysvn! Therefore 'download', 'upload', and 'showSelected status' are not available.") # flatten lists of option lists options.testcaseList = [el for tcList in options.testcaseList for el in tcList] options.keywords = [el for keyList in options.keywords for el in keyList] options.selectiveCompute = [el for selComList in options.selectiveCompute for el in selComList] if options.selectiveCompute is not None else list() options.step = [el for stepList in options.step for el in stepList] if options.step is not None else list() options.valgrindExec = [el for execList in options.valgrindExec for el in execList] options.releaseReports = [el for allowList in options.releaseReports for el in allowList] options.confidentiality = [el for confidentialityList in options.confidentiality for el in confidentialityList] # read test cases from stdin if options.readTestcasesFromStdin: # -t and -T may not be used in conjunction if options.testcaseList: raise RuntimeError("Error: you have selected specific test cases (-t) and chosen to read test cases from stdin (-T), which is invalid.\nPlease remove either of those options.") # read the test case list from stdin, remove leading and trailing whitespace # and split it on one or more whitespace characters options.testcaseList = re.split(r'\s+', sys.stdin.read().strip()) # allow tc list with spaces and comma options.testcaseList = [_f for _f in ','.join(options.testcaseList).split(',') if _f] if options.known_errors_file and not options.known_errors_suite_name: raise RuntimeError("If specifying '--knownErrorsFile' a '--knownErrorsSuiteName' is required!") if options.known_errors_suite_name and options.known_errors_file is None: if not options.traceSuitePath: raise RuntimeError("If specifying '--knownErrorsSuiteName' you have to either specify '--knownErrorsFile' or a '--traceSuite'!") options.known_errors_file = os.path.join(os.path.abspath(options.traceSuitePath), "distrib/testing/known_errors.yaml") # test cases which are free for all should always be selected if options.confidentiality: options.confidentiality.append("all") if options.show is not None: options.show = options.show.lower() # attribute suite has to be set here to avoid problems in getSoftwaresVersionNumbers() setattr(options, "suiteName", "suiteName not set yet. The suiteName will be set after the parsing of the XML file!") fileIO.Printer.setVerbosity(options.verbose) # TODO: Move to another file # try to set absoulte file path for gmcPlay and PyMesh try: if not options.gmcPlayPath == "": options.gmcPlayPath = fileIO.getAbsoluteFilePath(options.gmcPlayPath) except RuntimeError: pass try: if options.pyMeshPath: options.pyMeshPath = fileIO.getAbsoluteFilePath(options.pyMeshPath, allowDirectories=True) if os.path.isdir(options.pyMeshPath) and os.path.isfile(os.path.join(options.pyMeshPath, constants.PYMESH_PATH_BIN)): options.pyMeshPath = os.path.join(options.pyMeshPath, constants.PYMESH_PATH_BIN) except RuntimeError: pass if options.valgrind: if not options.valgrindExec: options.valgrindExec = constants.EXECUTABLES_TO_RUN_WITH_VALGIRIND if not options.valgrindSuppFile and not options.traceSuitePath: raise RuntimeError("To run with valgrind specify either a trace_suite path or a valgrind supression file.") if not options.valgrindSuppFile: options.valgrindSuppFile = os.path.join(options.traceSuitePath, constants.TESTING_DATA_ROOT, constants.VALGRIND_SUPP_FILENAME) options.valgrindSuppFile = fileIO.getAbsoluteFilePath(options.valgrindSuppFile) else: options.valgrindExec = list() # always use abspath to prevent problems with the change of the working directory! options.inputFile = os.path.abspath(options.inputFile) if options.literatureDatabase: options.literatureDatabase = os.path.abspath(options.literatureDatabase) if options.uploadTestcases: options.uploadTestcases = os.path.abspath(options.uploadTestcases) if options.updateReferenceData or options.updateRestartData or options.updateMeshData or options.evaluateReferences: options.skipReferenceChecks = True options.configFilePath = constants.PATH_CONFIG_FILE # new variable to control whether the version tags are taken from the executables or the configuration files. options.getVersionsFromExecutable = any([options.compute, options.post, options.updateRestartData, options.updateMeshData]) return options
[docs]def printOptions(options, executableDict): """Method to give a overview over the selected options of PAVAYO. :param options: option parser instance to show :param executableDict: ExecutableResources :type options: Argparse :type executableDict: ExecutableResources """ INDENTATION = 18 print("{0:=^30}".format(" Options ")) print("{0: <{1}} {2}".format("XML file:", INDENTATION, options.inputFile)) print("{0: <{1}} {2}".format("Working directory:", INDENTATION, os.path.abspath(os.curdir))) if options.testcaseList: print("{0: <{1}} {2}".format("Selected cases:", INDENTATION, ", ".join(options.testcaseList))) else: print("{0: <{1}} {2}".format("Test level:", INDENTATION, ", ".join(options.testLevel))) if options.confidentiality: print("{0: <{1}} {2}".format("Allowances:", INDENTATION, ", ".join(options.confidentiality))) if options.keywords: if options.exclude: print("Exclude keywords.") print("{0: <{1}} {2}".format("Keywords:", INDENTATION, ", ".join(options.keywords))) if options.specPriority != sys.maxsize: print("{0: <{1}} {2}".format("Max priority:", INDENTATION, options.specPriority)) if options.selectiveCompute: print("{0: <{1}} {2}".format("Compute jobs:", INDENTATION, ", ".join(options.selectiveCompute))) if options.step: print("{0: <{1}} {2}".format("Compute steps:", INDENTATION, ", ".join(options.step))) if executableDict: print("") for name in sorted(executableDict.resourceDict): if executableDict[name].displayVersion: if not os.path.exists(executableDict[name].path) and executableDict[name].path not in [constants.GMC_PLAY_EXEC, constants.PYMESH_EXEC]: print("{0: <{1}} {3: <{1}} {2} (!!! was unable to resolve path !!!)".format(name.upper() + ":", INDENTATION, executableDict[name].path, executableDict[name].version)) else: print("{0: <{1}} {3!s: <{1}} {2}".format(name.upper() + ":", INDENTATION, executableDict[name].path, executableDict[name].version)) print("{0: <{1}} {3: <{1}} {2}".format("TECPLOT:", INDENTATION, fileIO.getAbsoluteFilePath(constants.TECPLOT_EXECUTABLE), getSoftwareVersionNumberString(constants.TECPLOT_EXECUTABLE, versionArgument='-v'))) print("") stepsList = list() if options.download: stepsList.append("download") if options.compute: if options.retriesComputation > 0: stepsList.append("compute ({0} {1})".format(options.retriesComputation, "retry" if options.retriesComputation == 1 else "retries")) else: stepsList.append("compute") if options.post: stepsList.append("postprocessing") if options.latex: stepsList.append("latex") if options.evaluateReferences: stepsList.append("evaluate references") if stepsList: print("{0: <{1}} {2}".format("Step{0}:".format("s" if len(stepsList) > 1 else ""), INDENTATION, ", ".join(stepsList))) if options.download and options.forceUpdate: print("The update of the test cases will be forced!") if options.literatureDatabase: print("Using a local literature database ('{0}')".format(options.literatureDatabase)) print("{0: <{1}} {2}".format("No of procs:", INDENTATION, options.nprocs)) if ClusterInfo.onValidCluster(): print("{0: <{1}} {2}".format("Queue:", INDENTATION, options.queue)) print("{0: <{1}} {2}".format("Node Type:", INDENTATION, options.nodeType)) if options.commandLineArguments: print("{0: <{1}} {2}".format("Passing args:", INDENTATION, "; ".join(("{0[0]} -> --{0[1]}".format(entry) for entry in options.commandLineArguments)))) print("{0: <{1}} {2}".format("tecplot lics:", INDENTATION, options.tecplotLicense if options.tecplotLicense else "unlimited")) print("{0: <{1}} {2}".format("Verbosity:", INDENTATION, options.verbose)) if options.known_errors_suite_name: print("\n{0: <{1}} {2}".format("Known errors file:", INDENTATION, options.known_errors_file)) print("{0: <{1}} {2}".format("Known errors suite name:", INDENTATION, options.known_errors_suite_name)) if (options.releaseReports and options.latex) or options.mailAddress: print("") if options.releaseReports and options.latex: print("Creating additional report{0} ({1})".format("s" if len(options.releaseReports) > 1 else "", ", ".join(options.releaseReports))) if options.mailAddress: print("Mailing the success status to '{0}'".format(options.mailAddress)) if options.allowFewerProcs: print("Allow fewer processes to be used than specified in the test case XML; WARNING: references may no longer be valid!") if options.valgrind: print("") print("Some executables will be run with valgrind ({0})".format(", ".join(options.valgrindExec))) print("Valgrind will use the suppression file '{0}'".format(options.valgrindSuppFile)) if options.updateReferenceData or options.updateRestartData or options.updateMeshData or options.prepareTraceSuiteXMLforUpload or options.uploadTestcases: stepsList = list() if options.updateReferenceData: stepsList.append("update of references") if options.updateMeshData: stepsList.append("re-create initial mesh") if options.updateRestartData: stepsList.append("re-compute restart data") if options.prepareTraceSuiteXMLforUpload: stepsList.append("modify TRACE Suite xml") if options.uploadTestcases: stepsList.append("upload") print("{0: <{1}} {2}".format("Update/Upload:", INDENTATION, ", ".join(stepsList)))
def getGmcPlayAbsolutePath(options, requiredGmcPlayVersion): requiredGmcPlayExecutableName = constants.GMC_PLAY_EXEC + "_v" + requiredGmcPlayVersion.replace(".", "_") requiredGmcPlayAbsolutePath = fileIO.getAbsoluteFilePath(requiredGmcPlayExecutableName) return requiredGmcPlayAbsolutePath