made cocluto work with simpaweb running on flask

This commit is contained in:
Guillaume Raffy 2022-01-28 23:39:39 +01:00
parent c7fa99064f
commit a65c2fbc3f
9 changed files with 28 additions and 28 deletions

View File

@ -1,4 +1,4 @@
from Log import *
from .Log import *
class JobsState:
"""

View File

@ -6,7 +6,7 @@ gLogFilePath = '/tmp/ClusterController.log'#'/var/log/ClusterController.log'
def log( message ):
threadName = threading.currentThread().getName()
logMessage = time.asctime(time.localtime())+' : '+ threadName + ' : ' + message
print logMessage
print(logMessage)
f = open(gLogFilePath, 'a+')
assert( f )
try:

View File

@ -1,10 +1,10 @@
import StringIO
import io
import re
from JobsState import *
from QueueMachine import *
from Util import *
from Log import *
from Job import *
from .JobsState import *
from .QueueMachine import *
from .Util import *
from .Log import *
from .Job import *
class QstatParser:
def parseJobState( self, strJobStatus ):
@ -95,7 +95,7 @@ class QstatParser:
qstatOutput = re.sub('\.univ[^ ]*', '.univ-rennes1.fr', qstatOutput)
jobsState = JobsState()
f = StringIO.StringIO(qstatOutput)
f = io.StringIO(qstatOutput)
line = f.readline()
currentQueueMachine = None
bInPendingJobsSection = False
@ -208,7 +208,7 @@ class QstatParser:
matchObj = re.match('^[#]+$', line)
if not matchObj:
# unexpected line
print 'line = "' + line + '"'
print('line = "' + line + '"')
assert( False )
None
line = f.readline()
@ -218,7 +218,7 @@ class QstatParser:
"""
adds to job the details parsed from the output of the "qstat -j <jobid>" command
"""
f = StringIO.StringIO(qstatOutput)
f = io.StringIO(qstatOutput)
line = f.readline()
fieldRegularExp = re.compile( '^(?P<fieldName>[^:]+):[ ]+(?P<fieldValue>[?]*)$' )
while( len(line) > 0 ):

View File

@ -1,9 +1,9 @@
import Lib.Util
import Lib.SimpaDbUtil
from Log import *
from PowerState import *
#import .Util
#import ..SimpaDbUtil
from .Log import *
from .PowerState import *
import re
import StringIO
import io
import os
import traceback
import sys
@ -91,7 +91,7 @@ def getPowerState( machineName ):
elif strAcpiState == 'S5/G2': # soft-off
ePowerState = PowerState.OFF
else:
print strAcpiState
print(strAcpiState)
assert( False )
bPowerStateRead = True
else:
@ -207,7 +207,7 @@ def onException(exception):
strExceptionType = type( exception )
strMessage = 'exception %s : %s\n' % (strExceptionType, exception.message)
#traceback.print_last()
f = StringIO.StringIO()
f = io.StringIO()
traceback.print_exc(file=f)
strMessage += f.getvalue()
f.close()

View File

@ -1,4 +1,4 @@
import StringIO
import io
import re
from Sensor import FanSensor, TemperatureSensor
from ClusterNodeSensorsReadings import ClusterNodeSensorsReadings
@ -6,7 +6,7 @@ from ClusterNodeSensorsReadings import ClusterNodeSensorsReadings
class IpmiTool202Parser:
def parseSensorOutput( self, strOutput, clusterNodeName ):
sensorReadings=ClusterNodeSensorsReadings(clusterNodeName)
f = StringIO.StringIO(strOutput)
f = io.StringIO(strOutput)
line = f.readline()
while( len(line) > 0 ):
#print line,

View File

@ -1,4 +1,4 @@
import StringIO
import io
import re
from Sensor import FanSensor, TemperatureSensor
from ClusterNodeSensorsReadings import ClusterNodeSensorsReadings
@ -6,7 +6,7 @@ from ClusterNodeSensorsReadings import ClusterNodeSensorsReadings
class IpmiTool218Parser:
def parseSensorOutput( self, strOutput, clusterNodeName ):
sensorReadings=ClusterNodeSensorsReadings(clusterNodeName)
f = StringIO.StringIO(strOutput)
f = io.StringIO(strOutput)
line = f.readline()
while( len(line) > 0 ):
#print line,

View File

@ -1,4 +1,4 @@
import MySQLdb # sudo port install py-mysql; sudo apt install python-mysqldb
import MySQLdb # sudo port install py-mysql; sudo apt install python-mysqldb or pip install mysqlclient
import time
import sys
if sys.version_info < (3, 0):
@ -6,12 +6,12 @@ if sys.version_info < (3, 0):
else:
from io import StringIO
import re
from wol import *
from .wol import *
import os
from Util import *
from .Util import *
import abc
import sqlite3
from mysql2sqlite import mysql_to_sqlite
from .mysql2sqlite import mysql_to_sqlite
def isMachineResponding(machineName):

View File

@ -1,6 +1,6 @@
import time
import subprocess
# import StringIO
import io
import re
# from wol import *
# import os

View File

@ -1,7 +1,7 @@
# encoding: utf-8
import datetime
# from Lib import SimpaDbUtil
import SimpaDbUtil
from . import SimpaDbUtil
class MachineSpecIdNotFound(Exception):