Skip to content
This repository has been archived by the owner on Aug 16, 2019. It is now read-only.

Commit

Permalink
Update run length on new files
Browse files Browse the repository at this point in the history
This wasn't being updated, so the time slices panel could not specify
how much data was available.
  • Loading branch information
raymondEhlers committed Nov 10, 2018
1 parent 5e3630a commit f7863a6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions overwatch/processing/processRuns.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,8 @@ def processMovedFilesIntoRuns(runs, runDict):
subsystem.startOfRun = fileKeys[0]
logger.debug("Previous EOR: {endOfRun}\tNew: {fileKey}".format(endOfRun = subsystem.endOfRun, fileKey = fileKeys[-1]))
subsystem.endOfRun = fileKeys[-1]
# Also need to update the run length based on the new timestamps
subsystem.runLength = subsystem.calculateRunLength()
else:
# Scenario 2
# Create a new subsystem in an existing run.
Expand Down
24 changes: 23 additions & 1 deletion overwatch/processing/processingClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def __init__(self, subsystem, runDir, startOfRun, endOfRun, showRootFiles = Fals
self.startOfRun = startOfRun
self.endOfRun = endOfRun
# The run length is in minutes
self.runLength = (endOfRun - startOfRun) // 60
self.runLength = self.calculateRunLength()

# Histograms
self.histGroups = persistent.list.PersistentList()
Expand All @@ -325,6 +325,28 @@ def __init__(self, subsystem, runDir, startOfRun, endOfRun, showRootFiles = Fals
# Processing options
self.processingOptions = persistent.mapping.PersistentMapping()

def calculateRunLength(self, startOfRun = None, endOfRun = None):
""" Helper function to update the run length.
Note:
The run length is defined in minutes.
Args:
startOfRun (int): Start of the run in unix time. Default: ``None``. If not specified,
the ``startOfRun`` stored in the subsystem will be used.
endOfRun (int): End of the run in unix time. Default: ``None``. If not specified,
the ``startOfRun`` stored in the subsystem will be used.
Returns:
int: The calculated run length in minutes.
"""
if startOfRun is None:
startOfRun = self.startOfRun
if endOfRun is None:
endOfRun = self.endOfRun
# The run length is in minutes
runLength = (endOfRun - startOfRun) // 60
return runLength

def setupDirectories(self, runDir):
""" Helper function to setup the subsystem directories.
Expand Down

0 comments on commit f7863a6

Please sign in to comment.