Salome HOME
Update of CheckDone
[modules/smesh.git] / src / Tools / Verima / Base / tablePerfs.py
1 # Copyright (C) 2013-2022  EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 from qtsalome import QSqlQuery
21 from Base.tableDeBase import TableDeBase
22
23 class TablePerfs (TableDeBase):
24       def __init__(self):
25           TableDeBase.__init__(self,"Perfs")
26           self.setField(('Maillage','Version','Machine','NbSecCpu','Memoire'))
27           self.setTypeField(('int','int','str','int','int'),('idMaillage','idVersion','Machine'))
28
29       def createSqlTable(self):
30           query=QSqlQuery()
31           texteQuery ="create table Perfs(idMaillage int, idVersion int, Machine varchar(10),  NbCpu int, Mem int, "
32           texteQuery+="foreign key (idMaillage) references Maillages(id)," 
33           texteQuery+="foreign key (idVersion) references Versions(id)," 
34           texteQuery+="foreign key (Machine) references Machines(nomMachine)," 
35           texteQuery+="primary key (idMaillage, idVersion, Machine));"
36
37           print("Creation de TablePerfs : " , query.exec_(texteQuery))
38
39       def getVal(self,idMaillage,idVersion,Machine):
40           query=QSqlQuery()
41           texteQuery ='select NbCpu from Perfs  where idMaillage=' + str(idMaillage)
42           texteQuery +=' and idVersion = ' + str(idVersion)
43           texteQuery +=" and Machine ='"  + Machine + "';" 
44           query.exec_(texteQuery)
45           cpu=None
46           while (query.next()) :
47               cpu=query.value(0).toInt()[0]
48           while (query.next()) :
49               print("plusieurs enregistrements dans perf pour ",str(idMaillage)," ",str(idVersion)," ",Machine)
50           if cpu==None :
51               print("pas d enregistrement dans perf pour ",str(idMaillage)," ",str(idVersion)," ",Machine)
52           return cpu