diff --git a/src/spaceone/cost_analysis/manager/job_task_manager.py b/src/spaceone/cost_analysis/manager/job_task_manager.py index 3d8162e..d2df934 100644 --- a/src/spaceone/cost_analysis/manager/job_task_manager.py +++ b/src/spaceone/cost_analysis/manager/job_task_manager.py @@ -90,13 +90,17 @@ def change_in_progress_status(job_task_vo: JobTask): {"status": "IN_PROGRESS", "started_at": datetime.utcnow()} ) - @staticmethod - def update_sync_status(job_task_vo: JobTask, created_count: int) -> JobTask: - return job_task_vo.update( + def update_sync_status(self, job_task_vo: JobTask, created_count): + job_task_vo = job_task_vo.update( {"created_count": job_task_vo.created_count + created_count} ) - def change_success_status(self, job_task_vo: JobTask, created_count: int) -> None: + job_vo = self.job_mgr.get_job(job_task_vo.job_id, job_task_vo.domain_id) + self.job_mgr.update_job_by_vo({}, job_vo) + + return job_task_vo + + def change_success_status(self, job_task_vo: JobTask, created_count): _LOGGER.debug( f"[change_success_status] success job task: {job_task_vo.job_task_id} " f"(created_count = {created_count})" @@ -112,6 +116,7 @@ def change_success_status(self, job_task_vo: JobTask, created_count: int) -> Non job_vo = self.job_mgr.get_job(job_task_vo.job_id, job_task_vo.domain_id) self.job_mgr.decrease_remained_tasks(job_vo) + self.job_mgr.update_job_by_vo({}, job_vo) def change_canceled_status(self, job_task_vo: JobTask) -> None: _LOGGER.error( diff --git a/src/spaceone/cost_analysis/service/job_service.py b/src/spaceone/cost_analysis/service/job_service.py index 60af13a..6acde63 100644 --- a/src/spaceone/cost_analysis/service/job_service.py +++ b/src/spaceone/cost_analysis/service/job_service.py @@ -1038,7 +1038,9 @@ def _check_duplicate_job( if job_vo.created_at >= duplicate_job_time: return True elif job_vo.options.get("sync_mode") == "MANUAL": - return True + manual_duplicate_job_time = datetime.utcnow() - timedelta(hours=24) + if job_vo.updated_at > manual_duplicate_job_time: + return True else: self.job_mgr.change_canceled_status(job_vo)