From 608414134ced061c9192e0ecbff2661832b43c7f Mon Sep 17 00:00:00 2001 From: Justin Haze Date: Thu, 21 Nov 2024 10:57:06 -0700 Subject: [PATCH] remove/disable debug code, update log messages and levels --- src/requirements-dev.txt | 4 ++-- src/requirements.txt | 4 ++-- src/scheduler/scheduler.py | 22 ++++++---------------- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/requirements-dev.txt b/src/requirements-dev.txt index a2820c41..12add771 100644 --- a/src/requirements-dev.txt +++ b/src/requirements-dev.txt @@ -325,11 +325,11 @@ scipy==1.13.1 # via # -r requirements.txt # scos-actions -scos-actions @ git+https://github.com/NTIA/scos-actions@nan_y_factor_cal +scos-actions @ git+https://github.com/NTIA/scos-actions@11.0.0 # via # -r requirements.txt # scos-tekrsa -scos-tekrsa @ git+https://github.com/NTIA/scos-tekrsa@nan_y_factor_cal +scos-tekrsa @ git+https://github.com/NTIA/scos-tekrsa@8.0.0 # via -r requirements.txt sigmf @ git+https://github.com/NTIA/SigMF@multi-recording-archive # via diff --git a/src/requirements.txt b/src/requirements.txt index 188a53fd..80b9740f 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -157,9 +157,9 @@ ruamel-yaml-clib==0.2.8 # via ruamel-yaml scipy==1.13.1 # via scos-actions -scos-actions @ git+https://github.com/NTIA/scos-actions@nan_y_factor_cal +scos-actions @ git+https://github.com/NTIA/scos-actions@11.0.0 # via scos-tekrsa -scos-tekrsa @ git+https://github.com/NTIA/scos-tekrsa@nan_y_factor_cal +scos-tekrsa @ git+https://github.com/NTIA/scos-tekrsa@8.0.0 # via -r requirements.in sigmf @ git+https://github.com/NTIA/SigMF@multi-recording-archive # via scos-actions diff --git a/src/scheduler/scheduler.py b/src/scheduler/scheduler.py index 93ce1dc1..415f965a 100644 --- a/src/scheduler/scheduler.py +++ b/src/scheduler/scheduler.py @@ -161,10 +161,11 @@ def _initialize_task_result(self) -> TaskResult: if tid > 1: last_task_id_exists = TaskResult.objects.filter(task_id=tid-1).exists() if not last_task_id_exists: - logger.debug(f"TaskResult for tid = {tid-1} does not exist. Stopping schedule.") - self.entry.is_active = False - self.entry.save() - raise Exception(f"Task ID Mismatch! last task id = {tid-1} current task id = {tid}") + logger.warning(f"TaskResult for previous task id ({tid-1}) does not exist. Current task_id = {tid}") + # commented out code useful for debugging if this warning occurs + # self.entry.is_active = False + # self.entry.save() + # raise Exception(f"Task ID Mismatch! last task id = {tid-1} current task id = {tid}") return task_result def _call_task_action(self): @@ -283,19 +284,8 @@ def _queue_pending_tasks(self, schedule_snapshot): if task_time is None: continue - # count = TaskResult.objects.filter(schedule_entry=entry).count() - # if count > 0: - # last_task_id = TaskResult.objects.filter(schedule_entry=entry).order_by("task_id")[count-1].task_id - # entry.next_task_id = last_task_id + 1 - # current_task_id = entry.next_task_id - # if TaskResult.objects.filter(schedule_entry=entry, task_id=current_task_id).count() == 0: - # task_id = current_task_id - # logger.debug(f"Not task result exists for {current_task_id} using {task_id} for next task id.") - # else: task_id = entry.get_next_task_id() - logger.debug(f"Updating schedule entry next task id, task_id = {task_id}") entry.save(update_fields=("next_task_id",)) - logger.debug(f"entry.next_task_id = {entry.next_task_id}") pri = entry.priority action = entry.action pending_queue.enter(task_time, pri, action, entry.name, task_id) @@ -403,7 +393,7 @@ def reset_next_task_id(self): if count > 0: last_task_id = TaskResult.objects.filter(schedule_entry=entry).order_by("task_id")[count-1].task_id if entry.next_task_id != last_task_id + 1: - logger.debug(f"Changing next_task_id from {entry.next_task_id} to {last_task_id + 1}") + logger.info(f"Changing next_task_id from {entry.next_task_id} to {last_task_id + 1}") entry.next_task_id = last_task_id + 1 entry.save(update_fields=("next_task_id",))