Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
swf2userSessions
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sepia-pub
mael
swf2userSessions
Commits
5046e4d9
Commit
5046e4d9
authored
2 years ago
by
Maël Madon
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/user_session_builder.py
+10
-13
10 additions, 13 deletions
src/user_session_builder.py
with
10 additions
and
13 deletions
src/user_session_builder.py
+
10
−
13
View file @
5046e4d9
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment