Skip to content

Commit

Permalink
remove/disable debug code, update log messages and levels
Browse files Browse the repository at this point in the history
  • Loading branch information
jhazentia committed Nov 21, 2024
1 parent 001d826 commit 6084141
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 6 additions & 16 deletions src/scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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",))

Expand Down

0 comments on commit 6084141

Please sign in to comment.