├── .gitignore ├── Copyright.txt ├── LICENSE.md ├── MANIFEST.in ├── PAV ├── __init__.py ├── hw.bash ├── modules │ ├── .project │ ├── .pydevproject │ ├── __init__.py │ ├── basejobcontroller.py │ ├── gz2pv.py │ ├── helperutilities.py │ ├── ldms.py │ ├── makebaselines.py │ ├── makeboxplots.py │ ├── moab_job_handler.py │ ├── moabjobcontroller.py │ ├── rawjobcontroller.py │ ├── runjob.py │ ├── slurm_job_handler.py │ ├── slurmjobcontroller.py │ ├── testConfig.py │ ├── testEntry.py │ └── testdaemon.py ├── pav ├── plugins │ ├── README.txt │ ├── convertGzTs2PvTs.py │ ├── convertGzTs2PvTs.yapsy-plugin │ ├── getResultsPlugin.py │ ├── getResultsPlugin.yapsy-plugin │ ├── runTestSuitePlugin.py │ ├── runTestSuitePlugin.yapsy-plugin │ ├── showEnvPlugin.py │ ├── showEnvPlugin.yapsy-plugin │ ├── viewTestSuitePlugin.py │ └── viewTestSuitePlugin.yapsy-plugin ├── pth ├── pvjobs ├── scripts │ ├── README │ ├── ReadBackwards.pm │ ├── blDiff │ ├── checkjob_getNodeList │ ├── chklg │ ├── defaultDaysAgo.py │ ├── find_test_dirs │ ├── findgrep │ ├── getCLENodeList │ ├── getCleNids │ ├── getNodeCoverage │ ├── getNodeList │ ├── getSLURMNodeList │ ├── get_results │ ├── jobReportcsv │ ├── listgrp │ ├── mkBaselines │ ├── mytime │ ├── pv_testMgr │ ├── showtd │ ├── splunk │ │ ├── README │ │ └── td2splunkData │ └── td2csvgdl └── special_pkgs │ ├── README.txt │ ├── __init__.py │ ├── yaml │ ├── __init__.py │ ├── composer.py │ ├── constructor.py │ ├── cyaml.py │ ├── dumper.py │ ├── emitter.py │ ├── error.py │ ├── events.py │ ├── loader.py │ ├── nodes.py │ ├── parser.py │ ├── reader.py │ ├── representer.py │ ├── resolver.py │ ├── scanner.py │ ├── serializer.py │ └── tokens.py │ └── yapsy │ ├── AutoInstallPluginManager.py │ ├── ConfigurablePluginManager.py │ ├── FilteredPluginManager.py │ ├── IPlugin.py │ ├── IPluginLocator.py │ ├── PluginFileLocator.py │ ├── PluginInfo.py │ ├── PluginManager.py │ ├── PluginManagerDecorator.py │ ├── VersionedPluginManager.py │ └── __init__.py ├── README.md ├── docs ├── Abstract.txt ├── Build-Notes.txt ├── DevelopmentGuidelines.txt ├── Example-default_test_config.yaml ├── Example-simple_test_config.yaml ├── Pavilion-Tutorial.docx ├── README.txt └── Requirements.txt ├── setup.cfg ├── setup.py ├── test ├── ConfigTests │ └── TestConfig │ │ ├── invalid_default.yaml │ │ ├── invalid_yaml.yaml │ │ ├── malformed_default.yaml │ │ └── yaml_test_config.py ├── PAV_tests.py └── __init__.py └── test_suites └── default_test_config.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /Copyright.txt: -------------------------------------------------------------------------------- 1 | # ################################################################### 2 | # 3 | # Disclaimer and Notice of Copyright 4 | # ================================== 5 | # 6 | # Copyright (c) 2015, Los Alamos National Security, LLC 7 | # All rights reserved. 8 | # 9 | # Copyright 2015. Los Alamos National Security, LLC. 10 | # This software was produced under U.S. Government contract 11 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 12 | # which is operated by Los Alamos National Security, LLC for 13 | # the U.S. Department of Energy. The U.S. Government has rights 14 | # to use, reproduce, and distribute this software. NEITHER 15 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 16 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 17 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 18 | # produce derivative works, such modified software should be 19 | # clearly marked, so as not to confuse it with the version 20 | # available from LANL. 21 | # 22 | # Additionally, redistribution and use in source and binary 23 | # forms, with or without modification, are permitted provided 24 | # that the following conditions are met: 25 | # 26 | # 1. Redistributions of source code must retain the 27 | # above copyright notice, this list of conditions 28 | # and the following disclaimer. 29 | # 2. Redistributions in binary form must reproduce the 30 | # above copyright notice, this list of conditions 31 | # and the following disclaimer in the documentation 32 | # and/or other materials provided with the distribution. 33 | # 3. Neither the name of Los Alamos National Security, LLC, 34 | # Los Alamos National Laboratory, LANL, the U.S. Government, 35 | # nor the names of its contributors may be used to endorse 36 | # or promote products derived from this software without 37 | # specific prior written permission. 38 | # 39 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 40 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 41 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 42 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 43 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 44 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 45 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 46 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 47 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 49 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 50 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 51 | # OF SUCH DAMAGE. 52 | # 53 | # ################################################################### 54 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Los Alamos National Lab 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of Pavilion nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include / Copyright.txt 2 | include PAV/pth 3 | include PAV/pav 4 | include PAV/pv* 5 | recursive-include PAV/ *.py 6 | include docs/*.txt 7 | include docs/*.yaml 8 | include docs/*.docx 9 | include test_suites/*.yaml 10 | include PAV/plugins/*.yapsy-plugin 11 | recursive-include PAV/scripts/ * 12 | include t1/*.bash 13 | include t1/i* 14 | recursive-include PAV/ README.* 15 | recursive-include test/ * 16 | exclude PAV/special_pkgs/mock.* 17 | exclude PAV/wasteland/* 18 | -------------------------------------------------------------------------------- /PAV/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/Pavilion/77fcf7446996a0292d0515a0dcee5024ccf8cc01/PAV/__init__.py -------------------------------------------------------------------------------- /PAV/hw.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo 'greetings earthling!' 4 | echo "er ... " 5 | echo "hello world!" 6 | sleep 2 7 | echo " pass" 8 | -------------------------------------------------------------------------------- /PAV/modules/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | pav2 4 | 5 | 6 | 7 | 8 | 9 | org.python.pydev.PyDevBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.python.pydev.pythonNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /PAV/modules/.pydevproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | python 2.7 4 | Default 5 | 6 | /${PROJECT_DIR_NAME}/pav1 7 | 8 | 9 | -------------------------------------------------------------------------------- /PAV/modules/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ['testConfig'] 2 | -------------------------------------------------------------------------------- /PAV/modules/gz2pv.py: -------------------------------------------------------------------------------- 1 | #!python 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | 57 | # convert line of old Gazebo test suite to stanza in Pavilion 58 | 59 | import yaml 60 | 61 | #name:=full-ibtest nodes:=4 pes:=64 tl:=00:05:00 pl:="ib_write_bw 100000 65536" count:=3 pct:=10 62 | 63 | data = {} 64 | 65 | data['full-ibtest'] = {} 66 | 67 | data['full-ibtest']['run'] = {} 68 | data['full-ibtest']['run']['count'] = 3 69 | data['full-ibtest']['run']['test_args'] = "ib_write_bw 100000 65536" 70 | 71 | 72 | data['full-ibtest']['moab'] = {} 73 | data['full-ibtest']['moab']['num_nodes'] = 4 74 | data['full-ibtest']['moab']['procs_per_node'] = 16 75 | data['full-ibtest']['moab']['time_limit'] = "00:05:00" 76 | data['full-ibtest']['moab']['pct'] = 10 77 | 78 | print yaml.dump(data, default_flow_style=False, indent=4) 79 | 80 | #with open('data.yml', 'w') as outfile: 81 | # outfile.write( yaml.dump(data, default_flow_style=False, indent=4) ) 82 | -------------------------------------------------------------------------------- /PAV/modules/helperutilities.py: -------------------------------------------------------------------------------- 1 | #!python 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | 57 | import os 58 | 59 | # implement linux "which" command 60 | # FWIW, python 3.3 offers shutil.which() 61 | def which(program): 62 | 63 | def is_exe(fpath): 64 | return os.path.isfile(fpath) and os.access(fpath, os.X_OK) 65 | 66 | fpath, fname = os.path.split(program) 67 | if fpath: 68 | if is_exe(program): 69 | return program 70 | else: 71 | for path in os.environ["PATH"].split(os.pathsep): 72 | path = path.strip('"') 73 | exe_file = os.path.join(path, program) 74 | if is_exe(exe_file): 75 | return exe_file 76 | 77 | return None 78 | -------------------------------------------------------------------------------- /PAV/modules/ldms.py: -------------------------------------------------------------------------------- 1 | #!python 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | 57 | """ plug-in that supports using the LDMS tool 58 | """ 59 | 60 | import os 61 | import subprocess 62 | import datetime 63 | import logging 64 | 65 | 66 | class LDMS(): 67 | 68 | def __init__(self, my_te): 69 | my_name = self.__class__.__name__ 70 | self.logger = logging.getLogger('pav.' + my_name) 71 | self.logger.info('initialize %s to run: ' % my_name) 72 | 73 | self.pid = str(os.getpid()) 74 | self.lh = my_name 75 | 76 | params = my_te.get_values() 77 | self.name = my_te.get_name() 78 | self.install_dir = str(params['ldms']['install_dir']) 79 | self.start_cmd = str(params['ldms']['start_cmd']) 80 | self.output_dir_root = str(params['ldms']['output_dir_root']) 81 | self.freq = params['ldms']['freq'] 82 | self.metric_list = str(params['ldms']['metric_list']) 83 | 84 | self.output_dir = self.create_output_dir() 85 | self.build_start_cmd() 86 | 87 | def create_output_dir(self): 88 | # This dir must be created before LDMS can start and should 89 | # be unique so that each new test run does not stomp on 90 | # existing data from a prior one. 91 | 92 | sub_dir = self.name + "-" + datetime.datetime.now().strftime('%m-%d-%YT%H:%M:%S:%f') 93 | if "HOME" in self.output_dir_root: 94 | root = os.environ['HOME'] 95 | else: 96 | root = self.output_dir_root 97 | output_dir = root + "/ldmsData/" + sub_dir 98 | 99 | self.logger.info(self.lh + " Make metrics directory: " + output_dir) 100 | try: 101 | os.umask(0o002) 102 | os.makedirs(output_dir, 0o755) 103 | except OSError: 104 | print " Error creating metrics directory : \n\t" + output_dir 105 | self.logger.info(self.lh + " Error creating metrics directory : \n\t" + output_dir) 106 | output_dir = '' 107 | pass 108 | 109 | print "Created ldms metrics dir: " + output_dir 110 | 111 | os.environ['LDMS_OUTPUT_DIR'] = output_dir 112 | return output_dir 113 | 114 | def build_start_cmd(self): 115 | full_cmd = self.install_dir + "/" + self.start_cmd 116 | full_cmd += " -f " + str(self.freq) 117 | full_cmd += " -m " + self.metric_list 118 | full_cmd += " -s " + self.output_dir 119 | os.environ['LDMS_START_CMD'] = full_cmd 120 | 121 | # define some static methods for LDMS job control 122 | 123 | @staticmethod 124 | def start(): 125 | # start and don't wait. Report success or fail in the log(s). 126 | outfile = os.environ['LDMS_OUTPUT_DIR'] + "/ldms.out" 127 | print " starting LDMS with: \n " + os.environ['LDMS_START_CMD'] 128 | 129 | text_file = open(outfile, "w") 130 | try: 131 | subprocess.Popen(os.environ['LDMS_START_CMD'], stdout=text_file, stdin=open(os.devnull), shell=True) 132 | except subprocess.CalledProcessError as e: 133 | ret = e.returncode 134 | if ret in (1, 2): 135 | print("the command failed") 136 | elif ret in (3, 4, 5): 137 | print("the command failed very much") 138 | pass 139 | 140 | @staticmethod 141 | def status(jid): 142 | pass 143 | 144 | @staticmethod 145 | def stop(jid): 146 | pass 147 | 148 | if __name__ == "__main__": 149 | print LDMS.__doc__ 150 | -------------------------------------------------------------------------------- /PAV/modules/makebaselines.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | 4 | # ################################################################### 5 | # 6 | # Disclaimer and Notice of Copyright 7 | # ================================== 8 | # 9 | # Copyright (c) 2015, Los Alamos National Security, LLC 10 | # All rights reserved. 11 | # 12 | # Copyright 2015. Los Alamos National Security, LLC. 13 | # This software was produced under U.S. Government contract 14 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 15 | # which is operated by Los Alamos National Security, LLC for 16 | # the U.S. Department of Energy. The U.S. Government has rights 17 | # to use, reproduce, and distribute this software. NEITHER 18 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 19 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 20 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 21 | # produce derivative works, such modified software should be 22 | # clearly marked, so as not to confuse it with the version 23 | # available from LANL. 24 | # 25 | # Additionally, redistribution and use in source and binary 26 | # forms, with or without modification, are permitted provided 27 | # that the following conditions are met: 28 | # - Redistributions of source code must retain the 29 | # above copyright notice, this list of conditions 30 | # and the following disclaimer. 31 | # - Redistributions in binary form must reproduce the 32 | # above copyright notice, this list of conditions 33 | # and the following disclaimer in the documentation 34 | # and/or other materials provided with the distribution. 35 | # - Neither the name of Los Alamos National Security, LLC, 36 | # Los Alamos National Laboratory, LANL, the U.S. Government, 37 | # nor the names of its contributors may be used to endorse 38 | # or promote products derived from this software without 39 | # specific prior written permission. 40 | # 41 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 42 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 43 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 44 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 45 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 46 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 47 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 48 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 49 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 51 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 52 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 53 | # OF SUCH DAMAGE. 54 | # 55 | # ################################################################### 56 | 57 | 58 | """ Make base line result averages from the output of the get_results command 59 | """ 60 | 61 | 62 | # Input: stdin stream of lines with, hopefully, trend data lines included 63 | # ex. of an input line that will be matched: 64 | # Test4.2x32(10 1024) jid(109959) 2014-09-04T08:43:22-0600 avg_iterTime 0.002910 sec 65 | # then morphed down to: 66 | # Test4.2x32(10 1024) avg_iterTime 0.002910 sec 67 | # Output: 68 | 69 | import sys 70 | import re 71 | 72 | print "Making baseline averages with data from:" 73 | for line in sys.stdin: 74 | searchObj = re.search(r'jid\(', line, re.M | re.I) 75 | if searchObj: 76 | # Do some substitution work here, see comments above 77 | #info = re.sub(r'\S*jid.*-\d+\s', "", line) 78 | info = re.sub(r'\S*jid.*:[\d-]+\s', "", line) 79 | print info, 80 | 81 | if __name__ == '__main__': 82 | sys.exit() 83 | -------------------------------------------------------------------------------- /PAV/modules/rawjobcontroller.py: -------------------------------------------------------------------------------- 1 | #!python 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | 57 | """ Implementation raw Job Control mechanism """ 58 | 59 | import sys 60 | import os 61 | import platform 62 | import subprocess 63 | from basejobcontroller import JobController 64 | 65 | 66 | class RawJobController(JobController): 67 | """ class to run a test using no scheduler or special launcher """ 68 | 69 | def start(self): 70 | 71 | # create own unique working space for this run 72 | #self.setup_working_space() 73 | 74 | # print the common log settings here right after the job is started 75 | self.save_common_settings() 76 | 77 | # store some info into ENV variables that jobs may need to use later on. 78 | self.setup_job_info() 79 | 80 | # what nodes(s) are this job running on... 81 | nodes = platform.node().partition('.')[0] 82 | os.environ['PV_NODES'] = nodes 83 | os.environ['GZ_NODES'] = os.environ['PV_NODES'] 84 | print " " + nodes + "\n" 85 | 86 | self.logger.info(self.lh + " : args=" + str(self.configs['run']['test_args'])) 87 | 88 | # build the exact command to run 89 | cmd = "cd " + os.environ['PV_RUNHOME'] + "; " + \ 90 | os.environ['PVINSTALL'] + "/PAV/scripts/mytime ./" + self.configs['run']['cmd'] 91 | print "\n -> RawJobController: invoke %s" % cmd 92 | 93 | # Get any buffered output into the output file now 94 | # so that the the order doesn't look all mucked up 95 | sys.stdout.flush() 96 | 97 | # Invoke the cmd and send the output to the file setup when 98 | # the object was instantiated 99 | 100 | self.logger.info(self.lh + " run: " + cmd) 101 | p = subprocess.Popen(cmd, stdout=self.job_log_file, stderr=self.job_log_file, shell=True) 102 | # wait for the subprocess to finish 103 | output, errors = p.communicate() 104 | 105 | if p.returncode or errors: 106 | print "Error: something went wrong!" 107 | print [p.returncode, errors, output] 108 | self.logger.info(self.lh + " run error: " + errors) 109 | 110 | # The post_complete file needs to be placed in the results dir 111 | # for Gazebo compatibility 112 | pcf = os.environ["PV_JOB_RESULTS_LOG_DIR"] + "/post_complete" 113 | text_file = open(pcf, "w") 114 | text_file.write("{}\n".format("command complete")) 115 | self.run_epilog() 116 | text_file.write("{}\n".format("epilog complete")) 117 | self.cleanup() 118 | text_file.write("{}\n".format("cleanup complete")) 119 | text_file.close() 120 | 121 | print "", self.now() 122 | 123 | # The trend_data file needs to be placed in the results dir 124 | # for Gazebo compatibility 125 | JobController.process_trend_data() 126 | 127 | # this gets called if it's run as a script/program 128 | if __name__ == '__main__': 129 | 130 | sys.exit() 131 | -------------------------------------------------------------------------------- /PAV/modules/slurm_job_handler.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | import sys 57 | import os 58 | from subprocess import Popen, PIPE 59 | import subprocess 60 | import shutil 61 | import platform 62 | import datetime 63 | 64 | newpath = os.environ['PVINSTALL'] + "/PAV/modules" 65 | sys.path.append(newpath) 66 | from basejobcontroller import JobController 67 | from ldms import LDMS 68 | 69 | def now(): 70 | return " " + datetime.datetime.now().strftime("%m-%d-%YT%H:%M:%S") 71 | 72 | from contextlib import contextmanager 73 | @contextmanager 74 | def stdout_redirected(new_stdout): 75 | save_stdout = sys.stdout 76 | sys.stdout = new_stdout 77 | try: 78 | yield None 79 | finally: 80 | sys.stdout = save_stdout 81 | 82 | def get_node_list(): 83 | if "SLURM_JOBID" in os.environ: 84 | os.environ['PV_JOBID'] = os.environ.get("SLURM_JOBID") 85 | output = subprocess.check_output("scontrol show hostnames \"$SLURM_NODELIST\" | tr '\n' ','", shell=True) 86 | nodes = output.replace('\n', "") 87 | nodes = nodes.replace(',', " ") 88 | else: 89 | nodes = platform.node() 90 | return str(nodes) 91 | 92 | def main(): 93 | """ 94 | calls the user's job script/program. 95 | Will also start LDMS if requested. 96 | """ 97 | 98 | cmd = "cd " + os.environ['PV_RUNHOME'] + "; " + \ 99 | os.environ['PVINSTALL'] + "/PAV/scripts/mytime " + os.environ['USER_CMD'] 100 | 101 | nodes = get_node_list() 102 | os.environ['PV_NODES'] = nodes 103 | os.environ['GZ_NODES'] = os.environ['PV_NODES'] 104 | job_log_file = os.environ["PV_JOB_RESULTS_LOG"] 105 | 106 | with open(job_log_file, 'a') as lf: 107 | with stdout_redirected(lf): 108 | 109 | #redirect STDERR to the same file 110 | sys.stderr = lf 111 | 112 | print " " + nodes + "\n" 113 | print "slurm_job_handler: " 114 | 115 | # start LDMS here if requested! The start command ought to be 116 | # defined, so let's go! 117 | try: 118 | if os.environ['LDMS_START_CMD']: 119 | print "start ldms! " 120 | LDMS.start() 121 | except KeyError, e: 122 | #print 'I got a KeyError - no: "%s"' % str(e) 123 | pass 124 | 125 | print "", now() 126 | print " start job with: \n " + cmd 127 | lf.flush() 128 | 129 | # Call the command that runs the users test/job 130 | # This works with job_out_file = /users/cwi/mystdout 131 | #subprocess.call(cmd1, stdout=job_out_file, shell=True) 132 | 133 | subprocess.call(cmd, stdout=lf, stderr=lf, shell=True) 134 | 135 | # The post_complete file needs to be placed in the results dir 136 | # for Gazebo compatibility 137 | pcf = os.environ["PV_JOB_RESULTS_LOG_DIR"] + "/post_complete" 138 | text_file = open(pcf, "w") 139 | text_file.write("{}\n".format("command complete")) 140 | JobController.run_epilog() 141 | text_file.write("{}\n".format("epilog complete")) 142 | JobController.cleanup() 143 | text_file.write("{}\n".format("cleanup complete")) 144 | text_file.close() 145 | 146 | print "", now() 147 | lf.flush() 148 | 149 | # The trend_data file needs to be placed in the results dir 150 | # for Gazebo compatibility 151 | JobController.process_trend_data() 152 | 153 | 154 | # this gets called if it's run as a script/program 155 | if __name__ == '__main__': 156 | sys.exit(main()) 157 | -------------------------------------------------------------------------------- /PAV/modules/testdaemon.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | 4 | # ################################################################### 5 | # 6 | # Disclaimer and Notice of Copyright 7 | # ================================== 8 | # 9 | # Copyright (c) 2015, Los Alamos National Security, LLC 10 | # All rights reserved. 11 | # 12 | # Copyright 2015. Los Alamos National Security, LLC. 13 | # This software was produced under U.S. Government contract 14 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 15 | # which is operated by Los Alamos National Security, LLC for 16 | # the U.S. Department of Energy. The U.S. Government has rights 17 | # to use, reproduce, and distribute this software. NEITHER 18 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 19 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 20 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 21 | # produce derivative works, such modified software should be 22 | # clearly marked, so as not to confuse it with the version 23 | # available from LANL. 24 | # 25 | # Additionally, redistribution and use in source and binary 26 | # forms, with or without modification, are permitted provided 27 | # that the following conditions are met: 28 | # - Redistributions of source code must retain the 29 | # above copyright notice, this list of conditions 30 | # and the following disclaimer. 31 | # - Redistributions in binary form must reproduce the 32 | # above copyright notice, this list of conditions 33 | # and the following disclaimer in the documentation 34 | # and/or other materials provided with the distribution. 35 | # - Neither the name of Los Alamos National Security, LLC, 36 | # Los Alamos National Laboratory, LANL, the U.S. Government, 37 | # nor the names of its contributors may be used to endorse 38 | # or promote products derived from this software without 39 | # specific prior written permission. 40 | # 41 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 42 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 43 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 44 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 45 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 46 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 47 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 48 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 49 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 51 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 52 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 53 | # OF SUCH DAMAGE. 54 | # 55 | # ################################################################### 56 | 57 | 58 | ''' a test of how to deamonize a program ''' 59 | 60 | import daemon 61 | import time 62 | import sys,os 63 | 64 | def do_something(): 65 | print sys.argv 66 | while True: 67 | with open("/tmp/td.txt", "w") as f: 68 | f.write("The time is now " + time.ctime()) 69 | time.sleep(5) 70 | 71 | 72 | def main(): 73 | # set up log file 74 | here = os.path.dirname(os.path.abspath(__file__)) 75 | try: 76 | log = open('td.log', 'w+') 77 | except: 78 | print "Error, can't open log file td.log" 79 | #print dir(daemon) 80 | with daemon.DaemonContext(working_directory=here, pidfile='/tmp/td.pid', stdout=log, stderr=log): 81 | do_something() 82 | 83 | if __name__ == "__main__": 84 | main() 85 | #sys.exit(main(sys.argv[1:])) 86 | -------------------------------------------------------------------------------- /PAV/pav: -------------------------------------------------------------------------------- 1 | pth -------------------------------------------------------------------------------- /PAV/plugins/README.txt: -------------------------------------------------------------------------------- 1 | # ################################################################### 2 | # 3 | # Disclaimer and Notice of Copyright 4 | # ================================== 5 | # 6 | # Copyright (c) 2015, Los Alamos National Security, LLC 7 | # All rights reserved. 8 | # 9 | # Copyright 2015. Los Alamos National Security, LLC. 10 | # This software was produced under U.S. Government contract 11 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 12 | # which is operated by Los Alamos National Security, LLC for 13 | # the U.S. Department of Energy. The U.S. Government has rights 14 | # to use, reproduce, and distribute this software. NEITHER 15 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 16 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 17 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 18 | # produce derivative works, such modified software should be 19 | # clearly marked, so as not to confuse it with the version 20 | # available from LANL. 21 | # 22 | # Additionally, redistribution and use in source and binary 23 | # forms, with or without modification, are permitted provided 24 | # that the following conditions are met: 25 | # 26 | # 1. Redistributions of source code must retain the 27 | # above copyright notice, this list of conditions 28 | # and the following disclaimer. 29 | # 2. Redistributions in binary form must reproduce the 30 | # above copyright notice, this list of conditions 31 | # and the following disclaimer in the documentation 32 | # and/or other materials provided with the distribution. 33 | # 3. Neither the name of Los Alamos National Security, LLC, 34 | # Los Alamos National Laboratory, LANL, the U.S. Government, 35 | # nor the names of its contributors may be used to endorse 36 | # or promote products derived from this software without 37 | # specific prior written permission. 38 | # 39 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 40 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 41 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 42 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 43 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 44 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 45 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 46 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 47 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 49 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 50 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 51 | # OF SUCH DAMAGE. 52 | # 53 | # ################################################################### 54 | 55 | This directory contains code that is intended to be a sub-command(s) to the Pavilion CLI. 56 | It's located here merely by convention so the Pavilion knows where to look for these 57 | special Yapsy related files/programs. 58 | -------------------------------------------------------------------------------- /PAV/plugins/convertGzTs2PvTs.yapsy-plugin: -------------------------------------------------------------------------------- 1 | [Core] 2 | Name = gzts2pvtsPlugin 3 | Module = convertGzTs2PvTs 4 | 5 | [Documentation] 6 | Author = Phil Romero 7 | Version = 0.02 8 | Website = http://lotsofplugins.com 9 | Description = Convert a gazebo test suite file into a Pavilion test suite file 10 | -------------------------------------------------------------------------------- /PAV/plugins/getResultsPlugin.yapsy-plugin: -------------------------------------------------------------------------------- 1 | [Core] 2 | Name = getResults 3 | Module = getResultsPlugin 4 | 5 | [Documentation] 6 | Author = Craig Idler 7 | Version = 0.1 8 | Website = http://pavilion.org 9 | Description = Plugin that implements a function to get the results of test runs 10 | -------------------------------------------------------------------------------- /PAV/plugins/runTestSuitePlugin.yapsy-plugin: -------------------------------------------------------------------------------- 1 | [Core] 2 | Name = runTestSuite 3 | Module = runTestSuitePlugin 4 | 5 | [Documentation] 6 | Author = Craig Idler 7 | Version = 0.1 8 | Website = http://pavilion.org 9 | Description = Plugin that implements a function to run/launch test jobs (called suites) 10 | -------------------------------------------------------------------------------- /PAV/plugins/showEnvPlugin.py: -------------------------------------------------------------------------------- 1 | #!python 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | 57 | """ plug-in to display ENV parameters created 58 | """ 59 | 60 | import os,sys 61 | import subprocess 62 | import logging 63 | from yapsy.IPlugin import IPlugin 64 | 65 | 66 | class ShowEnv(IPlugin): 67 | """ This implements the plug-in, or command, to 68 | display what ENV parameters are created. 69 | """ 70 | 71 | def __init__(self): 72 | my_name = self.__class__.__name__ 73 | 74 | # If you want the log output from this class to reside in the 75 | # main (pav) log file you tack it's name onto the pav name space 76 | self.logger = logging.getLogger('pav.' + my_name) 77 | self.logger.info('created instance of plugin: %s'% my_name) 78 | 79 | # Every plugin class MUST have a method by the name "add_parser_info 80 | # and must return the name of the this sub-command 81 | 82 | def add_parser_info(self, subparser): 83 | parser_rts = subparser.add_parser("show_env", help="show ENV variables setup and/or used by Pavilion") 84 | parser_rts.set_defaults(sub_cmds='show_env') 85 | return 'show_env' 86 | 87 | # Every plug-in (command) MUST have a method by the name "cmd". 88 | # It will be what is called when that command is selected. 89 | def cmd(self, args): 90 | 91 | if args['verbose']: 92 | print "Command args -> %s" % args 93 | 94 | print "\n" + " ---------- start ENV output -------------" 95 | root = os.environ['PVINSTALL'] 96 | #print "my root is - " + root 97 | cmd = root + "/PAV/scripts/findgrep " + root + "/PAV -c '# ++' |" \ 98 | "grep '# ++' | grep -v grep | cut -d' ' -f 3- | sed -e 's/.*++//g' | sort -u" 99 | subprocess.call(cmd, shell=True) 100 | 101 | print " ---------- end ENV output -------------" 102 | sys.exit() 103 | 104 | 105 | if __name__ == "__main__": 106 | print ShowEnv.__doc__ 107 | -------------------------------------------------------------------------------- /PAV/plugins/showEnvPlugin.yapsy-plugin: -------------------------------------------------------------------------------- 1 | [Core] 2 | Name = showEnv 3 | Module = showEnvPlugin 4 | 5 | [Documentation] 6 | Author = Craig Idler 7 | Version = 0.1 8 | Website = http://pavilion.org 9 | Description = Display all ENV params made available to Pavilion users 10 | -------------------------------------------------------------------------------- /PAV/plugins/viewTestSuitePlugin.py: -------------------------------------------------------------------------------- 1 | #!python 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | 57 | """ plug-in to view the test suite configurations 58 | """ 59 | 60 | import os,sys 61 | import logging 62 | from yapsy.IPlugin import IPlugin 63 | from testConfig import YamlTestConfig 64 | 65 | 66 | class ViewTestSuite(IPlugin): 67 | """ This implements the plug-in, or command, to view the default, user, and 68 | effective (combined) test suite configuration files. 69 | """ 70 | 71 | def __init__(self): 72 | my_name = self.__class__.__name__ 73 | 74 | # If you want the log output from this class to reside in the 75 | # main (pav) log file you tack it's name onto the pav name space 76 | self.logger = logging.getLogger('pav.' + my_name) 77 | self.logger.info('created instance of plugin: %s'% my_name) 78 | 79 | # Every plugin class MUST have a method by the name "add_parser_info 80 | # and must return the name of the this sub-command 81 | 82 | def add_parser_info(self, subparser): 83 | parser_rts = subparser.add_parser("view_test_suite", 84 | help="view test suite config files (user, default, and combined)") 85 | parser_rts.add_argument('testSuite', help='test-suite-config-file') 86 | parser_rts.add_argument('-d', "--dict", help='show in dictionary format (yaml default)', action="store_true") 87 | parser_rts.set_defaults(sub_cmds='view_test_suite') 88 | return ('view_test_suite') 89 | 90 | # Every plug-in (command) MUST have a method by the name "cmd". 91 | # It will be what is called when that command is selected. 92 | def cmd(self, args): 93 | 94 | if args['verbose']: 95 | print "Command args -> %s" % args 96 | #print "input test suite file -> %s\n" % args['testSuite'] 97 | 98 | if (os.path.isfile(args['testSuite'])): 99 | with open(args['testSuite']) as file: 100 | # Build the test configuration 101 | tc = YamlTestConfig(args['testSuite']) 102 | 103 | if args['dict']: 104 | 105 | print "\nUser test suite configuration (dict style):" 106 | print tc.user_config_doc 107 | 108 | print "\nDefault test suite configuration (dict style):" 109 | print tc.default_config_doc 110 | 111 | print "\nEffective test configuration (dict style, combined User and Default):" 112 | print tc.get_effective_config_file() 113 | 114 | else: 115 | 116 | print "\nUser test suite configuration (yaml style):" 117 | tc.show_user_test_config() 118 | 119 | print "\nDefault test suite configuration (yaml style):" 120 | tc.show_default_config() 121 | 122 | print "\nEffective test suite configuration (yaml style, combined User and Default):" 123 | tc.show_effective_config_file() 124 | 125 | else: 126 | print " Error: could not find test suite %s" % args['testSuite'] 127 | sys.exit() 128 | 129 | 130 | if __name__=="__main__": 131 | print ViewTestSuite.__doc__ 132 | -------------------------------------------------------------------------------- /PAV/plugins/viewTestSuitePlugin.yapsy-plugin: -------------------------------------------------------------------------------- 1 | [Core] 2 | Name = ViewTestSuite 3 | Module = viewTestSuitePlugin 4 | 5 | [Documentation] 6 | Author = Craig Idler 7 | Version = 0.1 8 | Website = http://pavilion.org 9 | Description = Plugin to view test suite configuration 10 | -------------------------------------------------------------------------------- /PAV/pth: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Pavilion Cluster Test Harness (main module)""" 3 | 4 | # ################################################################### 5 | # 6 | # Disclaimer and Notice of Copyright 7 | # ================================== 8 | # 9 | # Copyright (c) 2015, Los Alamos National Security, LLC 10 | # All rights reserved. 11 | # 12 | # Copyright 2015. Los Alamos National Security, LLC. 13 | # This software was produced under U.S. Government contract 14 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 15 | # which is operated by Los Alamos National Security, LLC for 16 | # the U.S. Department of Energy. The U.S. Government has rights 17 | # to use, reproduce, and distribute this software. NEITHER 18 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 19 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 20 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 21 | # produce derivative works, such modified software should be 22 | # clearly marked, so as not to confuse it with the version 23 | # available from LANL. 24 | # 25 | # Additionally, redistribution and use in source and binary 26 | # forms, with or without modification, are permitted provided 27 | # that the following conditions are met: 28 | # 29 | # 1. Redistributions of source code must retain the 30 | # above copyright notice, this list of conditions 31 | # and the following disclaimer. 32 | # 2. Redistributions in binary form must reproduce the 33 | # above copyright notice, this list of conditions 34 | # and the following disclaimer in the documentation 35 | # and/or other materials provided with the distribution. 36 | # 3. Neither the name of Los Alamos National Security, LLC, 37 | # Los Alamos National Laboratory, LANL, the U.S. Government, 38 | # nor the names of its contributors may be used to endorse 39 | # or promote products derived from this software without 40 | # specific prior written permission. 41 | # 42 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 43 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 44 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 45 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 46 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 47 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 48 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 49 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 50 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 51 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 52 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 53 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 54 | # OF SUCH DAMAGE. 55 | # 56 | # ################################################################### 57 | 58 | import sys 59 | import os 60 | import getpass 61 | import re 62 | 63 | if sys.version_info[0] != 2 or sys.version_info[1] < 7: 64 | sys.exit("Python 2.7 is required to run Pavilion") 65 | 66 | sys.path.append(os.path.join(os.path.dirname(__file__), "./special_pkgs")) 67 | # support creating Python style command line interfaces 68 | import argparse 69 | 70 | # support for dynamically loading new features/commands from a "plugins" directory 71 | from yapsy.PluginManager import PluginManager 72 | 73 | 74 | # initialize and set up the pavilion master log file 75 | me = getpass.getuser() 76 | mlf = "/tmp/" + me + "/pav.log" 77 | # ++ PV_LOG : Master log file 78 | master_log_file = os.getenv('PV_LOG', mlf) 79 | os.environ['PV_LOG'] = master_log_file 80 | try: 81 | if not os.path.exists(os.path.dirname(master_log_file)): 82 | os.makedirs(os.path.dirname(master_log_file)) 83 | except OSError: 84 | sys.exit("Error: badly formatted master_log_file value (needs a path), exiting!") 85 | 86 | # set up logging 87 | import logging 88 | logger = logging.getLogger('pav') 89 | logger.setLevel(logging.DEBUG) 90 | formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') 91 | # make sure we can write to the master log file 92 | try: 93 | fh = logging.FileHandler(filename = master_log_file) 94 | except IOError: 95 | sys.exit("Error: no permission to write to master_log_file, exiting!") 96 | 97 | 98 | fh.setFormatter(formatter) 99 | logger.addHandler(fh) 100 | 101 | logy = logging.getLogger('yapsy') 102 | logy.setLevel(logging.INFO) 103 | logy.addHandler(fh) 104 | 105 | # look for modules relative to where this program is located 106 | sys.path.append(os.path.join(os.path.dirname(__file__), "./modules")) 107 | 108 | 109 | # stub foo sub-command implemented in the main 110 | def foo(): 111 | print "running foo" 112 | 113 | 114 | # def usage(): 115 | # print __doc__ 116 | 117 | 118 | def print_version(): 119 | setup_file = os.environ['PVINSTALL'] + "/setup.py" 120 | setup_config_file = open(setup_file, 'r') 121 | matches = re.findall("'version':\s+'(.+)',", setup_config_file.read(), re.MULTILINE) 122 | print "\nPavilion Version -> " + matches[0] 123 | setup_config_file.close() 124 | 125 | 126 | def main(): 127 | """Main entry point for the test harness.""" 128 | 129 | func_map = {} 130 | 131 | # construct main input arguments 132 | parser = argparse.ArgumentParser(prog="pav") 133 | subparser = parser.add_subparsers(title="commands", help='sub-commands') 134 | parser.add_argument("-v", "--verbose", help="provide verbose output", action="store_true") 135 | #parser_foo = subparser.add_parser('foo', help="foo help message") 136 | #parser_foo.set_defaults(sub_cmds='foo') 137 | 138 | print_version() 139 | print "Running from -> %s" % os.environ['PVINSTALL'] + "/PAV" 140 | print "Logging to -> %s" % master_log_file + "\n" 141 | 142 | # Dynamic support for adding commands... 143 | # Find and load the sub-commands (plug-ins) and their arguments 144 | 145 | # Build the manager 146 | plug_man = PluginManager() 147 | # Inform where to find plug-ins 148 | # User can add more places to look by setting ENV PV_PLUGIN_DIR 149 | # ++ PVINSTALL : Installation root of Pavilion (actually set by the user) 150 | plugin_dir = os.environ['PVINSTALL'] + "/PAV" + "/plugins" 151 | plugin_places = [plugin_dir] 152 | # ++ PV_PLUGIN_DIR : Path where Pavilion searches for addition plugins (commands) 153 | if os.environ.get('PV_PLUGIN_DIR'): 154 | plugin_places.append(os.environ.get('PV_PLUGIN_DIR')) 155 | plug_man.setPluginPlaces(plugin_places) 156 | # Load all the plug-ins 157 | logger.info('Loading plugins') 158 | plug_man.collectPlugins() 159 | 160 | # create a hash that maps all sub-commands to their respective function call 161 | for pluginInfo in plug_man.getAllPlugins(): 162 | 163 | try: 164 | # let new functions add their own args to the help line 165 | func = pluginInfo.plugin_object.add_parser_info(subparser) 166 | # dictionary of function name to object mapping 167 | func_map[func] = pluginInfo.plugin_object 168 | except: 169 | print "Error using add_help_info method for %s" % pluginInfo.plugin_object 170 | 171 | # turn the input arguments into a dictionary 172 | args = vars(parser.parse_args()) 173 | # record the command line selections 174 | logger.info('cmd line args: %s' % args) 175 | 176 | # Process sub-commands, most of which should be found 177 | # in the plug-ins directory. 178 | print " Invoke command: -> " + args['sub_cmds'] 179 | if args['sub_cmds'] == 'foo': 180 | foo() 181 | else: 182 | # invoke the cmd method of the object (plugin) that corresponds to 183 | # the command selected 184 | getattr(func_map[args['sub_cmds']], 'cmd')(args) 185 | 186 | 187 | # this gets called if it's run as a script/program 188 | if __name__ == '__main__': 189 | # pass entire command line to main except for the command name 190 | sys.exit(main()) 191 | -------------------------------------------------------------------------------- /PAV/scripts/README: -------------------------------------------------------------------------------- 1 | # ################################################################### 2 | # 3 | # Disclaimer and Notice of Copyright 4 | # ================================== 5 | # 6 | # Copyright (c) 2015, Los Alamos National Security, LLC 7 | # All rights reserved. 8 | # 9 | # Copyright 2015. Los Alamos National Security, LLC. 10 | # This software was produced under U.S. Government contract 11 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 12 | # which is operated by Los Alamos National Security, LLC for 13 | # the U.S. Department of Energy. The U.S. Government has rights 14 | # to use, reproduce, and distribute this software. NEITHER 15 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 16 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 17 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 18 | # produce derivative works, such modified software should be 19 | # clearly marked, so as not to confuse it with the version 20 | # available from LANL. 21 | # 22 | # Additionally, redistribution and use in source and binary 23 | # forms, with or without modification, are permitted provided 24 | # that the following conditions are met: 25 | # 26 | # 1. Redistributions of source code must retain the 27 | # above copyright notice, this list of conditions 28 | # and the following disclaimer. 29 | # 2. Redistributions in binary form must reproduce the 30 | # above copyright notice, this list of conditions 31 | # and the following disclaimer in the documentation 32 | # and/or other materials provided with the distribution. 33 | # 3. Neither the name of Los Alamos National Security, LLC, 34 | # Los Alamos National Laboratory, LANL, the U.S. Government, 35 | # nor the names of its contributors may be used to endorse 36 | # or promote products derived from this software without 37 | # specific prior written permission. 38 | # 39 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 40 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 41 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 42 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 43 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 44 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 45 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 46 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 47 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 49 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 50 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 51 | # OF SUCH DAMAGE. 52 | # 53 | # ################################################################### 54 | 55 | This directory contains various scripts that are either called by Pavilion core code 56 | or are stand-alone utilities useful for others tasks (such as file analysis). 57 | 58 | Some of these utility scripts are specific to LANL thus are not included in the git repo. 59 | 60 | Feel free to make new ones, improve, or re-write these. 61 | 62 | 63 | -- list as of 12/9/2015 ---- 64 | 65 | ReadBackwards.pm - core script used by get_results to read files from the end. 66 | blDiff - utility that shows delta between like tests in two different baseline data files 67 | checkjob_getNodeList - utility used to find nodes allocated to a Moab job if given the jobid. 68 | chklg - core logic used by get_results to determine pass/fail/unknown/undefined status from output in log file. 69 | cleanupWS - old Gazebo utility (not ported to Pavilon yet) used to clean up old working spaces. 70 | defaultDaysAgo.py - core script called by get_results 71 | find_test_dirs - core script used by get_results to find the list of result directories to analyze. 72 | findgrep - utility that can be used to recursivily find strings in files starting at some given level. 73 | fmp - utility that is the beginnings of replacement for jobFailAnal. Probably should be renamed to when working. 74 | getCLENodeList - core script used to find what nodes were allocated to this job run on Cray systems. 75 | getCleNids - core script called by getCLENodeList 76 | getNodeCoverage - utility that will tabulate job run time on each compute node over a give range of time. 77 | getNodeList - core script called by Pavilion to find what nodes were allocated to this job run. 78 | getSLURMNodeList - core script used to find what nodes were alloacated to this job run. 79 | get_results - core script called by Pavilion ported from Gazebo that summaries test result data. 80 | get_results-with-expanded-time-summary - same as get_results, but time reported in min/mean/max. To be switched to someday. 81 | jobFailAnal - very simple knowledge based utility to find common failure strings in files in result directories. 82 | jobReportcsv - utility to generate a basic csv list of common information of all tests starting at a specific date. 83 | listgrp - core script used by get_results and find_test_dirs. 84 | mk-tpl - utility often used after a set of test runs that creates a specific format of report summary and data. 85 | mkBaselines - core script used by get_results to create a baseline of all trend data values. 86 | mytime - core script used to time program runs. 87 | pv_testMgr - utility used to continually launch pavilion tests/jobs 88 | showtd - core script used by get_results to display trend data in graphical and table format. 89 | splunk - directory that contains a core script that is called by pavilion to generate the my.splunkdata file is the results directory 90 | sysStatChanges - utility used to read output from sysState script and summarize changes to the node availability. 91 | sysTimeline - utility used to read output from sysState script and output in colum format actual state changes 92 | sysState - tcsh script typically called by cron to record status of up/down nodes on a Cray system. 93 | tabulate.py - python module used by showtd to support displaying tabular data. 94 | td2csvgdl - core script used by Pavilion to generate running csv file of all trend data. See test_results.csv in results root dir. 95 | xexec - directory containing multi-purpose HPC system testing tool. 96 | 97 | -------------------------------------------------------------------------------- /PAV/scripts/checkjob_getNodeList: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | # get node list from moab using the checkjob command 57 | # input: requires one input argument, the jobid of the job in question 58 | # output: list of nodes the job owns 59 | 60 | use Sys::Hostname; 61 | #use strict; 62 | 63 | $| = 1; 64 | 65 | #----- get gazebo config values -------------- # 66 | 67 | use Cwd 'abs_path'; 68 | use File::Basename; 69 | my $pwd = dirname(abs_path("$0")); 70 | chomp($pwd); 71 | #our $mnd = $gazebo_conf{"Max_Node_Digits"}; 72 | our $mnd = 3; 73 | 74 | 75 | if ($0 =~ /^([ &:#-\@\w.]+)$/) { $0 = $1; } 76 | else { die "Bad data, exiting.\n"; } 77 | 78 | my $myjobid = shift; 79 | if (!defined $myjobid) { 80 | print "ERROR: no job id entered, exiting!\n"; 81 | exit(1); 82 | } 83 | 84 | my $mm = `which checkjob`; 85 | chomp($mm); 86 | my $MDIAG = "$mm $myjobid"; 87 | my @uniq = (); 88 | my %seen = (); 89 | my $nodelist = ""; 90 | my $ptr; 91 | 92 | # print "begin - nodelist: $nodelist\n"; 93 | 94 | my $output = `$MDIAG`; 95 | if (0 != $?) { 96 | exit(1); 97 | } 98 | my @lines = split "\n",$output; 99 | for ( my $res=0; $res<@lines; $res++ ) { 100 | next if (! ( $lines[$res] =~ /Allocated Nodes:/ )); 101 | $ptr = $res; 102 | $ptr++; 103 | last; 104 | } 105 | 106 | # when we get here process until next blank line 107 | my $thisline; 108 | while ($thisline = $lines[$ptr++]) { 109 | last if ($thisline =~ /^\s+$\n/); 110 | 111 | if ($thisline =~ /[\-*]/) { 112 | # handle this type of thing (loa 059-060,047-050,041-042 *16) 113 | # OR 114 | # handle this type of thing (*16 306,310,198,250,242,265,218,235 ml) 115 | $nodelist .= &get_from_type_A($thisline); 116 | } else { 117 | # handle this type of thing 118 | # [loa041:16][loa042:16][loa047:16][loa048:16][loa049:16][loa050:16] 119 | $nodelist .= &get_from_type_B($thisline); 120 | } 121 | } 122 | 123 | my @nodelist = split (/ /, $nodelist); 124 | # remove any dups of node names 125 | foreach my $item (@nodelist) { 126 | push(@uniq, $item) unless $seen{$item}++; 127 | } 128 | my @sl = sort @uniq; 129 | print "@sl\n"; 130 | 131 | 132 | 133 | sub get_from_type_A { 134 | my $line = $_[0]; 135 | my $cu; 136 | my @vals; 137 | my $range; 138 | my $nodes; 139 | my $startnum; 140 | my $endnum; 141 | my $diff; 142 | 143 | my $fdl = "%0" . $mnd . "d"; 144 | 145 | $line =~ s/\*[0-9]+\s*//g; 146 | $line =~ s/\]\[/ /g; 147 | $line =~ s/\[/ /g; 148 | $line =~ s/\]/ /g; 149 | $line =~ s/\s*([a-zA-Z]+)\s*//g; 150 | 151 | $cu = $1; 152 | @vals = split(",", $line); 153 | foreach $range (@vals) { 154 | if ( $range =~ /-/) { 155 | ($startnum,$endnum) = split("-", $range); 156 | $diff = $endnum - $startnum; 157 | # my $sn = sprintf("%03d", $startnum); 158 | my $sn = sprintf("$fdl", $startnum); 159 | $nodes .= " $cu$sn"; 160 | my $c =1; 161 | while ( $diff > 0 ) { 162 | my $n = $startnum + $c; 163 | # my $fn = sprintf("%03d", $n); 164 | my $fn = sprintf("$fdl", $n); 165 | $diff--; 166 | $c++; 167 | $nodes .= " $cu$fn"; 168 | } 169 | } else { 170 | $nodes .= " $cu$range"; 171 | } 172 | } 173 | return "$nodes"; 174 | } 175 | 176 | sub get_from_type_B { 177 | my $line = $_[0]; 178 | 179 | $line =~ s/\]\[/ /g; 180 | $line =~ s/\[/ /g; 181 | $line =~ s/\]/ /g; 182 | $line =~ s/\:[0-9]+//g; 183 | return $line; 184 | } 185 | 186 | 187 | exit 188 | 189 | 190 | -------------------------------------------------------------------------------- /PAV/scripts/chklg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # 28 | # 1. Redistributions of source code must retain the 29 | # above copyright notice, this list of conditions 30 | # and the following disclaimer. 31 | # 2. Redistributions in binary form must reproduce the 32 | # above copyright notice, this list of conditions 33 | # and the following disclaimer in the documentation 34 | # and/or other materials provided with the distribution. 35 | # 3. Neither the name of Los Alamos National Security, LLC, 36 | # Los Alamos National Laboratory, LANL, the U.S. Government, 37 | # nor the names of its contributors may be used to endorse 38 | # or promote products derived from this software without 39 | # specific prior written permission. 40 | # 41 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 42 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 43 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 44 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 45 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 46 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 47 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 48 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 49 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 51 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 52 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 53 | # OF SUCH DAMAGE. 54 | # 55 | # ################################################################### 56 | 57 | # 58 | # Low level utility to parse a logFile for results. 59 | # Searches for the test name, the jobid, and PASS/FAIL strings. 60 | # All pass fail results are proceeded by the string . 61 | # 62 | # Any occurance of FAIL results returns FAIL, even 63 | # if PASS also exists. If neither pass nor fail results 64 | # exist, then UNDEF is returned if the test completed. 65 | # If the test did not complete, then we will consider the 66 | # results INCOMPLETE (to messed up to figure out, a.k.a foobar). 67 | # 68 | 69 | my $prog; 70 | ($prog = $0) =~ s/.*\///; 71 | 72 | use Getopt::Std; 73 | use strict; 74 | use File::Basename; 75 | 76 | my $jid = "undef"; 77 | my $tn; 78 | my $exitCode; 79 | our %opt; 80 | $opt{v} = ""; 81 | my @tmp; 82 | 83 | # v option with no arg 84 | &getopts('v', \%opt); 85 | 86 | my $logFile = shift; 87 | our $passed = 0; 88 | our $failed = 0; 89 | our $learning = 0; 90 | my $fileSystem = ""; 91 | our $end = ""; 92 | my $jobNotFinished = 0; 93 | my $noResultFound = 1; 94 | 95 | open( LF, "<$logFile" ) or die "$prog: Failed to open $logFile: $!\n"; 96 | 97 | # post_complete file exists only when job is finished 98 | my $bd = dirname($logFile); 99 | unless ( -e "$bd/post_complete" ) { 100 | $jobNotFinished = 1; 101 | } 102 | 103 | my ( 104 | $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, 105 | $size, $atime, $mtime, $ctime, $blksize, $blick 106 | ) = stat($logFile); 107 | 108 | $_ = localtime($mtime); 109 | my ( $wday, $mon, $day, $time, $year ) = 110 | /(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/; 111 | my $dt = "$mon-$day-$year $time"; 112 | 113 | if ($opt{v}) { print "$prog: examining log: $logFile \n"; } 114 | 115 | my $resultsStr = ""; 116 | my $failedResultsStr = ""; 117 | while () { 118 | 119 | if (/^/) { 120 | @tmp = split ' ', $_; 121 | $tn = $tmp[1]; 122 | next; 123 | } 124 | 125 | if (/^ (\d+)/) { 126 | $jid = $1; 127 | next; 128 | } 129 | 130 | if( /^ (\S+)/ ) { 131 | $end = $1; 132 | next; 133 | } 134 | 135 | # except both result and results 136 | if (/\s*(.+)/){ 137 | $resultsStr = $1; 138 | chomp($resultsStr); 139 | if ($opt{v}) { print " --> $prog: found -> $_\n"; } 140 | if ($resultsStr =~ /LEARN/i) { 141 | print " Matched =>(L)\n"; 142 | $learning = 1; 143 | $noResultFound = 0; 144 | next; 145 | } 146 | if ($resultsStr =~ /PASS/i) { 147 | print " Matched =>(P), $resultsStr\n"; 148 | $passed = 1; 149 | $noResultFound = 0; 150 | next; 151 | } 152 | if ($resultsStr =~ /FAIL/i) { 153 | $failedResultsStr = $resultsStr; 154 | print " Matched =>(F), $failedResultsStr\n"; 155 | $failed = 1; 156 | $noResultFound = 0; 157 | } 158 | next; 159 | } 160 | } 161 | 162 | # end of file parsing 163 | 164 | if ( $noResultFound ) { 165 | # got here and not pass, fail, or even learning, so decide 166 | # if it just didn't start or finish, or did finish 167 | # but did not contain any explicit results. 168 | 169 | # maybe the job itself died for some reason 170 | if ( $jobNotFinished ) { 171 | # no post complete file, job died or maybe still running 172 | print " No Match =>(I), INCOMPLETE, job did not finish\n"; 173 | } else { 174 | # it must have ran, but no explicit results, so default to undefined 175 | print " No Match =>(U), UNKNOWN, no explicit pass/fail results in output\n"; 176 | } 177 | 178 | print " $dt $tn:$jid :: RESULT=UNDEFINED\n"; 179 | } else { 180 | 181 | # it's a failing test if any result shows a failure, 182 | # otherwise it must have a pass to indicate pass 183 | 184 | if ( $failed ) { 185 | print " $dt $tn:$jid :: RESULT=FAILED\n"; 186 | } elsif ( $passed ) { 187 | print " $dt $tn:$jid :: RESULT=PASSED\n"; 188 | } elsif ( $learning ) { 189 | print " $dt $tn:$jid :: RESULT=LEARNING\n"; 190 | } 191 | 192 | } 193 | 194 | 195 | close(LF); 196 | 197 | exit; 198 | -------------------------------------------------------------------------------- /PAV/scripts/defaultDaysAgo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | 4 | # ################################################################### 5 | # 6 | # Disclaimer and Notice of Copyright 7 | # ================================== 8 | # 9 | # Copyright (c) 2015, Los Alamos National Security, LLC 10 | # All rights reserved. 11 | # 12 | # Copyright 2015. Los Alamos National Security, LLC. 13 | # This software was produced under U.S. Government contract 14 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 15 | # which is operated by Los Alamos National Security, LLC for 16 | # the U.S. Department of Energy. The U.S. Government has rights 17 | # to use, reproduce, and distribute this software. NEITHER 18 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 19 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 20 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 21 | # produce derivative works, such modified software should be 22 | # clearly marked, so as not to confuse it with the version 23 | # available from LANL. 24 | # 25 | # Additionally, redistribution and use in source and binary 26 | # forms, with or without modification, are permitted provided 27 | # that the following conditions are met: 28 | # 29 | # 1. Redistributions of source code must retain the 30 | # above copyright notice, this list of conditions 31 | # and the following disclaimer. 32 | # 2. Redistributions in binary form must reproduce the 33 | # above copyright notice, this list of conditions 34 | # and the following disclaimer in the documentation 35 | # and/or other materials provided with the distribution. 36 | # 3. Neither the name of Los Alamos National Security, LLC, 37 | # Los Alamos National Laboratory, LANL, the U.S. Government, 38 | # nor the names of its contributors may be used to endorse 39 | # or promote products derived from this software without 40 | # specific prior written permission. 41 | # 42 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 43 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 44 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 45 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 46 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 47 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 48 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 49 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 50 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 51 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 52 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 53 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 54 | # OF SUCH DAMAGE. 55 | # 56 | # ################################################################### 57 | 58 | import sys 59 | import datetime 60 | 61 | """ 62 | print the date 'arg' days ago, default to 15 63 | Created for a Perl script to call... 64 | author: C. Idler 65 | """ 66 | 67 | try: 68 | days_ago = int(sys.argv[1]) 69 | except ValueError: 70 | # arg supplied not an int 71 | days_ago = 15 72 | except IndexError: 73 | # no arg supplied 74 | days_ago = 15 75 | 76 | print datetime.date.today() - datetime.timedelta(days=days_ago) 77 | -------------------------------------------------------------------------------- /PAV/scripts/getCLENodeList: -------------------------------------------------------------------------------- 1 | #!/bin/tcsh 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | 57 | # set up internationalization 58 | # set all locale categories to ISO C 59 | setenv LC_ALL C 60 | 61 | set nl = `${PVINSTALL}/PAV/scripts/getCleNids` 62 | if ( "$nl" == "" ) then 63 | # just try again if empty 64 | set nl = `${PVINSTALL}/PAV/scripts/getCleNids` 65 | endif 66 | set nodes = `echo $nl | gawk '{ for ( i=1 ; i <= NF ; i++ ) print $i }' | grep nid | tr '\n' ' ' ` 67 | 68 | echo "$nodes" 69 | 70 | # End of script 71 | exit 72 | 73 | -------------------------------------------------------------------------------- /PAV/scripts/getCleNids: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | 57 | job_id=`echo $PBS_JOBID | sed 's/[.].*$//' | sed 's/\]\[//g'` 58 | 59 | # Find the reservation ID by searching apstat output for our job ID 60 | # apstat -r sometimes will not list the current job, so retry until it does 61 | resv_id=`apstat -r | grep "batch:$job_id" | awk '{print $1}'` 62 | while [[ -z $resv_id ]]; do 63 | echo "getCleNids: job_id=[$job_id]" 1>&2 64 | echo "getCleNids: resv_id=[$resv_id]" 1>&2 65 | sleep 1 66 | resv_id=`apstat -r | grep "batch:$job_id" | awk '{print $1}'` 67 | done 68 | 69 | # Given the reservation ID, find the node IDs 70 | node_id=`apstat -nR $resv_id | awk '/BEGIN/{keep=0;nids=""}/Compute node summary/{print substr(nids,2)}{if (keep) nids=nids" nid"substr("0000", length($1))$1; keep=1}'` 71 | echo "$node_id" 72 | 73 | # echo "getCleNids: job_id=[$job_id]" 1>&2 74 | # echo "getCleNids: resv_id=[$resv_id]" 1>&2 75 | # echo "getCleNids: node_id=[$node_id]" 1>&2 76 | 77 | 78 | -------------------------------------------------------------------------------- /PAV/scripts/getNodeList: -------------------------------------------------------------------------------- 1 | #!/bin/tcsh 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | 57 | # set up internationalization 58 | # set all locale categories to ISO C 59 | setenv LC_ALL C 60 | 61 | set sn = "getNodeList" 62 | alias msg 'echo "`date --iso-8601=seconds`" ${sn}: ' 63 | 64 | # DON'T muck with this start time printout! 65 | #set start = `date --iso-8601=seconds` 66 | #echo " $0 start: $start" 67 | 68 | 69 | # get list of nodes in use dependent on resource manager being used 70 | if ( ${RMGR} == "CLE" ) then 71 | 72 | set nl = `${PVINSTALL}/PAV/scripts/getCleNids` 73 | if ( "$nl" == "" ) then 74 | # just try again if empty 75 | set nl = `${PVINSTALL}/PAV/scripts/getCleNids` 76 | endif 77 | set nodes = `echo $nl | gawk '{ for ( i=1 ; i <= NF ; i++ ) print $i }' | grep nid | tr '\n' ' ' ` 78 | 79 | else 80 | 81 | set nodes = `${PVINSTALL}/PAV/scripts/checkjob_getNodeList ${PV_JOBID}` 82 | if (0 != $?) then 83 | exit 1 84 | endif 85 | echo "$nodes" | gawk '{ for ( i=1 ; i <= NF ; i++ ) print $i }' 86 | 87 | 88 | endif 89 | 90 | if (! $?PV_NODES) then 91 | setenv GZ_NODES "${nodes}" 92 | setenv PV_NODES "${nodes}" 93 | endif 94 | 95 | set end = `date --iso-8601=seconds` 96 | #echo " -- $0 complete: ${end}" 97 | 98 | # Make special splunk data file from trend data. 99 | # This will not overwright user version of this file. 100 | #${GZBIN}/splunk/td2splunkData ${tmplogdir} 101 | 102 | # End of script 103 | exit 104 | 105 | -------------------------------------------------------------------------------- /PAV/scripts/getSLURMNodeList: -------------------------------------------------------------------------------- 1 | #!/bin/tcsh 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | # set up internationalization 57 | # set all locale categories to ISO C 58 | setenv LC_ALL C 59 | 60 | set nodes = `${PVINSTALL}/PAV/scripts/checkjob_getNodeList ${PV_JOBID}` 61 | if (0 != $?) then 62 | exit 1 63 | endif 64 | echo "$nodes" | gawk '{ for ( i=1 ; i <= NF ; i++ ) print $i }' 65 | 66 | #echo "$nodes" 67 | 68 | # End of script 69 | exit 70 | 71 | -------------------------------------------------------------------------------- /PAV/scripts/jobReportcsv: -------------------------------------------------------------------------------- 1 | #!/bin/tcsh 2 | 3 | # Takes pavilion results directories for each category (p/f/i) and 4 | # make a csv output summary line for each. 5 | 6 | if ($#argv < 2 ) then 7 | echo "Usage: JobReportcsv test-suite start-date(yyyy-mm-dd)" 8 | exit 9 | endif 10 | 11 | 12 | # Original Author, M. Berry, HPC-5/LANL, 03 Dec 15 13 | 14 | # Tweaked to support input test suite file and start date, cwi, 12/4/15 15 | # Enhanced amount of working space reported, cwi, 12/4/15 16 | 17 | # generate output report files for passed, failed, and incomplete data 18 | rm -r /tmp/pav*dirs.out 19 | pav get_results -ts $1 -s $2 -p | grep "__" > /tmp/pav_pass_dirs.out 20 | pav get_results -ts $1 -s $2 -f | grep "__" > /tmp/pav_fail_dirs.out 21 | pav get_results -ts $1 -s $2 -i | grep "__" > /tmp/pav_inc_dirs.out 22 | 23 | # column headings 24 | echo "Job Name","Job ID","Num Nodes","Sub Date","Sub Time","Start Date","Start Time","End Date","End Time","Status","Run Dir","Results Dir" 25 | 26 | # Note, submit date and time is when job submitted to the system by Pavilion and the result directory is created. 27 | # Note, start date and time is when job actually launched by the scheduler. 28 | 29 | # for all the input files 30 | foreach t ( /tmp/pav*dirs.out ) 31 | 32 | # which type of file are we currently doing -- controls contents of status column 33 | setenv QQ_T `echo $t | cut -d '_' -f 2` 34 | if ( $QQ_T == "pass" ) then 35 | setenv QQ_STAT PASS 36 | else if ( $QQ_T == "fail" ) then 37 | setenv QQ_STAT FAIL 38 | else if ( $QQ_T == "inc" ) then 39 | setenv QQ_STAT UNKNOWN 40 | else 41 | setenv QQ_STAT "PROCESSING ERROR" 42 | endif 43 | 44 | # for each line (directory) in the input file 45 | foreach d ( `cat $t` ) 46 | 47 | # CAUTION: some of these are very specific to current format and path length 48 | # might need some tweaking if anything is different 49 | setenv QQ_NAM `echo $d | rev | cut -d "/" -f 2 | rev` 50 | setenv QQ_JID `grep "" $d/*.log | cut -d " " -f 2` 52 | setenv QQ_SUBD `echo $d | cut -d "." -f 2 | cut -d "T" -f 1` 53 | setenv QQ_SUBT `echo $d | cut -d "." -f 2 | cut -d "T" -f 2` 54 | setenv QQ_BD `grep -i "" $d/*.log | cut -d " " -f 3 | cut -d "T" -f 1` 55 | setenv QQ_BT `grep -i "" $d/*.log | cut -d " " -f 3 | cut -d "T" -f 2` 56 | setenv QQ_ED `grep "" $d/*.log | cut -d " " -f 3 | cut -d "T" -f 1` 57 | setenv QQ_ET `grep "" $d/*.log | cut -d " " -f 3 | cut -d "T" -f 2` 58 | #setenv QQ_WD `grep "Working Space:" $d/*.log | cut -d "/" -f 2,3,4,5` 59 | set i = `grep "Working Space:" $d/*.log | cut -d " " -f 3` 60 | set ws = $i:h 61 | 62 | # print line of output 63 | #echo $QQ_NAM,$QQ_JID,$QQ_NN,$QQ_SUBD,$QQ_SUBT,$QQ_BD,$QQ_BT,$QQ_ED,$QQ_ET,$QQ_STAT,/$QQ_WD,$d 64 | echo $QQ_NAM,$QQ_JID,$QQ_NN,$QQ_SUBD,$QQ_SUBT,$QQ_BD,$QQ_BT,$QQ_ED,$QQ_ET,$QQ_STAT,$ws,$d 65 | 66 | 67 | end 68 | 69 | end 70 | 71 | 72 | # cleanup 73 | 74 | unsetenv QQ_SUBT 75 | unsetenv QQ_SUBD 76 | unsetenv QQ_BD 77 | unsetenv QQ_BT 78 | unsetenv QQ_ED 79 | unsetenv QQ_ET 80 | unsetenv QQ_NN 81 | unsetenv QQ_NAM 82 | #unsetenv QQ_WD 83 | unsetenv QQ_JID 84 | unsetenv QQ_STAT 85 | unsetenv $d 86 | unsetenv $t 87 | -------------------------------------------------------------------------------- /PAV/scripts/listgrp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | 57 | our %opts; 58 | my ( 59 | $tmp,$usage,$gname,$user,$userlist,@nada,$grplist, 60 | @stuff,$grp 61 | ); 62 | 63 | # # ------------------------------------------------------------------ # # 64 | 65 | 66 | # get parameters from command line 67 | use Getopt::Std; 68 | $opts{g} = ""; # group name for which info is deisred 69 | $opts{u} = ""; # user moniker for which info is desired 70 | getopts("m:g:u:ht",\%opts); 71 | 72 | if ( $opts{h} ) { # print usage info 73 | $usage = <] [-u ] [-h] [-t] 75 | -g option alone will list the monikers of the users who 76 | are members in the group "group_name". 77 | -u option alone will list the groups to which the user 78 | specified as "user_moniker" belongs. 79 | Including both -g and -u on the command line will return 80 | 1 if the user user_moniker belongs to group group_name, 81 | and 0 otherwise. 82 | -h gives this help message 83 | -t means return the -g or -u list with a title line 84 | EOF 85 | print "$usage\n"; 86 | exit; 87 | } 88 | 89 | # indicate mode of functioning of this routine: 90 | 91 | $user = "$opts{u}"; 92 | $user =~ s/\s//g; 93 | 94 | $gname = "$opts{g}"; 95 | $gname =~ s/\s//g; 96 | 97 | 98 | # # ------------------------------------------------------------------ # # 99 | 100 | # get "gz" groups to which specified user belongs 101 | if (( $opts{u} ) && (! $opts{g} )) { 102 | $grplist = `grep $user /etc/group | grep gz | awk -F: '{print \$1}' | xargs`; 103 | chop($grplist); 104 | if ( $opts{t} ) { 105 | print "User $user belongs to the following groups: \n\t$grplist\n"; 106 | } else { 107 | print "$grplist\n"; 108 | } 109 | } 110 | 111 | # get users in specified group 112 | if (( $opts{g} ) && (! $opts{u} )) { 113 | $userlist = `grep $gname /etc/group`; 114 | if ( length("$userlist") > 1 ) { 115 | @nada = split ':',$userlist; 116 | $userlist = "$nada[$#nada]"; 117 | } 118 | 119 | chop($userlist); 120 | if ( $opts{t} ) { 121 | print "Group $gname has the following members: \n\t$userlist\n"; 122 | } else { 123 | print "$userlist\n"; 124 | } 125 | } 126 | 127 | # return 0 or 1 to say if specified user belongs to specified group 128 | if (( $opts{u} ) && ( $opts{g} )) { 129 | $userlist = `grep $gname /etc/group`; 130 | if ( $userlist =~ /$user/ ) { 131 | print "1"; 132 | } else { 133 | print "0"; 134 | } 135 | } 136 | 137 | exit; 138 | -------------------------------------------------------------------------------- /PAV/scripts/mytime: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # - Redistributions of source code must retain the 28 | # above copyright notice, this list of conditions 29 | # and the following disclaimer. 30 | # - Redistributions in binary form must reproduce the 31 | # above copyright notice, this list of conditions 32 | # and the following disclaimer in the documentation 33 | # and/or other materials provided with the distribution. 34 | # - Neither the name of Los Alamos National Security, LLC, 35 | # Los Alamos National Laboratory, LANL, the U.S. Government, 36 | # nor the names of its contributors may be used to endorse 37 | # or promote products derived from this software without 38 | # specific prior written permission. 39 | # 40 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 41 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 42 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 43 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 45 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 46 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 47 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 48 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 50 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 52 | # OF SUCH DAMAGE. 53 | # 54 | # ################################################################### 55 | 56 | 57 | $| = 1; 58 | (our $prog = $0) =~ s!.*/!!; 59 | 60 | use POSIX qw(sysconf times); 61 | 62 | die "usage: $prog \n" 63 | unless(scalar(@ARGV)); 64 | 65 | our $ticks = POSIX::sysconf(&POSIX::_SC_CLK_TCK); 66 | die "$prog: clock ticks undefined on this system!\n" 67 | unless (defined($ticks)); 68 | 69 | our ($r1,$u1,$s1,$cu1,$cs1) = POSIX::times; 70 | system { $ARGV[0] } @ARGV; our $status = $? >> 8; 71 | our ($r2,$u2,$s2,$cu2,$cs2) = POSIX::times; 72 | 73 | printf "\nreal %7.2f\nuser %7.2f\nsys %7.2f\n", 74 | ($r2-$r1)/$ticks, # real seconds 75 | (($u2+$cu2)-($u1+$cu1))/$ticks, # user seconds 76 | (($s2+$cs2)-($s1+$cs1))/$ticks; # system seconds 77 | 78 | exit $status; 79 | -------------------------------------------------------------------------------- /PAV/scripts/splunk/README: -------------------------------------------------------------------------------- 1 | # ################################################################### 2 | # 3 | # Disclaimer and Notice of Copyright 4 | # ================================== 5 | # 6 | # Copyright (c) 2015, Los Alamos National Security, LLC 7 | # All rights reserved. 8 | # 9 | # Copyright 2015. Los Alamos National Security, LLC. 10 | # This software was produced under U.S. Government contract 11 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 12 | # which is operated by Los Alamos National Security, LLC for 13 | # the U.S. Department of Energy. The U.S. Government has rights 14 | # to use, reproduce, and distribute this software. NEITHER 15 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 16 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 17 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 18 | # produce derivative works, such modified software should be 19 | # clearly marked, so as not to confuse it with the version 20 | # available from LANL. 21 | # 22 | # Additionally, redistribution and use in source and binary 23 | # forms, with or without modification, are permitted provided 24 | # that the following conditions are met: 25 | # 26 | # 1. Redistributions of source code must retain the 27 | # above copyright notice, this list of conditions 28 | # and the following disclaimer. 29 | # 2. Redistributions in binary form must reproduce the 30 | # above copyright notice, this list of conditions 31 | # and the following disclaimer in the documentation 32 | # and/or other materials provided with the distribution. 33 | # 3. Neither the name of Los Alamos National Security, LLC, 34 | # Los Alamos National Laboratory, LANL, the U.S. Government, 35 | # nor the names of its contributors may be used to endorse 36 | # or promote products derived from this software without 37 | # specific prior written permission. 38 | # 39 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 40 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 41 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 42 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 43 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 44 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 45 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 46 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 47 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 49 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 50 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 51 | # OF SUCH DAMAGE. 52 | # 53 | # ################################################################### 54 | 55 | This directory contains software specific to SPLUNK related work. Splunk is a commercial product and is 56 | not released as part of Pavilion. In addition, Pavilion can be used without a Splunk infrastructure in place. 57 | 58 | Splunk is a data mining and analysis tool. Splunk expects data in a much different format 59 | than the standard Pavilion output log. The td2splunkData utility will read the job result log file and create 60 | a my.splunkdata file, in the same directory, placing in it native Splunk format records. Basically, a few noteworthy 61 | values are saved, along with all the trenddata values, and written as key value pairs into this new file. 62 | 63 | The td2splunkData script may run at the end of each job, if set to run the in test suite configuration file. 64 | td2splunkData will not overwrite an existing *.splunkdata file. This allows the test developer, if so inclined, 65 | to generate their own splunk data. The my.splunkdata file is then catenated onto a global data file where Splunk 66 | can be set up to monitor it. 67 | 68 | - to see how td2splunkData works: 69 | 1) remove the *.splunkdata file from the CWD, if the file exists. 70 | 2) run "./td2splunkData " ( "." will work if the log file exists in the CWD ) 71 | 3) a my.splunkdata file is generated in the CWD 72 | -------------------------------------------------------------------------------- /PAV/special_pkgs/README.txt: -------------------------------------------------------------------------------- 1 | # ################################################################### 2 | # 3 | # Disclaimer and Notice of Copyright 4 | # ================================== 5 | # 6 | # Copyright (c) 2015, Los Alamos National Security, LLC 7 | # All rights reserved. 8 | # 9 | # Copyright 2015. Los Alamos National Security, LLC. 10 | # This software was produced under U.S. Government contract 11 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 12 | # which is operated by Los Alamos National Security, LLC for 13 | # the U.S. Department of Energy. The U.S. Government has rights 14 | # to use, reproduce, and distribute this software. NEITHER 15 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 16 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 17 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 18 | # produce derivative works, such modified software should be 19 | # clearly marked, so as not to confuse it with the version 20 | # available from LANL. 21 | # 22 | # Additionally, redistribution and use in source and binary 23 | # forms, with or without modification, are permitted provided 24 | # that the following conditions are met: 25 | # 26 | # 1. Redistributions of source code must retain the 27 | # above copyright notice, this list of conditions 28 | # and the following disclaimer. 29 | # 2. Redistributions in binary form must reproduce the 30 | # above copyright notice, this list of conditions 31 | # and the following disclaimer in the documentation 32 | # and/or other materials provided with the distribution. 33 | # 3. Neither the name of Los Alamos National Security, LLC, 34 | # Los Alamos National Laboratory, LANL, the U.S. Government, 35 | # nor the names of its contributors may be used to endorse 36 | # or promote products derived from this software without 37 | # specific prior written permission. 38 | # 39 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 40 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 41 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 42 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 43 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 44 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 45 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 46 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 47 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 49 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 50 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 51 | # OF SUCH DAMAGE. 52 | # 53 | # ################################################################### 54 | 55 | This directory contains packages that Pavilion needs or relies on to work. Due to special release considerations at the 56 | laboratories it is important that software tools be self-contained as much as possible, thus software available on the net 57 | may get "packaged" in this release. Many thanks to the authors and developers of such fine tools: 58 | 59 | YAML - Author: Kirill Simonov, Home Page: http://pyyaml.org/wiki/PyYAML 60 | YAPSY - Author: Thibauld Nion, Home Page: http://yapsy.sourceforge.net 61 | -------------------------------------------------------------------------------- /PAV/special_pkgs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/Pavilion/77fcf7446996a0292d0515a0dcee5024ccf8cc01/PAV/special_pkgs/__init__.py -------------------------------------------------------------------------------- /PAV/special_pkgs/yaml/composer.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = ['Composer', 'ComposerError'] 3 | 4 | from error import MarkedYAMLError 5 | from events import * 6 | from nodes import * 7 | 8 | class ComposerError(MarkedYAMLError): 9 | pass 10 | 11 | class Composer(object): 12 | 13 | def __init__(self): 14 | self.anchors = {} 15 | 16 | def check_node(self): 17 | # Drop the STREAM-START event. 18 | if self.check_event(StreamStartEvent): 19 | self.get_event() 20 | 21 | # If there are more documents available? 22 | return not self.check_event(StreamEndEvent) 23 | 24 | def get_node(self): 25 | # Get the root node of the next document. 26 | if not self.check_event(StreamEndEvent): 27 | return self.compose_document() 28 | 29 | def get_single_node(self): 30 | # Drop the STREAM-START event. 31 | self.get_event() 32 | 33 | # Compose a document if the stream is not empty. 34 | document = None 35 | if not self.check_event(StreamEndEvent): 36 | document = self.compose_document() 37 | 38 | # Ensure that the stream contains no more documents. 39 | if not self.check_event(StreamEndEvent): 40 | event = self.get_event() 41 | raise ComposerError("expected a single document in the stream", 42 | document.start_mark, "but found another document", 43 | event.start_mark) 44 | 45 | # Drop the STREAM-END event. 46 | self.get_event() 47 | 48 | return document 49 | 50 | def compose_document(self): 51 | # Drop the DOCUMENT-START event. 52 | self.get_event() 53 | 54 | # Compose the root node. 55 | node = self.compose_node(None, None) 56 | 57 | # Drop the DOCUMENT-END event. 58 | self.get_event() 59 | 60 | self.anchors = {} 61 | return node 62 | 63 | def compose_node(self, parent, index): 64 | if self.check_event(AliasEvent): 65 | event = self.get_event() 66 | anchor = event.anchor 67 | if anchor not in self.anchors: 68 | raise ComposerError(None, None, "found undefined alias %r" 69 | % anchor.encode('utf-8'), event.start_mark) 70 | return self.anchors[anchor] 71 | event = self.peek_event() 72 | anchor = event.anchor 73 | if anchor is not None: 74 | if anchor in self.anchors: 75 | raise ComposerError("found duplicate anchor %r; first occurence" 76 | % anchor.encode('utf-8'), self.anchors[anchor].start_mark, 77 | "second occurence", event.start_mark) 78 | self.descend_resolver(parent, index) 79 | if self.check_event(ScalarEvent): 80 | node = self.compose_scalar_node(anchor) 81 | elif self.check_event(SequenceStartEvent): 82 | node = self.compose_sequence_node(anchor) 83 | elif self.check_event(MappingStartEvent): 84 | node = self.compose_mapping_node(anchor) 85 | self.ascend_resolver() 86 | return node 87 | 88 | def compose_scalar_node(self, anchor): 89 | event = self.get_event() 90 | tag = event.tag 91 | if tag is None or tag == u'!': 92 | tag = self.resolve(ScalarNode, event.value, event.implicit) 93 | node = ScalarNode(tag, event.value, 94 | event.start_mark, event.end_mark, style=event.style) 95 | if anchor is not None: 96 | self.anchors[anchor] = node 97 | return node 98 | 99 | def compose_sequence_node(self, anchor): 100 | start_event = self.get_event() 101 | tag = start_event.tag 102 | if tag is None or tag == u'!': 103 | tag = self.resolve(SequenceNode, None, start_event.implicit) 104 | node = SequenceNode(tag, [], 105 | start_event.start_mark, None, 106 | flow_style=start_event.flow_style) 107 | if anchor is not None: 108 | self.anchors[anchor] = node 109 | index = 0 110 | while not self.check_event(SequenceEndEvent): 111 | node.value.append(self.compose_node(node, index)) 112 | index += 1 113 | end_event = self.get_event() 114 | node.end_mark = end_event.end_mark 115 | return node 116 | 117 | def compose_mapping_node(self, anchor): 118 | start_event = self.get_event() 119 | tag = start_event.tag 120 | if tag is None or tag == u'!': 121 | tag = self.resolve(MappingNode, None, start_event.implicit) 122 | node = MappingNode(tag, [], 123 | start_event.start_mark, None, 124 | flow_style=start_event.flow_style) 125 | if anchor is not None: 126 | self.anchors[anchor] = node 127 | while not self.check_event(MappingEndEvent): 128 | #key_event = self.peek_event() 129 | item_key = self.compose_node(node, None) 130 | #if item_key in node.value: 131 | # raise ComposerError("while composing a mapping", start_event.start_mark, 132 | # "found duplicate key", key_event.start_mark) 133 | item_value = self.compose_node(node, item_key) 134 | #node.value[item_key] = item_value 135 | node.value.append((item_key, item_value)) 136 | end_event = self.get_event() 137 | node.end_mark = end_event.end_mark 138 | return node 139 | 140 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yaml/cyaml.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = ['CBaseLoader', 'CSafeLoader', 'CLoader', 3 | 'CBaseDumper', 'CSafeDumper', 'CDumper'] 4 | 5 | from _yaml import CParser, CEmitter 6 | 7 | from constructor import * 8 | 9 | from serializer import * 10 | from representer import * 11 | 12 | from resolver import * 13 | 14 | class CBaseLoader(CParser, BaseConstructor, BaseResolver): 15 | 16 | def __init__(self, stream): 17 | CParser.__init__(self, stream) 18 | BaseConstructor.__init__(self) 19 | BaseResolver.__init__(self) 20 | 21 | class CSafeLoader(CParser, SafeConstructor, Resolver): 22 | 23 | def __init__(self, stream): 24 | CParser.__init__(self, stream) 25 | SafeConstructor.__init__(self) 26 | Resolver.__init__(self) 27 | 28 | class CLoader(CParser, Constructor, Resolver): 29 | 30 | def __init__(self, stream): 31 | CParser.__init__(self, stream) 32 | Constructor.__init__(self) 33 | Resolver.__init__(self) 34 | 35 | class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): 36 | 37 | def __init__(self, stream, 38 | default_style=None, default_flow_style=None, 39 | canonical=None, indent=None, width=None, 40 | allow_unicode=None, line_break=None, 41 | encoding=None, explicit_start=None, explicit_end=None, 42 | version=None, tags=None): 43 | CEmitter.__init__(self, stream, canonical=canonical, 44 | indent=indent, width=width, encoding=encoding, 45 | allow_unicode=allow_unicode, line_break=line_break, 46 | explicit_start=explicit_start, explicit_end=explicit_end, 47 | version=version, tags=tags) 48 | Representer.__init__(self, default_style=default_style, 49 | default_flow_style=default_flow_style) 50 | Resolver.__init__(self) 51 | 52 | class CSafeDumper(CEmitter, SafeRepresenter, Resolver): 53 | 54 | def __init__(self, stream, 55 | default_style=None, default_flow_style=None, 56 | canonical=None, indent=None, width=None, 57 | allow_unicode=None, line_break=None, 58 | encoding=None, explicit_start=None, explicit_end=None, 59 | version=None, tags=None): 60 | CEmitter.__init__(self, stream, canonical=canonical, 61 | indent=indent, width=width, encoding=encoding, 62 | allow_unicode=allow_unicode, line_break=line_break, 63 | explicit_start=explicit_start, explicit_end=explicit_end, 64 | version=version, tags=tags) 65 | SafeRepresenter.__init__(self, default_style=default_style, 66 | default_flow_style=default_flow_style) 67 | Resolver.__init__(self) 68 | 69 | class CDumper(CEmitter, Serializer, Representer, Resolver): 70 | 71 | def __init__(self, stream, 72 | default_style=None, default_flow_style=None, 73 | canonical=None, indent=None, width=None, 74 | allow_unicode=None, line_break=None, 75 | encoding=None, explicit_start=None, explicit_end=None, 76 | version=None, tags=None): 77 | CEmitter.__init__(self, stream, canonical=canonical, 78 | indent=indent, width=width, encoding=encoding, 79 | allow_unicode=allow_unicode, line_break=line_break, 80 | explicit_start=explicit_start, explicit_end=explicit_end, 81 | version=version, tags=tags) 82 | Representer.__init__(self, default_style=default_style, 83 | default_flow_style=default_flow_style) 84 | Resolver.__init__(self) 85 | 86 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yaml/dumper.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = ['BaseDumper', 'SafeDumper', 'Dumper'] 3 | 4 | from emitter import * 5 | from serializer import * 6 | from representer import * 7 | from resolver import * 8 | 9 | class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): 10 | 11 | def __init__(self, stream, 12 | default_style=None, default_flow_style=None, 13 | canonical=None, indent=None, width=None, 14 | allow_unicode=None, line_break=None, 15 | encoding=None, explicit_start=None, explicit_end=None, 16 | version=None, tags=None): 17 | Emitter.__init__(self, stream, canonical=canonical, 18 | indent=indent, width=width, 19 | allow_unicode=allow_unicode, line_break=line_break) 20 | Serializer.__init__(self, encoding=encoding, 21 | explicit_start=explicit_start, explicit_end=explicit_end, 22 | version=version, tags=tags) 23 | Representer.__init__(self, default_style=default_style, 24 | default_flow_style=default_flow_style) 25 | Resolver.__init__(self) 26 | 27 | class SafeDumper(Emitter, Serializer, SafeRepresenter, Resolver): 28 | 29 | def __init__(self, stream, 30 | default_style=None, default_flow_style=None, 31 | canonical=None, indent=None, width=None, 32 | allow_unicode=None, line_break=None, 33 | encoding=None, explicit_start=None, explicit_end=None, 34 | version=None, tags=None): 35 | Emitter.__init__(self, stream, canonical=canonical, 36 | indent=indent, width=width, 37 | allow_unicode=allow_unicode, line_break=line_break) 38 | Serializer.__init__(self, encoding=encoding, 39 | explicit_start=explicit_start, explicit_end=explicit_end, 40 | version=version, tags=tags) 41 | SafeRepresenter.__init__(self, default_style=default_style, 42 | default_flow_style=default_flow_style) 43 | Resolver.__init__(self) 44 | 45 | class Dumper(Emitter, Serializer, Representer, Resolver): 46 | 47 | def __init__(self, stream, 48 | default_style=None, default_flow_style=None, 49 | canonical=None, indent=None, width=None, 50 | allow_unicode=None, line_break=None, 51 | encoding=None, explicit_start=None, explicit_end=None, 52 | version=None, tags=None): 53 | Emitter.__init__(self, stream, canonical=canonical, 54 | indent=indent, width=width, 55 | allow_unicode=allow_unicode, line_break=line_break) 56 | Serializer.__init__(self, encoding=encoding, 57 | explicit_start=explicit_start, explicit_end=explicit_end, 58 | version=version, tags=tags) 59 | Representer.__init__(self, default_style=default_style, 60 | default_flow_style=default_flow_style) 61 | Resolver.__init__(self) 62 | 63 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yaml/error.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = ['Mark', 'YAMLError', 'MarkedYAMLError'] 3 | 4 | class Mark(object): 5 | 6 | def __init__(self, name, index, line, column, buffer, pointer): 7 | self.name = name 8 | self.index = index 9 | self.line = line 10 | self.column = column 11 | self.buffer = buffer 12 | self.pointer = pointer 13 | 14 | def get_snippet(self, indent=4, max_length=75): 15 | if self.buffer is None: 16 | return None 17 | head = '' 18 | start = self.pointer 19 | while start > 0 and self.buffer[start-1] not in u'\0\r\n\x85\u2028\u2029': 20 | start -= 1 21 | if self.pointer-start > max_length/2-1: 22 | head = ' ... ' 23 | start += 5 24 | break 25 | tail = '' 26 | end = self.pointer 27 | while end < len(self.buffer) and self.buffer[end] not in u'\0\r\n\x85\u2028\u2029': 28 | end += 1 29 | if end-self.pointer > max_length/2-1: 30 | tail = ' ... ' 31 | end -= 5 32 | break 33 | snippet = self.buffer[start:end].encode('utf-8') 34 | return ' '*indent + head + snippet + tail + '\n' \ 35 | + ' '*(indent+self.pointer-start+len(head)) + '^' 36 | 37 | def __str__(self): 38 | snippet = self.get_snippet() 39 | where = " in \"%s\", line %d, column %d" \ 40 | % (self.name, self.line+1, self.column+1) 41 | if snippet is not None: 42 | where += ":\n"+snippet 43 | return where 44 | 45 | class YAMLError(Exception): 46 | pass 47 | 48 | class MarkedYAMLError(YAMLError): 49 | 50 | def __init__(self, context=None, context_mark=None, 51 | problem=None, problem_mark=None, note=None): 52 | self.context = context 53 | self.context_mark = context_mark 54 | self.problem = problem 55 | self.problem_mark = problem_mark 56 | self.note = note 57 | 58 | def __str__(self): 59 | lines = [] 60 | if self.context is not None: 61 | lines.append(self.context) 62 | if self.context_mark is not None \ 63 | and (self.problem is None or self.problem_mark is None 64 | or self.context_mark.name != self.problem_mark.name 65 | or self.context_mark.line != self.problem_mark.line 66 | or self.context_mark.column != self.problem_mark.column): 67 | lines.append(str(self.context_mark)) 68 | if self.problem is not None: 69 | lines.append(self.problem) 70 | if self.problem_mark is not None: 71 | lines.append(str(self.problem_mark)) 72 | if self.note is not None: 73 | lines.append(self.note) 74 | return '\n'.join(lines) 75 | 76 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yaml/events.py: -------------------------------------------------------------------------------- 1 | 2 | # Abstract classes. 3 | 4 | class Event(object): 5 | def __init__(self, start_mark=None, end_mark=None): 6 | self.start_mark = start_mark 7 | self.end_mark = end_mark 8 | def __repr__(self): 9 | attributes = [key for key in ['anchor', 'tag', 'implicit', 'value'] 10 | if hasattr(self, key)] 11 | arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) 12 | for key in attributes]) 13 | return '%s(%s)' % (self.__class__.__name__, arguments) 14 | 15 | class NodeEvent(Event): 16 | def __init__(self, anchor, start_mark=None, end_mark=None): 17 | self.anchor = anchor 18 | self.start_mark = start_mark 19 | self.end_mark = end_mark 20 | 21 | class CollectionStartEvent(NodeEvent): 22 | def __init__(self, anchor, tag, implicit, start_mark=None, end_mark=None, 23 | flow_style=None): 24 | self.anchor = anchor 25 | self.tag = tag 26 | self.implicit = implicit 27 | self.start_mark = start_mark 28 | self.end_mark = end_mark 29 | self.flow_style = flow_style 30 | 31 | class CollectionEndEvent(Event): 32 | pass 33 | 34 | # Implementations. 35 | 36 | class StreamStartEvent(Event): 37 | def __init__(self, start_mark=None, end_mark=None, encoding=None): 38 | self.start_mark = start_mark 39 | self.end_mark = end_mark 40 | self.encoding = encoding 41 | 42 | class StreamEndEvent(Event): 43 | pass 44 | 45 | class DocumentStartEvent(Event): 46 | def __init__(self, start_mark=None, end_mark=None, 47 | explicit=None, version=None, tags=None): 48 | self.start_mark = start_mark 49 | self.end_mark = end_mark 50 | self.explicit = explicit 51 | self.version = version 52 | self.tags = tags 53 | 54 | class DocumentEndEvent(Event): 55 | def __init__(self, start_mark=None, end_mark=None, 56 | explicit=None): 57 | self.start_mark = start_mark 58 | self.end_mark = end_mark 59 | self.explicit = explicit 60 | 61 | class AliasEvent(NodeEvent): 62 | pass 63 | 64 | class ScalarEvent(NodeEvent): 65 | def __init__(self, anchor, tag, implicit, value, 66 | start_mark=None, end_mark=None, style=None): 67 | self.anchor = anchor 68 | self.tag = tag 69 | self.implicit = implicit 70 | self.value = value 71 | self.start_mark = start_mark 72 | self.end_mark = end_mark 73 | self.style = style 74 | 75 | class SequenceStartEvent(CollectionStartEvent): 76 | pass 77 | 78 | class SequenceEndEvent(CollectionEndEvent): 79 | pass 80 | 81 | class MappingStartEvent(CollectionStartEvent): 82 | pass 83 | 84 | class MappingEndEvent(CollectionEndEvent): 85 | pass 86 | 87 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yaml/loader.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = ['BaseLoader', 'SafeLoader', 'Loader'] 3 | 4 | from reader import * 5 | from scanner import * 6 | from parser import * 7 | from composer import * 8 | from constructor import * 9 | from resolver import * 10 | 11 | class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, BaseResolver): 12 | 13 | def __init__(self, stream): 14 | Reader.__init__(self, stream) 15 | Scanner.__init__(self) 16 | Parser.__init__(self) 17 | Composer.__init__(self) 18 | BaseConstructor.__init__(self) 19 | BaseResolver.__init__(self) 20 | 21 | class SafeLoader(Reader, Scanner, Parser, Composer, SafeConstructor, Resolver): 22 | 23 | def __init__(self, stream): 24 | Reader.__init__(self, stream) 25 | Scanner.__init__(self) 26 | Parser.__init__(self) 27 | Composer.__init__(self) 28 | SafeConstructor.__init__(self) 29 | Resolver.__init__(self) 30 | 31 | class Loader(Reader, Scanner, Parser, Composer, Constructor, Resolver): 32 | 33 | def __init__(self, stream): 34 | Reader.__init__(self, stream) 35 | Scanner.__init__(self) 36 | Parser.__init__(self) 37 | Composer.__init__(self) 38 | Constructor.__init__(self) 39 | Resolver.__init__(self) 40 | 41 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yaml/nodes.py: -------------------------------------------------------------------------------- 1 | 2 | class Node(object): 3 | def __init__(self, tag, value, start_mark, end_mark): 4 | self.tag = tag 5 | self.value = value 6 | self.start_mark = start_mark 7 | self.end_mark = end_mark 8 | def __repr__(self): 9 | value = self.value 10 | #if isinstance(value, list): 11 | # if len(value) == 0: 12 | # value = '' 13 | # elif len(value) == 1: 14 | # value = '<1 item>' 15 | # else: 16 | # value = '<%d items>' % len(value) 17 | #else: 18 | # if len(value) > 75: 19 | # value = repr(value[:70]+u' ... ') 20 | # else: 21 | # value = repr(value) 22 | value = repr(value) 23 | return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value) 24 | 25 | class ScalarNode(Node): 26 | id = 'scalar' 27 | def __init__(self, tag, value, 28 | start_mark=None, end_mark=None, style=None): 29 | self.tag = tag 30 | self.value = value 31 | self.start_mark = start_mark 32 | self.end_mark = end_mark 33 | self.style = style 34 | 35 | class CollectionNode(Node): 36 | def __init__(self, tag, value, 37 | start_mark=None, end_mark=None, flow_style=None): 38 | self.tag = tag 39 | self.value = value 40 | self.start_mark = start_mark 41 | self.end_mark = end_mark 42 | self.flow_style = flow_style 43 | 44 | class SequenceNode(CollectionNode): 45 | id = 'sequence' 46 | 47 | class MappingNode(CollectionNode): 48 | id = 'mapping' 49 | 50 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yaml/reader.py: -------------------------------------------------------------------------------- 1 | # This module contains abstractions for the input stream. You don't have to 2 | # looks further, there are no pretty code. 3 | # 4 | # We define two classes here. 5 | # 6 | # Mark(source, line, column) 7 | # It's just a record and its only use is producing nice error messages. 8 | # Parser does not use it for any other purposes. 9 | # 10 | # Reader(source, data) 11 | # Reader determines the encoding of `data` and converts it to unicode. 12 | # Reader provides the following methods and attributes: 13 | # reader.peek(length=1) - return the next `length` characters 14 | # reader.forward(length=1) - move the current position to `length` characters. 15 | # reader.index - the number of the current character. 16 | # reader.line, stream.column - the line and the column of the current character. 17 | 18 | __all__ = ['Reader', 'ReaderError'] 19 | 20 | from error import YAMLError, Mark 21 | 22 | import codecs, re 23 | 24 | class ReaderError(YAMLError): 25 | 26 | def __init__(self, name, position, character, encoding, reason): 27 | self.name = name 28 | self.character = character 29 | self.position = position 30 | self.encoding = encoding 31 | self.reason = reason 32 | 33 | def __str__(self): 34 | if isinstance(self.character, str): 35 | return "'%s' codec can't decode byte #x%02x: %s\n" \ 36 | " in \"%s\", position %d" \ 37 | % (self.encoding, ord(self.character), self.reason, 38 | self.name, self.position) 39 | else: 40 | return "unacceptable character #x%04x: %s\n" \ 41 | " in \"%s\", position %d" \ 42 | % (self.character, self.reason, 43 | self.name, self.position) 44 | 45 | class Reader(object): 46 | # Reader: 47 | # - determines the data encoding and converts it to unicode, 48 | # - checks if characters are in allowed range, 49 | # - adds '\0' to the end. 50 | 51 | # Reader accepts 52 | # - a `str` object, 53 | # - a `unicode` object, 54 | # - a file-like object with its `read` method returning `str`, 55 | # - a file-like object with its `read` method returning `unicode`. 56 | 57 | # Yeah, it's ugly and slow. 58 | 59 | def __init__(self, stream): 60 | self.name = None 61 | self.stream = None 62 | self.stream_pointer = 0 63 | self.eof = True 64 | self.buffer = u'' 65 | self.pointer = 0 66 | self.raw_buffer = None 67 | self.raw_decode = None 68 | self.encoding = None 69 | self.index = 0 70 | self.line = 0 71 | self.column = 0 72 | if isinstance(stream, unicode): 73 | self.name = "" 74 | self.check_printable(stream) 75 | self.buffer = stream+u'\0' 76 | elif isinstance(stream, str): 77 | self.name = "" 78 | self.raw_buffer = stream 79 | self.determine_encoding() 80 | else: 81 | self.stream = stream 82 | self.name = getattr(stream, 'name', "") 83 | self.eof = False 84 | self.raw_buffer = '' 85 | self.determine_encoding() 86 | 87 | def peek(self, index=0): 88 | try: 89 | return self.buffer[self.pointer+index] 90 | except IndexError: 91 | self.update(index+1) 92 | return self.buffer[self.pointer+index] 93 | 94 | def prefix(self, length=1): 95 | if self.pointer+length >= len(self.buffer): 96 | self.update(length) 97 | return self.buffer[self.pointer:self.pointer+length] 98 | 99 | def forward(self, length=1): 100 | if self.pointer+length+1 >= len(self.buffer): 101 | self.update(length+1) 102 | while length: 103 | ch = self.buffer[self.pointer] 104 | self.pointer += 1 105 | self.index += 1 106 | if ch in u'\n\x85\u2028\u2029' \ 107 | or (ch == u'\r' and self.buffer[self.pointer] != u'\n'): 108 | self.line += 1 109 | self.column = 0 110 | elif ch != u'\uFEFF': 111 | self.column += 1 112 | length -= 1 113 | 114 | def get_mark(self): 115 | if self.stream is None: 116 | return Mark(self.name, self.index, self.line, self.column, 117 | self.buffer, self.pointer) 118 | else: 119 | return Mark(self.name, self.index, self.line, self.column, 120 | None, None) 121 | 122 | def determine_encoding(self): 123 | while not self.eof and len(self.raw_buffer) < 2: 124 | self.update_raw() 125 | if not isinstance(self.raw_buffer, unicode): 126 | if self.raw_buffer.startswith(codecs.BOM_UTF16_LE): 127 | self.raw_decode = codecs.utf_16_le_decode 128 | self.encoding = 'utf-16-le' 129 | elif self.raw_buffer.startswith(codecs.BOM_UTF16_BE): 130 | self.raw_decode = codecs.utf_16_be_decode 131 | self.encoding = 'utf-16-be' 132 | else: 133 | self.raw_decode = codecs.utf_8_decode 134 | self.encoding = 'utf-8' 135 | self.update(1) 136 | 137 | NON_PRINTABLE = re.compile(u'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]') 138 | def check_printable(self, data): 139 | match = self.NON_PRINTABLE.search(data) 140 | if match: 141 | character = match.group() 142 | position = self.index+(len(self.buffer)-self.pointer)+match.start() 143 | raise ReaderError(self.name, position, ord(character), 144 | 'unicode', "special characters are not allowed") 145 | 146 | def update(self, length): 147 | if self.raw_buffer is None: 148 | return 149 | self.buffer = self.buffer[self.pointer:] 150 | self.pointer = 0 151 | while len(self.buffer) < length: 152 | if not self.eof: 153 | self.update_raw() 154 | if self.raw_decode is not None: 155 | try: 156 | data, converted = self.raw_decode(self.raw_buffer, 157 | 'strict', self.eof) 158 | except UnicodeDecodeError, exc: 159 | character = exc.object[exc.start] 160 | if self.stream is not None: 161 | position = self.stream_pointer-len(self.raw_buffer)+exc.start 162 | else: 163 | position = exc.start 164 | raise ReaderError(self.name, position, character, 165 | exc.encoding, exc.reason) 166 | else: 167 | data = self.raw_buffer 168 | converted = len(data) 169 | self.check_printable(data) 170 | self.buffer += data 171 | self.raw_buffer = self.raw_buffer[converted:] 172 | if self.eof: 173 | self.buffer += u'\0' 174 | self.raw_buffer = None 175 | break 176 | 177 | def update_raw(self, size=1024): 178 | data = self.stream.read(size) 179 | if data: 180 | self.raw_buffer += data 181 | self.stream_pointer += len(data) 182 | else: 183 | self.eof = True 184 | 185 | #try: 186 | # import psyco 187 | # psyco.bind(Reader) 188 | #except ImportError: 189 | # pass 190 | 191 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yaml/serializer.py: -------------------------------------------------------------------------------- 1 | 2 | __all__ = ['Serializer', 'SerializerError'] 3 | 4 | from error import YAMLError 5 | from events import * 6 | from nodes import * 7 | 8 | class SerializerError(YAMLError): 9 | pass 10 | 11 | class Serializer(object): 12 | 13 | ANCHOR_TEMPLATE = u'id%03d' 14 | 15 | def __init__(self, encoding=None, 16 | explicit_start=None, explicit_end=None, version=None, tags=None): 17 | self.use_encoding = encoding 18 | self.use_explicit_start = explicit_start 19 | self.use_explicit_end = explicit_end 20 | self.use_version = version 21 | self.use_tags = tags 22 | self.serialized_nodes = {} 23 | self.anchors = {} 24 | self.last_anchor_id = 0 25 | self.closed = None 26 | 27 | def open(self): 28 | if self.closed is None: 29 | self.emit(StreamStartEvent(encoding=self.use_encoding)) 30 | self.closed = False 31 | elif self.closed: 32 | raise SerializerError("serializer is closed") 33 | else: 34 | raise SerializerError("serializer is already opened") 35 | 36 | def close(self): 37 | if self.closed is None: 38 | raise SerializerError("serializer is not opened") 39 | elif not self.closed: 40 | self.emit(StreamEndEvent()) 41 | self.closed = True 42 | 43 | #def __del__(self): 44 | # self.close() 45 | 46 | def serialize(self, node): 47 | if self.closed is None: 48 | raise SerializerError("serializer is not opened") 49 | elif self.closed: 50 | raise SerializerError("serializer is closed") 51 | self.emit(DocumentStartEvent(explicit=self.use_explicit_start, 52 | version=self.use_version, tags=self.use_tags)) 53 | self.anchor_node(node) 54 | self.serialize_node(node, None, None) 55 | self.emit(DocumentEndEvent(explicit=self.use_explicit_end)) 56 | self.serialized_nodes = {} 57 | self.anchors = {} 58 | self.last_anchor_id = 0 59 | 60 | def anchor_node(self, node): 61 | if node in self.anchors: 62 | if self.anchors[node] is None: 63 | self.anchors[node] = self.generate_anchor(node) 64 | else: 65 | self.anchors[node] = None 66 | if isinstance(node, SequenceNode): 67 | for item in node.value: 68 | self.anchor_node(item) 69 | elif isinstance(node, MappingNode): 70 | for key, value in node.value: 71 | self.anchor_node(key) 72 | self.anchor_node(value) 73 | 74 | def generate_anchor(self, node): 75 | self.last_anchor_id += 1 76 | return self.ANCHOR_TEMPLATE % self.last_anchor_id 77 | 78 | def serialize_node(self, node, parent, index): 79 | alias = self.anchors[node] 80 | if node in self.serialized_nodes: 81 | self.emit(AliasEvent(alias)) 82 | else: 83 | self.serialized_nodes[node] = True 84 | self.descend_resolver(parent, index) 85 | if isinstance(node, ScalarNode): 86 | detected_tag = self.resolve(ScalarNode, node.value, (True, False)) 87 | default_tag = self.resolve(ScalarNode, node.value, (False, True)) 88 | implicit = (node.tag == detected_tag), (node.tag == default_tag) 89 | self.emit(ScalarEvent(alias, node.tag, implicit, node.value, 90 | style=node.style)) 91 | elif isinstance(node, SequenceNode): 92 | implicit = (node.tag 93 | == self.resolve(SequenceNode, node.value, True)) 94 | self.emit(SequenceStartEvent(alias, node.tag, implicit, 95 | flow_style=node.flow_style)) 96 | index = 0 97 | for item in node.value: 98 | self.serialize_node(item, node, index) 99 | index += 1 100 | self.emit(SequenceEndEvent()) 101 | elif isinstance(node, MappingNode): 102 | implicit = (node.tag 103 | == self.resolve(MappingNode, node.value, True)) 104 | self.emit(MappingStartEvent(alias, node.tag, implicit, 105 | flow_style=node.flow_style)) 106 | for key, value in node.value: 107 | self.serialize_node(key, node, None) 108 | self.serialize_node(value, node, key) 109 | self.emit(MappingEndEvent()) 110 | self.ascend_resolver() 111 | 112 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yaml/tokens.py: -------------------------------------------------------------------------------- 1 | 2 | class Token(object): 3 | def __init__(self, start_mark, end_mark): 4 | self.start_mark = start_mark 5 | self.end_mark = end_mark 6 | def __repr__(self): 7 | attributes = [key for key in self.__dict__ 8 | if not key.endswith('_mark')] 9 | attributes.sort() 10 | arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) 11 | for key in attributes]) 12 | return '%s(%s)' % (self.__class__.__name__, arguments) 13 | 14 | #class BOMToken(Token): 15 | # id = '' 16 | 17 | class DirectiveToken(Token): 18 | id = '' 19 | def __init__(self, name, value, start_mark, end_mark): 20 | self.name = name 21 | self.value = value 22 | self.start_mark = start_mark 23 | self.end_mark = end_mark 24 | 25 | class DocumentStartToken(Token): 26 | id = '' 27 | 28 | class DocumentEndToken(Token): 29 | id = '' 30 | 31 | class StreamStartToken(Token): 32 | id = '' 33 | def __init__(self, start_mark=None, end_mark=None, 34 | encoding=None): 35 | self.start_mark = start_mark 36 | self.end_mark = end_mark 37 | self.encoding = encoding 38 | 39 | class StreamEndToken(Token): 40 | id = '' 41 | 42 | class BlockSequenceStartToken(Token): 43 | id = '' 44 | 45 | class BlockMappingStartToken(Token): 46 | id = '' 47 | 48 | class BlockEndToken(Token): 49 | id = '' 50 | 51 | class FlowSequenceStartToken(Token): 52 | id = '[' 53 | 54 | class FlowMappingStartToken(Token): 55 | id = '{' 56 | 57 | class FlowSequenceEndToken(Token): 58 | id = ']' 59 | 60 | class FlowMappingEndToken(Token): 61 | id = '}' 62 | 63 | class KeyToken(Token): 64 | id = '?' 65 | 66 | class ValueToken(Token): 67 | id = ':' 68 | 69 | class BlockEntryToken(Token): 70 | id = '-' 71 | 72 | class FlowEntryToken(Token): 73 | id = ',' 74 | 75 | class AliasToken(Token): 76 | id = '' 77 | def __init__(self, value, start_mark, end_mark): 78 | self.value = value 79 | self.start_mark = start_mark 80 | self.end_mark = end_mark 81 | 82 | class AnchorToken(Token): 83 | id = '' 84 | def __init__(self, value, start_mark, end_mark): 85 | self.value = value 86 | self.start_mark = start_mark 87 | self.end_mark = end_mark 88 | 89 | class TagToken(Token): 90 | id = '' 91 | def __init__(self, value, start_mark, end_mark): 92 | self.value = value 93 | self.start_mark = start_mark 94 | self.end_mark = end_mark 95 | 96 | class ScalarToken(Token): 97 | id = '' 98 | def __init__(self, value, plain, start_mark, end_mark, style=None): 99 | self.value = value 100 | self.plain = plain 101 | self.start_mark = start_mark 102 | self.end_mark = end_mark 103 | self.style = style 104 | 105 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yapsy/AutoInstallPluginManager.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*- 3 | 4 | """ 5 | Role 6 | ==== 7 | 8 | Defines plugin managers that can handle the installation of plugin 9 | files into the right place. Then the end-user does not have to browse 10 | to the plugin directory to install them. 11 | 12 | API 13 | === 14 | """ 15 | 16 | import sys 17 | import os 18 | import shutil 19 | import zipfile 20 | import StringIO 21 | 22 | from yapsy.IPlugin import IPlugin 23 | from yapsy.PluginManagerDecorator import PluginManagerDecorator 24 | from yapsy import log 25 | 26 | 27 | class AutoInstallPluginManager(PluginManagerDecorator): 28 | """ 29 | A plugin manager that also manages the installation of the plugin 30 | files into the appropriate directory. 31 | """ 32 | 33 | 34 | def __init__(self, 35 | plugin_install_dir=None, 36 | decorated_manager=None, 37 | # The following args will only be used if we need to 38 | # create a default PluginManager 39 | categories_filter={"Default":IPlugin}, 40 | directories_list=None, 41 | plugin_info_ext="yapsy-plugin"): 42 | """ 43 | Create the plugin manager and set up the directory where to 44 | install new plugins. 45 | 46 | Arguments 47 | 48 | ``plugin_install_dir`` 49 | The directory where new plugins to be installed will be copied. 50 | 51 | .. warning:: If ``plugin_install_dir`` does not correspond to 52 | an element of the ``directories_list``, it is 53 | appended to the later. 54 | 55 | """ 56 | # Create the base decorator class 57 | PluginManagerDecorator.__init__(self, 58 | decorated_manager, 59 | categories_filter, 60 | directories_list, 61 | plugin_info_ext) 62 | # set the directory for new plugins 63 | self.plugins_places=[] 64 | self.setInstallDir(plugin_install_dir) 65 | 66 | def setInstallDir(self,plugin_install_dir): 67 | """ 68 | Set the directory where to install new plugins. 69 | """ 70 | if not (plugin_install_dir in self.plugins_places): 71 | self.plugins_places.append(plugin_install_dir) 72 | self.install_dir = plugin_install_dir 73 | 74 | def getInstallDir(self): 75 | """ 76 | Return the directory where new plugins should be installed. 77 | """ 78 | return self.install_dir 79 | 80 | def install(self, directory, plugin_info_filename): 81 | """ 82 | Giving the plugin's info file (e.g. ``myplugin.yapsy-plugin``), 83 | and the directory where it is located, get all the files that 84 | define the plugin and copy them into the correct directory. 85 | 86 | Return ``True`` if the installation is a success, ``False`` if 87 | it is a failure. 88 | """ 89 | # start collecting essential info about the new plugin 90 | plugin_info, config_parser = self._gatherCorePluginInfo(directory, plugin_info_filename) 91 | # now determine the path of the file to execute, 92 | # depending on wether the path indicated is a 93 | # directory or a file 94 | if not (os.path.exists(plugin_info.path) or os.path.exists(plugin_info.path+".py") ): 95 | log.warning("Could not find the plugin's implementation for %s." % plugin_info.name) 96 | return False 97 | if os.path.isdir(plugin_info.path): 98 | try: 99 | shutil.copytree(plugin_info.path, 100 | os.path.join(self.install_dir,os.path.basename(plugin_info.path))) 101 | shutil.copy(os.path.join(directory, plugin_info_filename), 102 | self.install_dir) 103 | except: 104 | log.error("Could not install plugin: %s." % plugin_info.name) 105 | return False 106 | else: 107 | return True 108 | elif os.path.isfile(plugin_info.path+".py"): 109 | try: 110 | shutil.copy(plugin_info.path+".py", 111 | self.install_dir) 112 | shutil.copy(os.path.join(directory, plugin_info_filename), 113 | self.install_dir) 114 | except: 115 | log.error("Could not install plugin: %s." % plugin_info.name) 116 | return False 117 | else: 118 | return True 119 | else: 120 | return False 121 | 122 | 123 | def installFromZIP(self, plugin_ZIP_filename): 124 | """ 125 | Giving the plugin's zip file (e.g. ``myplugin.zip``), check 126 | that their is a valid info file in it and correct all the 127 | plugin files into the correct directory. 128 | 129 | .. warning:: Only available for python 2.6 and later. 130 | 131 | Return ``True`` if the installation is a success, ``False`` if 132 | it is a failure. 133 | """ 134 | if sys.version_info < (2, 6): 135 | raise NotImplementedError("Installing fom a ZIP file is only supported for Python2.6 and later.") 136 | if not os.path.isfile(plugin_ZIP_filename): 137 | log.warning("Could not find the plugin's zip file at '%s'." % plugin_ZIP_filename) 138 | return False 139 | candidateZipFile = zipfile.ZipFile(plugin_ZIP_filename) 140 | if candidateZipFile.testzip() is not None: 141 | log.warning("Corruption detected in Zip file '%s'." % plugin_ZIP_filename) 142 | return False 143 | zipContent = candidateZipFile.namelist() 144 | log.info("Investigating the content of a zip file containing: '%s'" % zipContent) 145 | log.info("Sanity checks on zip's contained files (looking for hazardous path symbols).") 146 | # check absence of root path and ".." shortcut that would 147 | # send the file oustide the desired directory 148 | for containedFileName in zipContent: 149 | # WARNING: the sanity checks below are certainly not 150 | # exhaustive (maybe we could do something a bit smarter by 151 | # using os.path.expanduser, os.path.expandvars and 152 | # os.path.normpath) 153 | if containedFileName.startswith("/"): 154 | log.warning("Unsecure zip file, rejected because one of its file paths ('%s') starts with '/'" % containedFileName) 155 | return False 156 | if containedFileName.startswith(r"\\") or containedFileName.startswith("//"): 157 | log.warning(r"Unsecure zip file, rejected because one of its file paths ('%s') starts with '\\'" % containedFileName) 158 | return False 159 | if os.path.splitdrive(containedFileName)[0]: 160 | log.warning("Unsecure zip file, rejected because one of its file paths ('%s') starts with a drive letter" % containedFileName) 161 | return False 162 | if os.path.isabs(containedFileName): 163 | log.warning("Unsecure zip file, rejected because one of its file paths ('%s') is absolute" % containedFileName) 164 | return False 165 | pathComponent = os.path.split(containedFileName) 166 | if ".." in pathComponent: 167 | log.warning("Unsecure zip file, rejected because one of its file paths ('%s') contains '..'" % containedFileName) 168 | return False 169 | if "~" in pathComponent: 170 | log.warning("Unsecure zip file, rejected because one of its file paths ('%s') contains '~'" % containedFileName) 171 | return False 172 | infoFileCandidates = [filename for filename in zipContent if os.path.dirname(filename)==""] 173 | if not infoFileCandidates: 174 | log.warning("Zip file structure seems wrong in '%s', no info file found." % plugin_ZIP_filename) 175 | return False 176 | isValid = False 177 | log.info("Looking for the zipped plugin's info file among '%s'" % infoFileCandidates) 178 | for infoFileName in infoFileCandidates: 179 | infoFile = candidateZipFile.read(infoFileName) 180 | log.info("Assuming the zipped plugin info file to be '%s'" % infoFileName) 181 | pluginName,moduleName,_ = self._getPluginNameAndModuleFromStream(StringIO.StringIO(infoFile)) 182 | if moduleName is None: 183 | continue 184 | log.info("Checking existence of the expected module '%s' in the zip file" % moduleName) 185 | if moduleName in zipContent or os.path.join(moduleName,"__init__.py") in zipContent: 186 | isValid = True 187 | break 188 | if not isValid: 189 | log.warning("Zip file structure seems wrong in '%s', " 190 | "could not match info file with the implementation of plugin '%s'." % (plugin_ZIP_filename,pluginName)) 191 | return False 192 | else: 193 | try: 194 | candidateZipFile.extractall(self.install_dir) 195 | return True 196 | except Exception,e: 197 | log.error("Could not install plugin '%s' from zip file '%s' (exception: '%s')." % (pluginName,plugin_ZIP_filename,e)) 198 | return False 199 | 200 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yapsy/FilteredPluginManager.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*- 3 | 4 | """ 5 | Role 6 | ==== 7 | 8 | Defines the basic mechanisms to have a plugin manager filter the 9 | available list of plugins after locating them and before loading them. 10 | 11 | One use fo this would be to prevent untrusted plugins from entering 12 | the system. 13 | 14 | To use it properly you must reimplement or monkey patch the 15 | ``IsPluginOk`` method, as in the following example:: 16 | 17 | # define a plugin manager (with you prefered options) 18 | pm = PluginManager(...) 19 | # decorate it with the Filtering mechanics 20 | pm = FilteredPluginManager(pm) 21 | # define a custom predicate that filters out plugins without descriptions 22 | pm.isPluginOk = lambda x: x.description!="" 23 | 24 | 25 | API 26 | === 27 | """ 28 | 29 | 30 | from yapsy.IPlugin import IPlugin 31 | from yapsy.PluginManagerDecorator import PluginManagerDecorator 32 | 33 | 34 | class FilteredPluginManager(PluginManagerDecorator): 35 | """ 36 | Base class for decorators which filter the plugins list 37 | before they are loaded. 38 | """ 39 | 40 | def __init__(self, 41 | decorated_manager=None, 42 | categories_filter={"Default":IPlugin}, 43 | directories_list=None, 44 | plugin_info_ext="yapsy-plugin"): 45 | """ 46 | """ 47 | # Create the base decorator class 48 | PluginManagerDecorator.__init__(self,decorated_manager, 49 | categories_filter, 50 | directories_list, 51 | plugin_info_ext) 52 | # prepare the mapping of the latest version of each plugin 53 | self.rejectedPlugins = [ ] 54 | 55 | 56 | 57 | def filterPlugins(self): 58 | """ 59 | Go through the currently available candidates, and and either 60 | leaves them, or moves them into the list of rejected Plugins. 61 | 62 | Can be overridden if overriding ``isPluginOk`` sentinel is not 63 | powerful enough. 64 | """ 65 | self.rejectedPlugins = [ ] 66 | for candidate_infofile, candidate_filepath, plugin_info in self._component.getPluginCandidates(): 67 | if not self.isPluginOk( plugin_info): 68 | self.rejectPluginCandidate((candidate_infofile, candidate_filepath, plugin_info) ) 69 | 70 | def rejectPluginCandidate(self,pluginTuple): 71 | """ 72 | Move a plugin from the candidates list to the rejected List. 73 | """ 74 | if pluginTuple in self.getPluginCandidates(): 75 | self._component.removePluginCandidate(pluginTuple) 76 | if not pluginTuple in self.rejectedPlugins: 77 | self.rejectedPlugins.append(pluginTuple) 78 | 79 | def unrejectPluginCandidate(self,pluginTuple): 80 | """ 81 | Move a plugin from the rejected list to into the candidates 82 | list. 83 | """ 84 | if not pluginTuple in self.getPluginCandidates(): 85 | self._component.appendPluginCandidate(pluginTuple) 86 | if pluginTuple in self.rejectedPlugins: 87 | self.rejectedPlugins.remove(pluginTuple) 88 | 89 | def removePluginCandidate(self,pluginTuple): 90 | """ 91 | Remove a plugin from the list of candidates. 92 | """ 93 | if pluginTuple in self.getPluginCandidates(): 94 | self._component.removePluginCandidate(pluginTuple) 95 | if pluginTuple in self.rejectedPlugins: 96 | self.rejectedPlugins.remove(pluginTuple) 97 | 98 | 99 | def appendPluginCandidate(self,pluginTuple): 100 | """ 101 | Add a new candidate. 102 | """ 103 | if self.isPluginOk(pluginTuple[2]): 104 | if pluginTuple not in self.getPluginCandidates(): 105 | self._component.appendPluginCandidate(pluginTuple) 106 | else: 107 | if not pluginTuple in self.rejectedPlugins: 108 | self.rejectedPlugins.append(pluginTuple) 109 | 110 | def isPluginOk(self,info): 111 | """ 112 | Sentinel function to detect if a plugin should be filtered. 113 | 114 | ``info`` is an instance of a ``PluginInfo`` and this method is 115 | expected to return True if the corresponding plugin can be 116 | accepted, and False if it must be filtered out. 117 | 118 | Subclasses should override this function and return false for 119 | any plugin which they do not want to be loadable. 120 | """ 121 | return True 122 | 123 | def locatePlugins(self): 124 | """ 125 | locate and filter plugins. 126 | """ 127 | #Reset Catalogue 128 | self.setCategoriesFilter(self._component.categories_interfaces) 129 | #Reread and filter. 130 | self._component.locatePlugins() 131 | self.filterPlugins() 132 | return len(self._component.getPluginCandidates()) 133 | 134 | def getRejectedPlugins(self): 135 | """ 136 | Return the list of rejected plugins. 137 | """ 138 | return self.rejectedPlugins[:] 139 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yapsy/IPlugin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*- 3 | 4 | 5 | """ 6 | Role 7 | ==== 8 | 9 | Defines the basic interfaces for a plugin. These interfaces are 10 | inherited by the *core* class of a plugin. The *core* class of a 11 | plugin is then the one that will be notified the 12 | activation/deactivation of a plugin via the ``activate/deactivate`` 13 | methods. 14 | 15 | 16 | For simple (near trivial) plugin systems, one can directly use the 17 | following interfaces. 18 | 19 | Extensibility 20 | ============= 21 | 22 | In your own software, you'll probably want to build derived classes of 23 | the ``IPlugin`` class as it is a mere interface with no specific 24 | functionality. 25 | 26 | Your software's plugins should then inherit your very own plugin class 27 | (itself derived from ``IPlugin``). 28 | 29 | Where and how to code these plugins is explained in the section about 30 | the :doc:`PluginManager`. 31 | 32 | 33 | API 34 | === 35 | """ 36 | 37 | 38 | class IPlugin(object): 39 | """ 40 | The most simple interface to be inherited when creating a plugin. 41 | """ 42 | 43 | def __init__(self): 44 | """ 45 | Set the basic variables. 46 | """ 47 | self.is_activated = False 48 | 49 | def activate(self): 50 | """ 51 | Called at plugin activation. 52 | """ 53 | self.is_activated = True 54 | 55 | def deactivate(self): 56 | """ 57 | Called when the plugin is disabled. 58 | """ 59 | self.is_activated = False 60 | 61 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yapsy/IPluginLocator.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*- 3 | 4 | 5 | 6 | """ 7 | Role 8 | ==== 9 | 10 | ``IPluginLocator`` defines the basic interface expected by a 11 | ``PluginManager`` to be able to locate plugins and get basic info 12 | about each discovered plugin (name, version etc). 13 | 14 | API 15 | === 16 | 17 | """ 18 | 19 | 20 | from yapsy import log 21 | 22 | class IPluginLocator(object): 23 | """ 24 | Plugin Locator interface with some methods already implemented to 25 | manage the awkward backward compatible stuff. 26 | """ 27 | 28 | def locatePlugins(self): 29 | """ 30 | Walk through the plugins' places and look for plugins. 31 | 32 | Return the discovered plugins as a list of 33 | ``(candidate_infofile_path, candidate_file_path,plugin_info_instance)`` 34 | and their number. 35 | """ 36 | raise NotImplementedError("locatePlugins must be reimplemented by %s" % self) 37 | 38 | def gatherCorePluginInfo(self, directory, filename): 39 | """ 40 | Return a ``PluginInfo`` as well as the ``ConfigParser`` used to build it. 41 | 42 | If filename is a valid plugin discovered by any of the known 43 | strategy in use. Returns None,None otherwise. 44 | """ 45 | raise NotImplementedError("gatherPluginInfo must be reimplemented by %s" % self) 46 | 47 | # -------------------------------------------------------------------- 48 | # Below are backward compatibility methods: if you inherit from 49 | # IPluginLocator it's ok not to reimplement them, there will only 50 | # be a warning message logged if they are called and not 51 | # reimplemented. 52 | # -------------------------------------------------------------------- 53 | 54 | def getPluginNameAndModuleFromStream(self,fileobj): 55 | """ 56 | DEPRECATED(>1.9): kept for backward compatibility 57 | with existing PluginManager child classes. 58 | 59 | Return a 3-uple with the name of the plugin, its 60 | module and the config_parser used to gather the core 61 | data *in a tuple*, if the required info could be 62 | localised, else return ``(None,None,None)``. 63 | """ 64 | log.warn("setPluginInfoClass was called but '%s' doesn't implement it." % self) 65 | return None,None,None 66 | 67 | 68 | def setPluginInfoClass(self, picls, names=None): 69 | """ 70 | DEPRECATED(>1.9): kept for backward compatibility 71 | with existing PluginManager child classes. 72 | 73 | Set the class that holds PluginInfo. The class should inherit 74 | from ``PluginInfo``. 75 | """ 76 | log.warn("setPluginInfoClass was called but '%s' doesn't implement it." % self) 77 | 78 | def getPluginInfoClass(self): 79 | """ 80 | DEPRECATED(>1.9): kept for backward compatibility 81 | with existing PluginManager child classes. 82 | 83 | Get the class that holds PluginInfo. 84 | """ 85 | log.warn("getPluginInfoClass was called but '%s' doesn't implement it." % self) 86 | return None 87 | 88 | def setPluginPlaces(self, directories_list): 89 | """ 90 | DEPRECATED(>1.9): kept for backward compatibility 91 | with existing PluginManager child classes. 92 | 93 | Set the list of directories where to look for plugin places. 94 | """ 95 | log.warn("setPluginPlaces was called but '%s' doesn't implement it." % self) 96 | 97 | def updatePluginPlaces(self, directories_list): 98 | """ 99 | DEPRECATED(>1.9): kept for backward compatibility 100 | with existing PluginManager child classes. 101 | 102 | Updates the list of directories where to look for plugin places. 103 | """ 104 | log.warn("updatePluginPlaces was called but '%s' doesn't implement it." % self) 105 | 106 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yapsy/PluginInfo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*- 3 | 4 | 5 | """ 6 | Role 7 | ==== 8 | 9 | Encapsulate a plugin instance as well as some metadata. 10 | 11 | API 12 | === 13 | """ 14 | 15 | from ConfigParser import ConfigParser 16 | from distutils.version import StrictVersion 17 | 18 | 19 | class PluginInfo(object): 20 | """Representation of the most basic set of information related to a 21 | given plugin such as its name, author, description... 22 | 23 | Any additional information can be stored ad retrieved in a 24 | PluginInfo, when this one is created with a 25 | ``ConfigParser.ConfigParser`` instance. 26 | 27 | This typically means that when metadata is read from a text file 28 | (the original way for yapsy to describe plugins), all info that is 29 | not part of the basic variables (name, path, version etc), can 30 | still be accessed though the ``details`` member variables that 31 | behaves like Python's ``ConfigParser.ConfigParser``. 32 | 33 | Warning: the instance associated with the ``details`` member 34 | variable is never copied and used to store all plugin infos. If 35 | you set it to a custom instance, it will be modified as soon as 36 | another member variale of the plugin info is 37 | changed. Alternatively, if you change the instance "outside" the 38 | plugin info, it will also change the plugin info. 39 | """ 40 | 41 | def __init__(self, plugin_name, plugin_path): 42 | """ 43 | Set the basic information (at least name and path) about the 44 | plugin as well as the default values for other usefull 45 | variables. 46 | 47 | *plugin_name* is a simple string describing the name of 48 | the plugin. 49 | 50 | *plugin_path* describe the location where the plugin can be 51 | found. 52 | 53 | .. warning:: The ``path`` attribute is the full path to the 54 | plugin if it is organised as a directory or the 55 | full path to a file without the ``.py`` extension 56 | if the plugin is defined by a simple file. In the 57 | later case, the actual plugin is reached via 58 | ``plugin_info.path+'.py'``. 59 | """ 60 | self.__details = ConfigParser() 61 | self.name = plugin_name 62 | self.path = plugin_path 63 | self._ensureDetailsDefaultsAreBackwardCompatible() 64 | # Storage for stuff created during the plugin lifetime 65 | self.plugin_object = None 66 | self.categories = [] 67 | self.error = None 68 | 69 | 70 | def __setDetails(self,cfDetails): 71 | """ 72 | Fill in all details by storing a ``ConfigParser`` instance. 73 | 74 | .. warning: The values for ``plugin_name`` and 75 | ``plugin_path`` given a init time will superseed 76 | any value found in ``cfDetails`` in section 77 | 'Core' for the options 'Name' and 'Module' (this 78 | is mostly for backward compatibility). 79 | """ 80 | bkp_name = self.name 81 | bkp_path = self.path 82 | self.__details = cfDetails 83 | self.name = bkp_name 84 | self.path = bkp_path 85 | self._ensureDetailsDefaultsAreBackwardCompatible() 86 | 87 | def __getDetails(self): 88 | return self.__details 89 | 90 | def __getName(self): 91 | return self.details.get("Core","Name") 92 | 93 | def __setName(self, name): 94 | if not self.details.has_section("Core"): 95 | self.details.add_section("Core") 96 | self.details.set("Core","Name",name) 97 | 98 | 99 | def __getPath(self): 100 | return self.details.get("Core","Module") 101 | 102 | def __setPath(self,path): 103 | if not self.details.has_section("Core"): 104 | self.details.add_section("Core") 105 | self.details.set("Core","Module",path) 106 | 107 | 108 | def __getVersion(self): 109 | return StrictVersion(self.details.get("Documentation","Version")) 110 | 111 | def setVersion(self, vstring): 112 | """ 113 | Set the version of the plugin. 114 | 115 | Used by subclasses to provide different handling of the 116 | version number. 117 | """ 118 | if isinstance(vstring,StrictVersion): 119 | vstring = str(vstring) 120 | if not self.details.has_section("Documentation"): 121 | self.details.add_section("Documentation") 122 | self.details.set("Documentation","Version",vstring) 123 | 124 | def __getAuthor(self): 125 | return self.details.get("Documentation","Author") 126 | 127 | def __setAuthor(self,author): 128 | if not self.details.has_section("Documentation"): 129 | self.details.add_section("Documentation") 130 | self.details.set("Documentation","Author",author) 131 | 132 | 133 | def __getCopyright(self): 134 | return self.details.get("Documentation","Copyright") 135 | 136 | def __setCopyright(self,copyrightTxt): 137 | if not self.details.has_section("Documentation"): 138 | self.details.add_section("Documentation") 139 | self.details.set("Documentation","Copyright",copyrightTxt) 140 | 141 | 142 | def __getWebsite(self): 143 | return self.details.get("Documentation","Website") 144 | 145 | def __setWebsite(self,website): 146 | if not self.details.has_section("Documentation"): 147 | self.details.add_section("Documentation") 148 | self.details.set("Documentation","Website",website) 149 | 150 | 151 | def __getDescription(self): 152 | return self.details.get("Documentation","Description") 153 | 154 | def __setDescription(self,description): 155 | if not self.details.has_section("Documentation"): 156 | self.details.add_section("Documentation") 157 | return self.details.set("Documentation","Description",description) 158 | 159 | 160 | def __getCategory(self): 161 | """ 162 | DEPRECATED (>1.9): Mimic former behaviour when what is 163 | noz the first category was considered as the only one the 164 | plugin belonged to. 165 | """ 166 | if self.categories: 167 | return self.categories[0] 168 | else: 169 | return "UnknownCategory" 170 | 171 | def __setCategory(self,c): 172 | """ 173 | DEPRECATED (>1.9): Mimic former behaviour by making so 174 | that if a category is set as it it was the only category to 175 | which the plugin belongs, then a __getCategory will return 176 | this newly set category. 177 | """ 178 | self.categories = [c] + self.categories 179 | 180 | name = property(fget=__getName,fset=__setName) 181 | path = property(fget=__getPath,fset=__setPath) 182 | version = property(fget=__getVersion,fset=setVersion) 183 | author = property(fget=__getAuthor,fset=__setAuthor) 184 | copyright = property(fget=__getCopyright,fset=__setCopyright) 185 | website = property(fget=__getWebsite,fset=__setWebsite) 186 | description = property(fget=__getDescription,fset=__setDescription) 187 | details = property(fget=__getDetails,fset=__setDetails) 188 | # deprecated (>1.9): plugins are not longer associated to a 189 | # single category ! 190 | category = property(fget=__getCategory,fset=__setCategory) 191 | 192 | def _getIsActivated(self): 193 | """ 194 | Return the activated state of the plugin object. 195 | Makes it possible to define a property. 196 | """ 197 | return self.plugin_object.is_activated 198 | 199 | is_activated = property(fget=_getIsActivated) 200 | 201 | def _ensureDetailsDefaultsAreBackwardCompatible(self): 202 | """ 203 | Internal helper function. 204 | """ 205 | if not self.details.has_option("Documentation","Author"): 206 | self.author = "Unknown" 207 | if not self.details.has_option("Documentation","Version"): 208 | self.version = "0.0" 209 | if not self.details.has_option("Documentation","Website"): 210 | self.website = "None" 211 | if not self.details.has_option("Documentation","Copyright"): 212 | self.copyright = "Unknown" 213 | if not self.details.has_option("Documentation","Description"): 214 | self.description = "" 215 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yapsy/PluginManagerDecorator.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*- 3 | 4 | 5 | """ 6 | Role 7 | ==== 8 | 9 | Provide an easy way to build a chain of decorators extending the 10 | functionalities of the default plugin manager, when it comes to 11 | activating, deactivating or looking into loaded plugins. 12 | 13 | The ``PluginManagerDecorator`` is the base class to be inherited by 14 | each element of the chain of decorator. 15 | 16 | .. warning:: If you want to customise the way the plugins are detected 17 | and loaded, you should not try to do it by implementing a 18 | new ``PluginManagerDecorator``. Instead, you'll have to 19 | reimplement the :doc:`PluginManager` itself. And if you 20 | do so by enforcing the ``PluginManager`` interface, just 21 | giving an instance of your new manager class to the 22 | ``PluginManagerDecorator`` should be transparent to the 23 | "stantard" decorators. 24 | 25 | API 26 | === 27 | """ 28 | 29 | import os 30 | 31 | from yapsy.IPlugin import IPlugin 32 | from yapsy import log 33 | 34 | 35 | class PluginManagerDecorator(object): 36 | """ 37 | Add several responsibilities to a plugin manager object in a 38 | more flexible way than by mere subclassing. This is indeed an 39 | implementation of the Decorator Design Patterns. 40 | 41 | 42 | There is also an additional mechanism that allows for the 43 | automatic creation of the object to be decorated when this object 44 | is an instance of PluginManager (and not an instance of its 45 | subclasses). This way we can keep the plugin managers creation 46 | simple when the user don't want to mix a lot of 'enhancements' on 47 | the base class. 48 | """ 49 | 50 | def __init__(self, decorated_object=None, 51 | # The following args will only be used if we need to 52 | # create a default PluginManager 53 | categories_filter={"Default":IPlugin}, 54 | directories_list=[os.path.dirname(__file__)], 55 | plugin_info_ext="yapsy-plugin"): 56 | """ 57 | Mimics the PluginManager's __init__ method and wraps an 58 | instance of this class into this decorator class. 59 | 60 | - *If the decorated_object is not specified*, then we use the 61 | PluginManager class to create the 'base' manager, and to do 62 | so we will use the arguments: ``categories_filter``, 63 | ``directories_list``, and ``plugin_info_ext`` or their 64 | default value if they are not given. 65 | 66 | - *If the decorated object is given*, these last arguments are 67 | simply **ignored** ! 68 | 69 | All classes (and especially subclasses of this one) that want 70 | to be a decorator must accept the decorated manager as an 71 | object passed to the init function under the exact keyword 72 | ``decorated_object``. 73 | """ 74 | 75 | if decorated_object is None: 76 | log.debug("Creating a default PluginManager instance to be decorated.") 77 | from yapsy.PluginManager import PluginManager 78 | decorated_object = PluginManager(categories_filter, 79 | directories_list, 80 | plugin_info_ext) 81 | self._component = decorated_object 82 | 83 | def __getattr__(self,name): 84 | """ 85 | Decorator trick copied from: 86 | http://www.pasteur.fr/formation/infobio/python/ch18s06.html 87 | """ 88 | # print "looking for %s in %s" % (name, self.__class__) 89 | return getattr(self._component,name) 90 | 91 | 92 | def collectPlugins(self): 93 | """ 94 | This function will usually be a shortcut to successively call 95 | ``self.locatePlugins`` and then ``self.loadPlugins`` which are 96 | very likely to be redefined in each new decorator. 97 | 98 | So in order for this to keep on being a "shortcut" and not a 99 | real pain, I'm redefining it here. 100 | """ 101 | self.locatePlugins() 102 | self.loadPlugins() 103 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yapsy/VersionedPluginManager.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*- 3 | 4 | """ 5 | Role 6 | ==== 7 | 8 | Defines the basic interface for a plugin manager that also keeps track 9 | of versions of plugins 10 | 11 | API 12 | === 13 | """ 14 | 15 | 16 | from distutils.version import StrictVersion 17 | 18 | from yapsy.PluginInfo import PluginInfo 19 | from yapsy.IPlugin import IPlugin 20 | from yapsy.PluginManagerDecorator import PluginManagerDecorator 21 | 22 | 23 | class VersionedPluginInfo(PluginInfo): 24 | """ 25 | Gather some info about a plugin such as its name, author, 26 | description... 27 | """ 28 | 29 | def __init__(self, plugin_name, plugin_path): 30 | """ 31 | Set the name and path of the plugin as well as the default 32 | values for other usefull variables. 33 | """ 34 | PluginInfo.__init__(self, plugin_name, plugin_path) 35 | # version number is now required to be a StrictVersion object 36 | self.version = StrictVersion("0.0") 37 | 38 | def setVersion(self, vstring): 39 | self.version = StrictVersion(vstring) 40 | 41 | 42 | class VersionedPluginManager(PluginManagerDecorator): 43 | """ 44 | Handle plugin versioning by making sure that when several 45 | versions are present for a same plugin, only the latest version is 46 | manipulated via the standard methods (eg for activation and 47 | deactivation) 48 | 49 | More precisely, for operations that must be applied on a single 50 | named plugin at a time (``getPluginByName``, 51 | ``activatePluginByName``, ``deactivatePluginByName`` etc) the 52 | targetted plugin will always be the one with the latest version. 53 | 54 | .. note:: The older versions of a given plugin are still reachable 55 | via the ``getPluginsOfCategoryFromAttic`` method. 56 | """ 57 | 58 | def __init__(self, 59 | decorated_manager=None, 60 | categories_filter={"Default":IPlugin}, 61 | directories_list=None, 62 | plugin_info_ext="yapsy-plugin"): 63 | """ 64 | Create the plugin manager and record the ConfigParser instance 65 | that will be used afterwards. 66 | 67 | The ``config_change_trigger`` argument can be used to set a 68 | specific method to call when the configuration is 69 | altered. This will let the client application manage the way 70 | they want the configuration to be updated (e.g. write on file 71 | at each change or at precise time intervalls or whatever....) 72 | """ 73 | # Create the base decorator class 74 | PluginManagerDecorator.__init__(self,decorated_manager, 75 | categories_filter, 76 | directories_list, 77 | plugin_info_ext) 78 | self.setPluginInfoClass(VersionedPluginInfo) 79 | # prepare the storage for the early version of the plugins, 80 | # for which only the latest version is the one that will be 81 | # kept in the "core" plugin storage. 82 | self._prepareAttic() 83 | 84 | def _prepareAttic(self): 85 | """ 86 | Create and correctly initialize the storage where the wrong 87 | version of the plugins will be stored. 88 | """ 89 | self._attic = {} 90 | for categ in self.getCategories(): 91 | self._attic[categ] = [] 92 | 93 | 94 | def getLatestPluginsOfCategory(self,category_name): 95 | """ 96 | DEPRECATED(>1.8): Please consider using getPluginsOfCategory 97 | instead. 98 | 99 | Return the list of all plugins belonging to a category. 100 | """ 101 | return self.getPluginsOfCategory(category_name) 102 | 103 | def loadPlugins(self, callback=None): 104 | """ 105 | Load the candidate plugins that have been identified through a 106 | previous call to locatePlugins. 107 | 108 | In addition to the baseclass functionality, this subclass also 109 | needs to find the latest version of each plugin. 110 | """ 111 | self._component.loadPlugins(callback) 112 | for categ in self.getCategories(): 113 | latest_plugins = {} 114 | allPlugins = self.getPluginsOfCategory(categ) 115 | # identify the latest version of each plugin 116 | for plugin in allPlugins: 117 | name = plugin.name 118 | version = plugin.version 119 | if name in latest_plugins: 120 | if version > latest_plugins[name].version: 121 | older_plugin = latest_plugins[name] 122 | latest_plugins[name] = plugin 123 | self.removePluginFromCategory(older_plugin,categ) 124 | self._attic[categ].append(older_plugin) 125 | else: 126 | self.removePluginFromCategory(plugin,categ) 127 | self._attic[categ].append(plugin) 128 | else: 129 | latest_plugins[name] = plugin 130 | 131 | def getPluginsOfCategoryFromAttic(self,categ): 132 | """ 133 | Access the older version of plugins for which only the latest 134 | version is available through standard methods. 135 | """ 136 | return self._attic[categ] 137 | 138 | -------------------------------------------------------------------------------- /PAV/special_pkgs/yapsy/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*- 3 | 4 | """ 5 | 6 | Overview 7 | ======== 8 | 9 | Yapsy's main purpose is to offer a way to easily design a plugin 10 | system in Python, and motivated by the fact that many other Python 11 | plugin system are either too complicated for a basic use or depend on 12 | a lot of libraries. Yapsy only depends on Python's standard library. 13 | 14 | |yapsy| basically defines two core classes: 15 | 16 | - a fully functional though very simple ``PluginManager`` class 17 | 18 | - an interface ``IPlugin`` which defines the interface of plugin 19 | instances handled by the ``PluginManager`` 20 | 21 | 22 | Getting started 23 | =============== 24 | 25 | The basic classes defined by |yapsy| should work "as is" and enable 26 | you to load and activate your plugins. So that the following code 27 | should get you a fully working plugin management system:: 28 | 29 | from yapsy.PluginManager import PluginManager 30 | 31 | # Build the manager 32 | simplePluginManager = PluginManager() 33 | # Tell it the default place(s) where to find plugins 34 | simplePluginManager.setPluginPlaces(["path/to/myplugins"]) 35 | # Load all plugins 36 | simplePluginManager.collectPlugins() 37 | 38 | # Activate all loaded plugins 39 | for pluginInfo in simplePluginManager.getAllPlugins(): 40 | simplePluginManager.activatePluginByName(pluginInfo.name) 41 | 42 | 43 | .. note:: The ``plugin_info`` object (typically an instance of 44 | ``IPlugin``) plays as *the entry point of each 45 | plugin*. That's also where |yapsy| ceases to guide you: it's 46 | up to you to define what your plugins can do and how you 47 | want to talk to them ! Talking to your plugin will then look 48 | very much like the following:: 49 | 50 | # Trigger 'some action' from the loaded plugins 51 | for pluginInfo in simplePluginManager.getAllPlugins(): 52 | pluginInfo.plugin_object.doSomething(...) 53 | 54 | """ 55 | 56 | __version__="1.10.323" 57 | 58 | # tell epydoc that the documentation is in the reStructuredText format 59 | __docformat__ = "restructuredtext en" 60 | 61 | # provide a default named log for package-wide use 62 | import logging 63 | log = logging.getLogger('yapsy') 64 | 65 | # Some constants concerning the plugins 66 | PLUGIN_NAME_FORBIDEN_STRING=";;" 67 | """ 68 | .. warning:: This string (';;' by default) is forbidden in plugin 69 | names, and will be usable to describe lists of plugins 70 | for instance (see :doc:`ConfigurablePluginManager`) 71 | """ 72 | 73 | import re 74 | def NormalizePluginNameForModuleName(pluginName): 75 | """ 76 | Normalize a plugin name into a safer name for a module name. 77 | 78 | .. note:: may do a little more modifications than strictly 79 | necessary and is not optimized for speed. 80 | """ 81 | if len(pluginName)==0: 82 | return "_" 83 | if pluginName[0].isdigit(): 84 | pluginName = "_" + pluginName 85 | return re.sub("\W","_",pluginName) 86 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #Pavilion 2 | ========= 3 | 4 | LA-CC-15-041 5 | 6 | Pavilion is a software framework for running and analyzing jobs/tests targeting HPC systems. 7 | > Python 2.7 based 8 | 9 | 10 | Usage: 11 | ```sh 12 | set the ENV variable PVINSTALL to point to the installation directory 13 | (for example - "setenv PVINSTALL /users/me/pavilion") 14 | add to your search path this directory plus "/PAV" 15 | (for example - "setenv PATH ${PVINSTALL}/PAV:${PVINSTALL}/PAV/scripts:${PATH}") 16 | create own default and test specific config files. See examples in $PVINSTALL/docs dir 17 | run the tool - "pav -h" 18 | ``` 19 | 20 | Version 1.1.2 21 | 22 | > Verified to work with Moab scheduler thus far. 23 | > Support for both for Slurm and Raw in version 1.1.0. 24 | 25 | 26 | Collaboration tips: 27 | 28 | - add new features (sub-commands) to the plugins directory or 29 | append new path to the ENV variable PV_PLUGIN_DIR and place code there. 30 | - all remaining support code add to the modules directory or append to the 31 | ENV variable PV_SRC_DIR and place code there. 32 | - add support scripts in other languages to the scripts directory 33 | 34 | ==== 35 | 36 | Project goals: 37 | 38 | - Support multiple schedulers/resource managers 39 | - Modular to encourage collaboration 40 | - Simple to add tests, but highly configurable 41 | - Backward compatible (where reasonable) to the Gazebo test framework 42 | - Development adheres to a well know set of developement and coding principles 43 | - Open source and managed thru git 44 | - No extra files necessary to be placed into users test/job directory to hook into Pavilion 45 | - Only one command needed to run cli. Sub commands under "pav" umbrella 46 | 47 | ==== 48 | 49 | See the README.txt file in the docs directory for more detailed information 50 | -------------------------------------------------------------------------------- /docs/Abstract.txt: -------------------------------------------------------------------------------- 1 | # ################################################################### 2 | # 3 | # Disclaimer and Notice of Copyright 4 | # ================================== 5 | # 6 | # Copyright (c) 2015, Los Alamos National Security, LLC 7 | # All rights reserved. 8 | # 9 | # Copyright 2015. Los Alamos National Security, LLC. 10 | # This software was produced under U.S. Government contract 11 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 12 | # which is operated by Los Alamos National Security, LLC for 13 | # the U.S. Department of Energy. The U.S. Government has rights 14 | # to use, reproduce, and distribute this software. NEITHER 15 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 16 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 17 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 18 | # produce derivative works, such modified software should be 19 | # clearly marked, so as not to confuse it with the version 20 | # available from LANL. 21 | # 22 | # Additionally, redistribution and use in source and binary 23 | # forms, with or without modification, are permitted provided 24 | # that the following conditions are met: 25 | # 26 | # 1. Redistributions of source code must retain the 27 | # above copyright notice, this list of conditions 28 | # and the following disclaimer. 29 | # 2. Redistributions in binary form must reproduce the 30 | # above copyright notice, this list of conditions 31 | # and the following disclaimer in the documentation 32 | # and/or other materials provided with the distribution. 33 | # 3. Neither the name of Los Alamos National Security, LLC, 34 | # Los Alamos National Laboratory, LANL, the U.S. Government, 35 | # nor the names of its contributors may be used to endorse 36 | # or promote products derived from this software without 37 | # specific prior written permission. 38 | # 39 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 40 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 41 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 42 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 43 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 44 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 45 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 46 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 47 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 49 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 50 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 51 | # OF SUCH DAMAGE. 52 | # 53 | # ################################################################### 54 | 55 | Pavilion HPC Testing Framework 56 | 57 | 58 | High Performance Computing clusters require a diverse set of methods to verify that they meet their intended 59 | performance, stability, and functional design objectives. One method, testing, takes place over the entire life-cycle of a system 60 | with an emphasis on testing before, and after it's shipped to the customer and after significant system changes. 61 | To efficiently use a set of tests that may have very different setup, user interface, and result footprints 62 | a framework is needed that can control and bundle all these tests and quickly produce a common set of interpretable results. 63 | This software, called Pavilion, is such a framework. Many of its underlying ideas come from a prior framework 64 | developed at LANL between 2007 and 2013. Lessons learned, new feature requests that the old framework couldn't employ, and other 65 | adaptable good ideas are all embodied into this new framework. Two principle components that are forefront in Pavilion's 66 | design are the ability to support schedulers other than just Moab and a structure that lends itself to team collaboration. 67 | The framework itself does not contain any specific tests, but is a mechanism for running and creative analysis of the 68 | output data of any set of incorporated tests. 69 | -------------------------------------------------------------------------------- /docs/Build-Notes.txt: -------------------------------------------------------------------------------- 1 | Pavilion Testing Framework 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # 28 | # 1. Redistributions of source code must retain the 29 | # above copyright notice, this list of conditions 30 | # and the following disclaimer. 31 | # 2. Redistributions in binary form must reproduce the 32 | # above copyright notice, this list of conditions 33 | # and the following disclaimer in the documentation 34 | # and/or other materials provided with the distribution. 35 | # 3. Neither the name of Los Alamos National Security, LLC, 36 | # Los Alamos National Laboratory, LANL, the U.S. Government, 37 | # nor the names of its contributors may be used to endorse 38 | # or promote products derived from this software without 39 | # specific prior written permission. 40 | # 41 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 42 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 43 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 44 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 45 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 46 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 47 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 48 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 49 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 51 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 52 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 53 | # OF SUCH DAMAGE. 54 | # 55 | # ################################################################### 56 | 57 | Build Notes 58 | 59 | - all from within the top level install directory.... 60 | 61 | To build a src distribution tar file: 62 | 63 | - edit the setup.py file appropriately 64 | - add files to include in the MANIFEST.in file 65 | - from this directory run -> "/usr/bin/python setup.py sdist" 66 | - the tar file placed in "dist" directory 67 | 68 | To build rpms: 69 | 70 | - move the tar file created above to a linux system that supports rpm builds 71 | ( for example: rpmbuild is installed ) 72 | - untar into some writeable working directory 73 | - cd to that working directory 74 | - run "python setup.py bdist_rpm" 75 | - the tar and RPM files are placed into the dist sub directory 76 | 77 | -------------------------------------------------------------------------------- /docs/DevelopmentGuidelines.txt: -------------------------------------------------------------------------------- 1 | Pavilion HPC Testing Framework 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # 28 | # 1. Redistributions of source code must retain the 29 | # above copyright notice, this list of conditions 30 | # and the following disclaimer. 31 | # 2. Redistributions in binary form must reproduce the 32 | # above copyright notice, this list of conditions 33 | # and the following disclaimer in the documentation 34 | # and/or other materials provided with the distribution. 35 | # 3. Neither the name of Los Alamos National Security, LLC, 36 | # Los Alamos National Laboratory, LANL, the U.S. Government, 37 | # nor the names of its contributors may be used to endorse 38 | # or promote products derived from this software without 39 | # specific prior written permission. 40 | # 41 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 42 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 43 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 44 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 45 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 46 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 47 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 48 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 49 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 51 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 52 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 53 | # OF SUCH DAMAGE. 54 | # 55 | # ################################################################### 56 | 57 | 58 | Guidlines to follow for cohesive team product development. 59 | 60 | 61 | 1. Code - Generally being developed in Python. However, in cases where a shell script or other language makes sense, use it. 62 | 63 | 1.1 Style 64 | 65 | Idiomatic Python - http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html 66 | 67 | 1.2 Language References 68 | 69 | - http://www.greenteapress.com/thinkpython/thinkpython.pdf (nice, but more introductory) 70 | - http://www.diveintopython3.net 71 | 72 | 73 | 2. Coding Process/Philosphy 74 | ------- 75 | 76 | 2.1 Code Sharing 77 | 78 | 2.1.1 To be stored github 79 | 80 | 2.1.2 Team development with Git - http://blog.ericbmerritt.com/2011/12/05/team-development-with-git.html 81 | 82 | 2.2 Directory Structure /PAV 83 | 84 | 2.2.1 All source code under the PAV directory 85 | 86 | 2.2.1 Add new sub-commands in Plugins, with all "new" support code added to modules directory, under PAV. 87 | 88 | 2.2.2 External packages (outside of the standard Python distro) collected under special_pkgs directory, under PAV 89 | 90 | 2.3 Unit or Self testing to be used to verify correctness of code before any new release in test directory. 91 | 92 | 2.4 Use setting up and using Virtual Environments to improve development process 93 | 94 | - http://jeffknupp.com/blog/2014/02/04/starting-a-python-project-the-right-way/ 95 | 96 | 3. Adding new features (please do!) 97 | 98 | - If you want to add a new sub-command it gets placed in the plugins directory under PAV. 99 | Use one of the existing ones from the plugins directory as an example. 100 | - New Python code that is not a sub-command gets placed in the modules directory under PAV. 101 | - If a new feature to Pavilion requires extensive configuration settings, as opposed to arguments passed to it, 102 | consider addition a new stanza/section to the default config YAML. A new scheduler of some type would probably 103 | be a case for this. Both Moab and LDMS use this method. 104 | 105 | 4. Suggestions/Constructive Ideas 106 | 107 | - Please add new features to this software. Especially support for new schedulers, new results analysis tools, and 108 | more unit testing. Also, if you see code that you feel you can improve, have at it. Let us know what you are up by 109 | sending e-mail to gazebo@lanl.gov and note Pavilion in the subject line. Code changes and updates to the main trunk of 110 | the source will be subject to a review for appropriateness. 111 | 112 | Thanks, 113 | The Pavilion Development Team 114 | -------------------------------------------------------------------------------- /docs/Example-default_test_config.yaml: -------------------------------------------------------------------------------- 1 | ../test_suites/default_test_config.yaml -------------------------------------------------------------------------------- /docs/Example-simple_test_config.yaml: -------------------------------------------------------------------------------- 1 | # YAML 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # 28 | # 1. Redistributions of source code must retain the 29 | # above copyright notice, this list of conditions 30 | # and the following disclaimer. 31 | # 2. Redistributions in binary form must reproduce the 32 | # above copyright notice, this list of conditions 33 | # and the following disclaimer in the documentation 34 | # and/or other materials provided with the distribution. 35 | # 3. Neither the name of Los Alamos National Security, LLC, 36 | # Los Alamos National Laboratory, LANL, the U.S. Government, 37 | # nor the names of its contributors may be used to endorse 38 | # or promote products derived from this software without 39 | # specific prior written permission. 40 | # 41 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 42 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 43 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 44 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 45 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 46 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 47 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 48 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 49 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 51 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 52 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 53 | # OF SUCH DAMAGE. 54 | # 55 | # ################################################################### 56 | 57 | # for YAML formatting issues try: http://yaml-online-parser.appspot.com 58 | 59 | # A new named stanza is needed for each new test, 60 | # but you only need to change what's different from the 61 | # this default test_config file 62 | 63 | # Default testSuite override. Change even the default file that's used. 64 | # Uncomment and place in user defined testSuite with 65 | # a fully qualified path/name or just name of the file. 66 | # DefaultTestSuite: default_test_suite.yaml 67 | 68 | # Unique (to the test suite being used) test/job identifier. Any string will do. 69 | # Do Not add a value to the right side of this id! 70 | Id1: 71 | 72 | name: myTest 73 | 74 | # uri of test, probably a directory name 75 | source_location: /usr/me/tests/myTest 76 | 77 | # Run Section 78 | run: 79 | cmd: 'runme' 80 | scheduler: 'moab' 81 | 82 | # Scheduler section needed if defined in the "run" section 83 | moab: 84 | # comma separated list of values, or range 85 | num_nodes: 1 86 | # comma separated list of values, or range 87 | procs_per_node: 16 88 | # time in hr::min::secs 89 | time_limit: 01:00:00 90 | 91 | # Results section 92 | results: 93 | 94 | # The test handler places all results (for this test) under this directory space. 95 | root: '/usr/me/results/' 96 | 97 | time: 98 | tz: 'US/Mountain' 99 | -------------------------------------------------------------------------------- /docs/Pavilion-Tutorial.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/Pavilion/77fcf7446996a0292d0515a0dcee5024ccf8cc01/docs/Pavilion-Tutorial.docx -------------------------------------------------------------------------------- /docs/Requirements.txt: -------------------------------------------------------------------------------- 1 | Pavilion (Gazebo-II) Testing Framework 2 | 3 | # ################################################################### 4 | # 5 | # Disclaimer and Notice of Copyright 6 | # ================================== 7 | # 8 | # Copyright (c) 2015, Los Alamos National Security, LLC 9 | # All rights reserved. 10 | # 11 | # Copyright 2015. Los Alamos National Security, LLC. 12 | # This software was produced under U.S. Government contract 13 | # DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), 14 | # which is operated by Los Alamos National Security, LLC for 15 | # the U.S. Department of Energy. The U.S. Government has rights 16 | # to use, reproduce, and distribute this software. NEITHER 17 | # THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES 18 | # ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY 19 | # FOR THE USE OF THIS SOFTWARE. If software is modified to 20 | # produce derivative works, such modified software should be 21 | # clearly marked, so as not to confuse it with the version 22 | # available from LANL. 23 | # 24 | # Additionally, redistribution and use in source and binary 25 | # forms, with or without modification, are permitted provided 26 | # that the following conditions are met: 27 | # 28 | # 1. Redistributions of source code must retain the 29 | # above copyright notice, this list of conditions 30 | # and the following disclaimer. 31 | # 2. Redistributions in binary form must reproduce the 32 | # above copyright notice, this list of conditions 33 | # and the following disclaimer in the documentation 34 | # and/or other materials provided with the distribution. 35 | # 3. Neither the name of Los Alamos National Security, LLC, 36 | # Los Alamos National Laboratory, LANL, the U.S. Government, 37 | # nor the names of its contributors may be used to endorse 38 | # or promote products derived from this software without 39 | # specific prior written permission. 40 | # 41 | # THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC 42 | # AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 43 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 44 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 45 | # IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS 46 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 47 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 48 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 49 | # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 51 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 52 | # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 53 | # OF SUCH DAMAGE. 54 | # 55 | # ################################################################### 56 | 57 | Functional Requirements/Goals 58 | 59 | ver. 1.8 60 | 61 | - This is the basic wish list (not in any particular priority) for what's desired 62 | in Pavilion. 63 | 64 | 65 | 1. Functionality that exists in current version of Gazebo that's to be continued. 66 | ----------- 67 | 68 | 1.1 Run as a user process. Gracefully handles permissions to support multiple users running out of the same 69 | installation space. 70 | 1.2 Placeholder (directory) for results created immediately upon launch 71 | 1.3 Supports a continual testing mode 72 | 1.4 Supports testing at a targeted load level 73 | 1.5 Supports a delay time between test suite launches 74 | 1.6 Defined convention to automate data collection of test output results (for example, current trend data tags) 75 | 1.7 Maintains enough data and provides tools to generate system coverage statistics 76 | 1.8 Maintains enough data and provides tools to generate individual test run-time stats. 77 | 1.9 Maintains enough data and provides tools for summarizing passing and failing results with runtime statistics 78 | 1.10 Supports efficient time based analysis (user selectable results to any time frame) 79 | 1.11 Hierarchical directory store for raw data to facilite easy accss to results 80 | 81 | 82 | 83 | 2. Features that exist in some form in Gazebo, but need improvements/enhancements. 84 | --------- 85 | 86 | 2.1 Support for Moab and other schedulers/resource manager combinations. 87 | 2.2 Support for running simultaneous single or multiple test suites. 88 | 2.3 Support for targeting nodes and segments, where possible. 89 | 2.4 Minimize job launch script footprint called from DRM 90 | 2.5 Support run-time test instance copy to new run location (is default now) 91 | 2.6 Supports build and then run mode, as well as running existing binaries 92 | 2.7 Support pre-run of resource availability before launch ( i.e. - go/no-go decision to run based on available file space ) 93 | 2.8 Better user documentation / developer documentation 94 | 2.9 Provide some generic test code(s) (gcc based?) as example(s). 95 | 2.10 Tools to automate generating baseline performance results. 96 | 2.11 Performance learning capability to determine threshold for pass/fail. (Polish up work done by Evan) 97 | 2.12 Summary result reporting 98 | 2.13 Automated fail analysis reporting based on known failures (knowledge based analysis) 99 | 2.14 Automated performance data summaries and charting 100 | 2.15 Simpler design for making it easy to add tests 101 | 102 | 103 | 104 | 3. New Requirements 105 | ------------ 106 | 107 | 3.1 Support multiple test managers running simultaneously (continuous launching tool) 108 | 3.2 Support multiple master test suite configuration file for feeding a variety of parameters to tests. 109 | 3.3 Support testing front-ends as well as compute nodes thus facilitating testing fta's too 110 | 3.4 Elegant way of handling combinatorial parameter studies. 111 | 3.5 Mechanism to hook in measurement/profiling tools ( power aware, LDMS, sensors, profiling, etc.) 112 | 3.6 Support multiple compilers libraries and optimization levels and flags for one test instance, not requiring 113 | new test directories 114 | 3.7 GUI job monitoring / launching / results analysis mechanism 115 | 3.8 Singular command line interface providing comprehensive list of features 116 | 3.9 System component discovery mechanism (both hardware and software) with autopopulation of main config file 117 | where appropriate. 118 | 3.10 Modular design/architecture for ease of co-developing the harness. 119 | 3.11 Functions have self test or unit test built-in for regression test verification. 120 | 3.12 Portable across Linux based clusters (not dependent on specific site installations ) 121 | 3.13 Maintain as much compatibiliy with Gazebo so that old tools and new tools can be used to analyze results 122 | generated by either. 123 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_rpm] 2 | requires = perl python 3 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | try: 2 | from setuptools import setup 3 | except ImportError: 4 | from distutils.core import setup 5 | 6 | config = { 7 | 'description': 'Pavilion - High Performance Cluster Testing Framework', 8 | 'long_description': 'Software framework and tools for testing and analyzing HPC system health', 9 | 'author': 'DOE', 10 | 'download_url': 'https://github.com/losalamos/Pavilion', 11 | 'author_email': 'dejager@lanl.gov', 12 | 'version': '1.1.15', 13 | 'packages': ['PAV', 'test'], 14 | 'name': 'pavilion' 15 | } 16 | 17 | setup(**config) 18 | -------------------------------------------------------------------------------- /test/ConfigTests/TestConfig/invalid_default.yaml: -------------------------------------------------------------------------------- 1 | # User test config (YAML format) 2 | # 3 | DefaultTestSuite: 'y.yaml' 4 | Test4: 5 | source_location: '' 6 | name: test4-rt 7 | run: 8 | cmd: 'rt4' 9 | scheduler: moab 10 | test_args: "10 1024" 11 | moab: 12 | num_nodes: "2,4" 13 | procs_per_node: 16 14 | time_limit: 00:05:00 15 | 16 | HW-raw: 17 | source_location: '' 18 | name: test4-raw 19 | run: 20 | cmd: 'iPassed' 21 | scheduler: raw 22 | working_space: 23 | copy_to_ws: "iPassed iFailed" 24 | save_from_ws: "stdout" 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/ConfigTests/TestConfig/invalid_yaml.yaml: -------------------------------------------------------------------------------- 1 | # User test config (YAML format) 2 | # 3 | Test4 4 | source_location: '' 5 | name: test4-rt 6 | run: 7 | cmd: 'rt4' 8 | scheduler: moab 9 | test_args: "10 1024" 10 | moab: 11 | num_nodes: "2,4" 12 | procs_per_node: 16 13 | time_limit: 00:05:00 14 | 15 | HW-raw: 16 | source_location: '' 17 | name: test4-raw 18 | run: 19 | cmd: 'iPassed' 20 | scheduler: raw 21 | working_space: 22 | copy_to_ws: "iPassed iFailed" 23 | save_from_ws: "stdout" 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/ConfigTests/TestConfig/malformed_default.yaml: -------------------------------------------------------------------------------- 1 | # User test config (YAML format) 2 | # 3 | DefaultTestSuite: 'invalid_yaml.yaml' 4 | Test4: 5 | source_location: '' 6 | name: test4-rt 7 | run: 8 | cmd: 'rt4' 9 | scheduler: moab 10 | test_args: "10 1024" 11 | moab: 12 | num_nodes: "2,4" 13 | procs_per_node: 16 14 | time_limit: 00:05:00 15 | 16 | HW-raw: 17 | source_location: '' 18 | name: test4-raw 19 | run: 20 | cmd: 'iPassed' 21 | scheduler: raw 22 | working_space: 23 | copy_to_ws: "iPassed iFailed" 24 | save_from_ws: "stdout" 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/ConfigTests/TestConfig/yaml_test_config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import unittest 4 | import sys 5 | import os 6 | 7 | base = os.path.abspath("../../../") 8 | sys.path.append(base) 9 | sys.path.append(base + "/PAV/special_pkgs") 10 | sys.path.append(base + "/PAV/modules") 11 | 12 | from testConfig import YamlTestConfig 13 | 14 | class YamlTestConfigTest(unittest.TestCase): 15 | def test_invalid_default_file(self): 16 | with self.assertRaises(SystemExit): 17 | YamlTestConfig('invalid_default.yaml') 18 | 19 | def test_malformed_default_file(self): 20 | with self.assertRaises(SystemExit): 21 | YamlTestConfig('malformed_default.yaml') 22 | 23 | def test_invalid_yaml_file(self): 24 | with self.assertRaises(SystemExit): 25 | YamlTestConfig('invalid_yaml.yaml') 26 | if __name__ == '__main__': 27 | unittest.main(verbosity=2) 28 | -------------------------------------------------------------------------------- /test/PAV_tests.py: -------------------------------------------------------------------------------- 1 | from nose.tools import * 2 | import PAV 3 | 4 | def setup(): 5 | print "SETUP!" 6 | 7 | def teardown(): 8 | print "TEAR DOWN!" 9 | 10 | def test_basic(): 11 | print "I RAN!" 12 | 13 | -------------------------------------------------------------------------------- /test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanl/Pavilion/77fcf7446996a0292d0515a0dcee5024ccf8cc01/test/__init__.py --------------------------------------------------------------------------------