Skip to content
Snippets Groups Projects
Commit 5046e4d9 authored by Maël Madon's avatar Maël Madon
Browse files

fix: bug where some sessions were not pointing to their expected predecessor, + refac

parent 93611abe
No related branches found
No related tags found
No related merge requests found
...@@ -30,10 +30,10 @@ class User: ...@@ -30,10 +30,10 @@ class User:
self.dynamic_reduction = dynamic_reduction self.dynamic_reduction = dynamic_reduction
if dynamic_reduction: if dynamic_reduction:
# set of sessions having unfinished jobs, at time t # set of sessions having unfinished jobs, at time t
self.sessions_in_progress = set() self.__sessions_in_progress = set()
# finished sessions, constituting the minimal list of dependencies for a session starting at time t # finished sessions, constituting the minimal list of dependencies for a session starting at time t
self.current_dep = set() self.__current_dep = set()
self.build_graph_rep = build_graph_rep self.build_graph_rep = build_graph_rep
if build_graph_rep: if build_graph_rep:
...@@ -89,17 +89,17 @@ class User: ...@@ -89,17 +89,17 @@ class User:
# Move the sessions recently finished from the set `_in_progress` # Move the sessions recently finished from the set `_in_progress`
# to the set `current_dep`, removing all their neighbours in the # to the set `current_dep`, removing all their neighbours in the
# dependancy graph from the set `current_dep` to keep it minimal # dependancy graph from the set `current_dep` to keep it minimal
for s_id in self.sessions_in_progress.copy(): for s_id in self.__sessions_in_progress.copy():
sess = self.sessions[s_id] sess = self.sessions[s_id]
if date_now > sess.max_finish_time: # ie sess is finished if date_now > sess.max_finish_time: # ie sess is finished
self.sessions_in_progress.discard(s_id) self.__sessions_in_progress.discard(s_id)
self.current_dep = self.current_dep - set( self.__current_dep = self.__current_dep - set(
sess.preceding_sessions) sess.preceding_sessions)
self.current_dep.add(s_id) self.__current_dep.add(s_id)
# Add dependencies to active session # Add dependencies to active session
for s_id in self.current_dep: for s_id in self.__current_dep:
sess = self.sessions[s_id] sess = self.sessions[s_id]
think_time = date_now - sess.max_finish_time think_time = date_now - sess.max_finish_time
...@@ -114,12 +114,9 @@ class User: ...@@ -114,12 +114,9 @@ class User:
def __create_new_session(self, date_now): def __create_new_session(self, date_now):
"""Create a new active session and achive the old one""" """Create a new active session and achive the old one"""
if self.__active_session_id > 0: # Archive active session and increment active_session_id
# Archive active session and increment active session_id if self.dynamic_reduction and self.__active_session_id > 0:
active_session = self.sessions[self.__active_session_id] self.__sessions_in_progress.add(self.__active_session_id)
if self.dynamic_reduction and date_now <= active_session.max_finish_time:
self.sessions_in_progress.add(self.__active_session_id)
self.__active_session_id += 1 self.__active_session_id += 1
# Create new session # Create new session
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment