Skip to content

Commit

Permalink
Revert "Remove self.scheduler, it's only needed for signaling child t…
Browse files Browse the repository at this point in the history
…asks - use the instance passed by hxtool_scheduler instead"

This reverts commit 467e012.
  • Loading branch information
fe-ebroad committed Mar 18, 2021
1 parent 467e012 commit 6e83091
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hxtool_scheduler_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def __init__(self, profile_id, name, task_id = None, start_time = None, end_time
self.profile_name = "Unknown"
self.task_id = task_id or str(secure_uuid4())
self.parent_id = parent_id
self.scheduler = None
self.wait_for_parent = wait_for_parent
self.parent_complete = False
self.name = name
Expand Down Expand Up @@ -143,6 +144,8 @@ def run(self, scheduler):

self.state = task_states.TASK_STATE_RUNNING

self.scheduler = scheduler

# Reset microseconds to keep from drifting too badly
self.last_run = datetime.datetime.utcnow().replace(microsecond=1)
# Clear this, otherwise the task view looks confusing
Expand Down Expand Up @@ -198,7 +201,7 @@ def run(self, scheduler):
self.state = task_states.TASK_STATE_COMPLETE

if not self.parent_id:
scheduler.signal_child_tasks(self.task_id, self.state, self.stored_result)
hxtool_global.hxtool_scheduler.signal_child_tasks(self.task_id, self.state, self.stored_result)

self._calculate_next_run()

Expand All @@ -209,6 +212,7 @@ def run(self, scheduler):
# Reset parent_complete for recurring tasks
self.parent_complete = False

self.scheduler = None
else:
self.set_state(task_states.TASK_STATE_STOPPED)

Expand Down

0 comments on commit 6e83091

Please sign in to comment.