From 126d6e140d160478bb37daee44ffcf9caf8c19bc Mon Sep 17 00:00:00 2001 From: "E. Joshua Rigler" <erigler@usgs.gov> Date: Mon, 22 Apr 2024 12:28:06 -0600 Subject: [PATCH] Fix Controller.run_as_update() This broke when changes were made to allow processing data more recent than the last top-of-the-minute (~8 months ago). The only "updates" that worked since then were for 1-second data. It's a little bit lazy because it relies on the output_factory to return traces with proper starttimes and endtimes (that is, they fall on the tops of minutes). Probably we should be more explicit in correcting the starttimes and endtimes to line up on expected timestamps. Pushing this fix now because it has operational impacts. --- geomagio/Controller.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/geomagio/Controller.py b/geomagio/Controller.py index 78e62aa3..9d50ceb2 100644 --- a/geomagio/Controller.py +++ b/geomagio/Controller.py @@ -380,14 +380,6 @@ class Controller(object): output_channels = output_channels or algorithm.get_output_channels() input_interval = input_interval or self._inputInterval output_interval = output_interval or self._outputInterval - print( - "checking gaps", - starttime, - endtime, - output_observatory, - output_channels, - file=sys.stderr, - ) # request output to see what has already been generated output_timeseries = self._get_output_timeseries( observatory=output_observatory, @@ -397,6 +389,19 @@ class Controller(object): interval=output_interval, ) if len(output_timeseries) > 0: + # force starttime & endtime to be consistent with output_interval + # FIXME: this is lazy; a better solution would be to use something + # like FilterAlgorithm's get_nearest_time() -EJR + starttime = output_timeseries[0].stats.starttime + endtime = output_timeseries[0].stats.endtime + print( + "checking gaps", + starttime, + endtime, + output_observatory, + output_channels, + file=sys.stderr, + ) # find gaps in output, so they can be updated output_gaps = TimeseriesUtility.get_merged_gaps( TimeseriesUtility.get_stream_gaps(output_timeseries) -- GitLab