diff --git a/PAT-post-processing/batch-process.sh b/PAT-post-processing/batch-process.sh new file mode 100755 index 0000000..37b78b0 --- /dev/null +++ b/PAT-post-processing/batch-process.sh @@ -0,0 +1,28 @@ +## script for post processing PAT data in batch +## ${Base_dir} contains all the PAT source data that needs to be processed, change this dir to your own +Base_dir=/home/test1 + +################################################################################ +## DO NOT NEED TO EDIT BELOW PARTS!!! +################################################################################ +PAT_POST_HOME=$( cd $( dirname ${BASH_SOURCE[0]} ) && pwd ) + +cd ${Base_dir} +for item in `ls -d */` ## only dirs under ${Base_dir} +do + echo "Processing ${item} ..." + New_dir=${Base_dir}/${item}/instruments + if [ -d ${New_dir} ]; then + sed -i "s|.*|${New_dir}|g" ${PAT_POST_HOME}/config.xml + ${PAT_POST_HOME}/pat-post-process.py ${PAT_POST_HOME}/config.xml + echo "${item} done!" + else + echo "WARNING: ${item} is not a PAT file, will ignore!" + fi +done +## change back to original value +sed -i "s|.*|/foo/bar/instruments/|g" ${PAT_POST_HOME}/config.xml +cd - + + + diff --git a/PAT-post-processing/pat-post-process.py b/PAT-post-processing/pat-post-process.py index 5077b32..261db76 100755 --- a/PAT-post-processing/pat-post-process.py +++ b/PAT-post-processing/pat-post-process.py @@ -272,12 +272,18 @@ def generate_output(cluster): en_memory_csv = root[2].find('csv-memory').text result_path = root[3].text name_node = root[4].text + + path = root[3].text + if path[-1] == "/": + pat_name = path.split("/")[-3] + else: + pat_name = path.split("/")[-2] if en_pdf == 'yes': print "----Rendering pdf", time.ctime(), "----" # global pdf file that will contain all charts - pp = PdfPages(result_path + '/PAT-Result.pdf') + pp = PdfPages(result_path + '/' + pat_name + '.pdf') # print average cpu utilization graph to pdf if en_avg_cpu == 'yes' or en_avg_cpu == 'Yes': @@ -362,7 +368,7 @@ def generate_output(cluster): if en_xl == 'yes': print "----Generating Excel", time.ctime(), "----" - wb = xlsxwriter.Workbook(result_path + '/PAT-Result.xlsm') + wb = xlsxwriter.Workbook(result_path + '/' + pat_name + '.xlsm') print "----Generating CSV", time.ctime(), "----" csv_path_cpu = result_path + "/CPU.csv" csv_path_disk = result_path + "/DISK.csv"