-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTReport.py
129 lines (107 loc) · 4.01 KB
/
TReport.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
'''
Created on 02/03/2018
@author: Peter
Class TReport é uma classe que cria objectos que contêm informação dos relatórios guardados pelo
TSlave quando corrida uma task
Variáveis:
ComputerName - string - Nome do PC que processou determinado bloco
BlokName - string - Nome da tile processada
LoadedPtsAct - int - Pontos abertos do bloco
LoadedPtsNgb - int - Pontos abertos do neighbour
SavedPts - int - Pontos Salvos
ListaOrdens - ["string"] - lista das ordens que fazem parte da macro/task
Status - Boolean - sucesso ou insucesso da task para o determinado bloco
'''
import re
class TReport(object):
'''
classdocs
'''
__computerName = ""
__tileName = ""
__loadedPtsAct = 0
__loadedPtsNgb = 0
__savedPts = 0
__tStatus = False
__listaOrdens = []
def __init__(self):
'''
Constructor
'''
def readFile(self, streamFileTReport):
with open(streamFileTReport) as fin:
listaOrdensTmp = []
for linha in fin:
if 'Computer=' in linha:
self.setComputerName(re.split('=|\n', linha)[1])
elif 'Block' in linha:
self.setTileName(re.split('\n', linha)[0])
elif 'active' in linha:
self.setLoadedPtsAct(int(re.findall('\d+', linha)[0]))
elif 'neighbouring' in linha:
self.setLoadedPtsNgb(int(re.findall('\d+', linha)[0]))
elif 'FnScan' in linha:
listaOrdensTmp.append(re.split('\n', linha)[0])
elif 'Saved' in linha:
self.setSavedPts(int(re.findall('\d+', linha)[0]))
elif 'Status' in linha:
if 'Success' in linha:
self.setStatus(True)
self.setlLstaOrdens(listaOrdensTmp)
def getComputerName(self):
return self.__computerName
def setComputerName(self, name):
if isinstance(name, str):
self.__computerName = name
else:
print('Not quite my type of data: need a str')
raise Exception('Not quite my type of data: need a str')
def getTileName(self):
return self.__tileName
def setTileName(self, name):
if isinstance(name, str):
self.__tileName = name
else:
print('Not quite my type of data: need a str')
raise Exception('Not quite my type of data: need a str')
def getLoadedPtsAct(self):
return self.__loadedPtsAct
def setLoadedPtsAct(self, count):
if isinstance(count, int):
self.__loadedPtsAct = count
else:
print('Not quite my type of data: need a int')
raise Exception('Not quite my type of data: need a int')
def getLoadedPtsNgb(self):
return self.__loadedPtsNgb
def setLoadedPtsNgb(self, count):
if isinstance(count, int):
self.__loadedPtsNgb = count
else:
print('Not quite my type of data: need a int')
raise Exception('Not quite my type of data: need a int')
def getSavedPts(self):
return self.__savedPts
def setSavedPts(self, count):
if isinstance(count, int):
self.__savedPts = count
else:
print('Not quite my type of data: need a int')
raise Exception('Not quite my type of data: need a int')
def getStatus(self):
return self.__tStatus
def setStatus(self, status):
if isinstance(status, bool):
self.__tStatus = status
else:
print('Not quite my type of data: need a bool')
raise Exception('Not quite my type of data: need a bool')
def getListaOrdens(self):
return self.__listaOrdens
def setlLstaOrdens(self, strList):
if isinstance(strList, list):
self.__listaOrdens = strList
else:
print('Not quite my type of data: need a list of strings')
raise Exception(
'Not quite my type of data: need a list of strings')