X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=automate%2Fautomate.py;fp=automate%2Fautomate.py;h=0000000000000000000000000000000000000000;hb=e637272100e8e03884188cb2118b21158e739bb0;hp=2c67ffe97936aa3d10b1b5fdc6aa2e9f041b64d5;hpb=328ee7b92f4e23570d8a33ad9244413ae3aee6bf;p=monitor.git diff --git a/automate/automate.py b/automate/automate.py deleted file mode 100644 index 2c67ffe..0000000 --- a/automate/automate.py +++ /dev/null @@ -1,40 +0,0 @@ -import csv -from glob import glob -import os -import time - -def time_to_str(t): - return time.strftime("%Y/%m/%d %H:%M:%S", time.gmtime(t)) - -def get_filelist_from_dir(dirname): - filelist = glob("%s/*.out" % dirname) - - ret_list = [] - for file in filelist: - ret_list.append(file) - return ret_list - -def get_hostlist_from_dir(dirname): - filelist = glob("%s/*.out" % dirname) - - ret_list = [] - for file in filelist: - ret_list.append([os.path.basename(file)[:-4], '']) - return ret_list - -def csv_to_hash(r): - ret = {} - for line in r: - (k,v) = (line[0], line[1]) - if k not in ret: - ret[k] = v - else: - # multiple values for the same key - if isinstance(ret[k], list): - ret[k].append(v) - else: - ret[k] = [ret[k], v] - return ret - -def getcsv(file): - return csv_to_hash(csv.reader(open(file,'r')))