@@ -70,16 +70,13 class ParameterConf(): | |||||
70 | Example: |
|
70 | Example: | |
71 | value = (0,1,2) |
|
71 | value = (0,1,2) | |
72 | """ |
|
72 | """ | |
73 | value = value.replace('(', '') |
|
|||
74 | value = value.replace(')', '') |
|
|||
75 |
|
73 | |||
76 | value = value.replace('[', '') |
|
74 | new_value = ast.literal_eval(value) | |
77 | value = value.replace(']', '') |
|
|||
78 |
|
75 | |||
79 | strList = value.split(',') |
|
76 | if type(new_value) not in (tuple, list): | |
80 | intList = [int(float(x)) for x in strList] |
|
77 | new_value = [int(new_value)] | |
81 |
|
78 | |||
82 |
self.__formated_value = |
|
79 | self.__formated_value = new_value | |
83 |
|
80 | |||
84 | return self.__formated_value |
|
81 | return self.__formated_value | |
85 |
|
82 | |||
@@ -89,14 +86,10 class ParameterConf(): | |||||
89 | value = (0.5, 1.4, 2.7) |
|
86 | value = (0.5, 1.4, 2.7) | |
90 | """ |
|
87 | """ | |
91 |
|
88 | |||
92 | value = value.replace('(', '') |
|
89 | new_value = ast.literal_eval(value) | |
93 | value = value.replace(')', '') |
|
|||
94 |
|
||||
95 | value = value.replace('[', '') |
|
|||
96 | value = value.replace(']', '') |
|
|||
97 |
|
90 | |||
98 | strList = value.split(',') |
|
91 | if type(new_value) not in (tuple, list): | |
99 | floatList = [float(x) for x in strList] |
|
92 | new_value = [float(new_value)] | |
100 |
|
93 | |||
101 | self.__formated_value = floatList |
|
94 | self.__formated_value = floatList | |
102 |
|
95 | |||
@@ -126,19 +119,21 class ParameterConf(): | |||||
126 | value = (0,1),(1,2) |
|
119 | value = (0,1),(1,2) | |
127 | """ |
|
120 | """ | |
128 |
|
121 | |||
129 | value = value.replace('(', '') |
|
122 | new_value = ast.literal_eval(value) | |
130 | value = value.replace(')', '') |
|
|||
131 |
|
123 | |||
132 | value = value.replace('[', '') |
|
124 | if type(new_value) not in (tuple, list): | |
133 | value = value.replace(']', '') |
|
125 | raise ValueError, "%s has to be a tuple or list of pairs" %value | |
134 |
|
126 | |||
135 | strList = value.split(',') |
|
127 | if type(new_value[0]) not in (tuple, list): | |
136 | intList = [int(item) for item in strList] |
|
128 | if len(new_value) != 2: | |
137 | pairList = [] |
|
129 | raise ValueError, "%s has to be a tuple or list of pairs" %value | |
138 | for i in range(len(intList)/2): |
|
130 | new_value = [new_value] | |
139 | pairList.append((intList[i*2], intList[i*2 + 1])) |
|
|||
140 |
|
131 | |||
141 | self.__formated_value = pairList |
|
132 | for thisPair in new_value: | |
|
133 | if len(thisPair) != 2: | |||
|
134 | raise ValueError, "%s has to be a tuple or list of pairs" %value | |||
|
135 | ||||
|
136 | self.__formated_value = new_value | |||
142 |
|
137 | |||
143 | return self.__formated_value |
|
138 | return self.__formated_value | |
144 |
|
139 | |||
@@ -179,10 +174,7 class ParameterConf(): | |||||
179 | self.value = str(value) |
|
174 | self.value = str(value) | |
180 | self.format = str.lower(format) |
|
175 | self.format = str.lower(format) | |
181 |
|
176 | |||
182 | try: |
|
177 | self.getValue() | |
183 | self.getValue() |
|
|||
184 | except: |
|
|||
185 | return 0 |
|
|||
186 |
|
178 | |||
187 | return 1 |
|
179 | return 1 | |
188 |
|
180 | |||
@@ -1000,7 +992,11 class Project(): | |||||
1000 | self.projectElement = None |
|
992 | self.projectElement = None | |
1001 | self.procUnitConfObjDict = {} |
|
993 | self.procUnitConfObjDict = {} | |
1002 |
|
994 | |||
1003 | self.projectElement = ElementTree().parse(abs_file) |
|
995 | try: | |
|
996 | self.projectElement = ElementTree().parse(abs_file) | |||
|
997 | except: | |||
|
998 | print "Error reading %s, verify file format" %filename | |||
|
999 | return 0 | |||
1004 |
|
1000 | |||
1005 | self.project = self.projectElement.tag |
|
1001 | self.project = self.projectElement.tag | |
1006 |
|
1002 | |||
@@ -1078,6 +1074,9 class Project(): | |||||
1078 | sys.exc_info()[1], |
|
1074 | sys.exc_info()[1], | |
1079 | sys.exc_info()[2]) |
|
1075 | sys.exc_info()[2]) | |
1080 |
|
1076 | |||
|
1077 | print "***** Error occurred in %s *****" %(procUnitConfObj.name) | |||
|
1078 | print "***** %s" %err[-1] | |||
|
1079 | ||||
1081 | message = "".join(err) |
|
1080 | message = "".join(err) | |
1082 |
|
1081 | |||
1083 | sys.stderr.write(message) |
|
1082 | sys.stderr.write(message) | |
@@ -1179,14 +1178,15 class Project(): | |||||
1179 | try: |
|
1178 | try: | |
1180 | sts = procUnitConfObj.run() |
|
1179 | sts = procUnitConfObj.run() | |
1181 | is_ok = is_ok or sts |
|
1180 | is_ok = is_ok or sts | |
|
1181 | except KeyboardInterrupt: | |||
|
1182 | is_ok = False | |||
|
1183 | break | |||
1182 | except ValueError, e: |
|
1184 | except ValueError, e: | |
1183 | print "***** Error occurred in %s *****" %(procUnitConfObj.name) |
|
|||
1184 | sleep(0.5) |
|
1185 | sleep(0.5) | |
1185 | self.__handleError(procUnitConfObj, send_email=False) |
|
1186 | self.__handleError(procUnitConfObj, send_email=False) | |
1186 | is_ok = False |
|
1187 | is_ok = False | |
1187 | break |
|
1188 | break | |
1188 | except: |
|
1189 | except: | |
1189 | print "***** Error occurred in %s *****" %(procUnitConfObj.name) |
|
|||
1190 | sleep(0.5) |
|
1190 | sleep(0.5) | |
1191 | self.__handleError(procUnitConfObj) |
|
1191 | self.__handleError(procUnitConfObj) | |
1192 | is_ok = False |
|
1192 | is_ok = False | |
@@ -1194,7 +1194,7 class Project(): | |||||
1194 |
|
1194 | |||
1195 | #If every process unit finished so end process |
|
1195 | #If every process unit finished so end process | |
1196 | if not(is_ok): |
|
1196 | if not(is_ok): | |
1197 | print "Every process unit have finished" |
|
1197 | # print "Every process unit have finished" | |
1198 | break |
|
1198 | break | |
1199 |
|
1199 | |||
1200 | if not self.runController(): |
|
1200 | if not self.runController(): |
General Comments 0
You need to be logged in to leave comments.
Login now