Skip to content

Commit

Permalink
fix: Removed TimeUtilities.time()
Browse files Browse the repository at this point in the history
  • Loading branch information
rupozzi committed Jun 2, 2022
1 parent 109a339 commit bd0b176
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/WebAppDIRAC/WebApp/handler/MonitoringHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from DIRAC import gConfig, S_OK, S_ERROR, gLogger
from DIRAC.Core.Tornado.Client.ClientSelector import TransferClientSelector as TransferClient
from DIRAC.Core.Utilities import Time, List, DictCache
from DIRAC.Core.Utilities import TimeUtilities, List, DictCache
from DIRAC.Core.Utilities.Plotting.FileCoding import extractRequestFromFileId, codeRequestInFileId
from DIRAC.MonitoringSystem.Client.MonitoringClient import MonitoringClient

Expand Down Expand Up @@ -109,20 +109,20 @@ def __parseFormParams(self):
# Find the proper time!
pD["timeSelector"] = int(pD["timeSelector"])
if pD["timeSelector"] > 0:
end = Time.dateTime()
end = datetime.datetime.utcnow()
start = end - datetime.timedelta(seconds=pD["timeSelector"])
if not pinDates:
extraParams["lastSeconds"] = pD["timeSelector"]
else:
if "endTime" not in pD:
end = False
else:
end = Time.fromString(pD["endTime"])
end = TimeUtilities.fromString(pD["endTime"])
del pD["endTime"]
if "startTime" not in pD:
return S_ERROR("Missing starTime!")
else:
start = Time.fromString(pD["startTime"])
start = TimeUtilities.fromString(pD["startTime"])
del pD["startTime"]
del pD["timeSelector"]

Expand Down Expand Up @@ -233,10 +233,10 @@ def web_getCsvPlotData(self):
if "granularity" in rawData:
granularity = rawData["granularity"]
data = rawData["data"]
tS = int(Time.toEpoch(params[2]))
tS = int(TimeUtilities.toEpoch(params[2]))
timeStart = tS - tS % granularity
strData = "epoch,%s\n" % ",".join(groupKeys)
for timeSlot in range(timeStart, int(Time.toEpoch(params[3])), granularity):
for timeSlot in range(timeStart, int(TimeUtilities.toEpoch(params[3])), granularity):
lineData = [str(timeSlot)]
for key in groupKeys:
if timeSlot in data[key]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def web_getSelectionData(self):

@asyncGen
def web_getTransformationData(self):
pagestart = TimeUtilities.time()
pagestart = datetime.datetime.utcnow()
user = self.getUserName()

tsClient = TransformationClient(timeout=3600)
Expand Down Expand Up @@ -153,7 +153,7 @@ def web_getTransformationData(self):
else:
callback = {"success": "true", "result": callback, "total": total, "date": None}

gLogger.info("\033[0;31m PRODUCTION SUBMIT REQUEST: \033[0m %s" % (TimeUtilities.time() - pagestart))
gLogger.info("\033[0;31m PRODUCTION SUBMIT REQUEST: \033[0m %s" % (datetime.datetime.utcnow() - pagestart))
self.finish(json.dumps(callback))

################################################################################
Expand Down

0 comments on commit bd0b176

Please sign in to comment.