From d7e2d095774ff0416d46d58315fdb39600dd2b4d Mon Sep 17 00:00:00 2001 From: jean-baptiste-perez-bib Date: Wed, 26 Jun 2024 16:21:30 +0200 Subject: [PATCH] Creates a new operation per schedule When an object schedule is created, it embeds a complete operation template in its "task" field. On the first schedule time, it creates an operation from the template. Until now, this operation was used for each subsequent schedule. This commit prevent that and creates a new operation per schedule, with the start date added in its name. --- app/service/app_svc.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/service/app_svc.py b/app/service/app_svc.py index 906a765e7..ec831a3f8 100644 --- a/app/service/app_svc.py +++ b/app/service/app_svc.py @@ -6,6 +6,7 @@ import os import re import time +import uuid from collections import namedtuple from datetime import datetime, timezone from importlib import import_module @@ -100,6 +101,8 @@ async def run_scheduler(self): if interval > diff.total_seconds() > 0: self.log.debug('Pulling %s off the scheduler' % s.id) sop = copy.deepcopy(s.task) + sop.id = str(uuid.uuid4()) + sop.name += f" ({datetime.now(timezone.utc).replace(microsecond=0).isoformat()})" sop.set_start_details() await sop.update_operation_agents(self.get_services()) await self._services.get('data_svc').store(sop)