Skip to content
Snippets Groups Projects
Commit 4c0ee4a7 authored by Hal Simpson's avatar Hal Simpson
Browse files

Added delta to the update recursion. Added check to determine if an algorithm...

Added delta to the update recursion.  Added check to determine if an algorithm has the data ranges it need to function.  Encased run_as_update/run options parameter as an object.
parent 2f574471
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import TimeseriesUtility import TimeseriesUtility
import TimeseriesFactoryException import TimeseriesFactoryException
from Util import ObjectView
class Controller(object): class Controller(object):
...@@ -91,6 +92,7 @@ class Controller(object): ...@@ -91,6 +92,7 @@ class Controller(object):
starttime=options.starttime, starttime=options.starttime,
endtime=options.endtime, endtime=options.endtime,
channels=output_channels) channels=output_channels)
delta = output_timeseries[0].stats.delta
# find gaps in output, so they can be updated # find gaps in output, so they can be updated
output_gaps = TimeseriesUtility.get_merged_gaps( output_gaps = TimeseriesUtility.get_merged_gaps(
TimeseriesUtility.get_stream_gaps(output_timeseries)) TimeseriesUtility.get_stream_gaps(output_timeseries))
...@@ -102,26 +104,26 @@ class Controller(object): ...@@ -102,26 +104,26 @@ class Controller(object):
starttime=input_start, starttime=input_start,
endtime=input_end, endtime=input_end,
channels=input_channels) channels=input_channels)
input_gaps = TimeseriesUtility.get_merged_gaps( if not algorithm.can_produce_data(
TimeseriesUtility.get_stream_gaps(input_timeseries)) starttime=output_gap[0],
if len(input_gaps) > 0: endtime=output_gap[1],
# TODO: are certain gaps acceptable? stream=input_timeseries):
continue continue
# check for fillable gap at start # check for fillable gap at start
if output_gap[0] == options.starttime: if output_gap[0] == options.starttime:
# found fillable gap at start, recurse to previous interval # found fillable gap at start, recurse to previous interval
interval = options.endtime - options.starttime interval = options.endtime - options.starttime
self.run_as_update({ self.run_as_update(ObjectView({
'outchannels': options.outchannels, 'outchannels': options.outchannels,
'starttime': options.starttime - interval, 'starttime': options.starttime - interval - delta,
'endtime': options.starttime 'endtime': options.starttime - delta
}) }))
# fill gap # fill gap
self.run({ self.run(ObjectView({
'outchannels': options.outchannels, 'outchannels': options.outchannels,
'starttime': output_gap[0], 'starttime': output_gap[0],
'endtime': output_gap[1] 'endtime': output_gap[1]
}) }))
def _get_output_channels(self, algorithm_channels, commandline_channels): def _get_output_channels(self, algorithm_channels, commandline_channels):
"""get output channels """get output channels
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment