Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
guardian_memory_task didn't save in some cases. It resolved
  • Loading branch information
Mohammad Anvaari committed Nov 11, 2023
1 parent 73e004c commit 754aa4c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions functionalities/connector_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def should_connector_restart(self,
if not BackOffConfs.is_enabled :
return True
if reset == BackOffConfs.max_restart:
logger.debug("Connector reach the maximum restart limit")
return False
if seen == 0:
return True
Expand Down Expand Up @@ -83,8 +84,6 @@ def restart_connector(self, connector:str) -> None:
"was [red]failed[/red]")

self.guardian_memory_connector[connector] = [reset + 1, seen + 1]
if BackOffConfs.is_enabled:
save_as_pickle(self.guardian_memory_connector, "guardian_memory_connector.pickle")

def restart_task(self, connector:str, task_id:int) -> None:
reset, seen = self.guardian_memory_task.get(connector,{}).get(task_id,[0,0])
Expand All @@ -111,8 +110,6 @@ def restart_task(self, connector:str, task_id:int) -> None:
self.guardian_memory_task.update(
{connector:{task_id:[reset + 1, seen + 1]}}
)
if BackOffConfs.is_enabled:
save_as_pickle(self.guardian_memory_task, "guardian_memory_task.pickle")

def restart_failed_connectors_and_tasks(self) -> None:
connectors_status = get_connectors_status()
Expand All @@ -132,6 +129,10 @@ def restart_failed_connectors_and_tasks(self) -> None:

for conn,task_id in failed_tasks:
self.restart_task(conn, task_id)

if BackOffConfs.is_enabled:
save_as_pickle(self.guardian_memory_task, "guardian_memory_task.pickle")
save_as_pickle(self.guardian_memory_connector, "guardian_memory_connector.pickle")

if not failed_connectors and not failed_tasks:
logger.info("All tasks and connectors are "
Expand Down

0 comments on commit 754aa4c

Please sign in to comment.