Skip to content
Snippets Groups Projects
Commit e7a11ec3 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

Task #9607: update observation stoptime on abort

parent ecdc7403
No related branches found
No related tags found
No related merge requests found
...@@ -137,9 +137,12 @@ class OTDBtoRATaskStatusPropagator(OTDBBusListener): ...@@ -137,9 +137,12 @@ class OTDBtoRATaskStatusPropagator(OTDBBusListener):
def onObservationCompleting(self, treeId, modificationTime): def onObservationCompleting(self, treeId, modificationTime):
self._update_radb_task_status(treeId, 'completing') self._update_radb_task_status(treeId, 'completing')
def _updateStopTime(self, treeId): def _updateStopTime(self, treeId, only_pipelines=False):
radb_task = self.radb.getTask(otdb_id=treeId) radb_task = self.radb.getTask(otdb_id=treeId)
if radb_task and radb_task['type'] == 'pipeline': if radb_task:
if only_pipelines and radb_task['type'] != 'pipeline':
return
otdb_task = self.otdb.taskGetTreeInfo(otdb_id=treeId) otdb_task = self.otdb.taskGetTreeInfo(otdb_id=treeId)
if otdb_task and (otdb_task['starttime'] != radb_task['starttime'] or otdb_task['stoptime'] != radb_task['endtime']): if otdb_task and (otdb_task['starttime'] != radb_task['starttime'] or otdb_task['stoptime'] != radb_task['endtime']):
new_endtime = otdb_task['stoptime'] new_endtime = otdb_task['stoptime']
...@@ -152,14 +155,13 @@ class OTDBtoRATaskStatusPropagator(OTDBBusListener): ...@@ -152,14 +155,13 @@ class OTDBtoRATaskStatusPropagator(OTDBBusListener):
# otdb adjusts stoptime when finishing, # otdb adjusts stoptime when finishing,
# reflect that in radb for pipelines # reflect that in radb for pipelines
self._updateStopTime(treeId) self._updateStopTime(treeId, only_pipelines=True)
def onObservationAborted(self, treeId, modificationTime): def onObservationAborted(self, treeId, modificationTime):
self._update_radb_task_status(treeId, 'aborted') self._update_radb_task_status(treeId, 'aborted')
# otdb adjusts stoptime when aborted, # otdb adjusts stoptime when aborted,
# reflect that in radb for pipelines self._updateStopTime(treeId, only_pipelines=False)
self._updateStopTime(treeId)
def main(): def main():
# Check the invocation arguments # Check the invocation arguments
......
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