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
b7c3b9c1
Commit
b7c3b9c1
authored
2 years ago
by
Maël Madon
Browse files
Options
Downloads
Patches
Plain Diff
rename and refac
parent
b77eb662
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
swf.py
+0
-29
0 additions, 29 deletions
swf.py
swf2depGraph.py
+13
-14
13 additions, 14 deletions
swf2depGraph.py
swf2uStat.py
+1
-1
1 addition, 1 deletion
swf2uStat.py
with
14 additions
and
44 deletions
swf.py
deleted
100644 → 0
+
0
−
29
View file @
b77eb662
#!/usr/bin/env python3
"""
SWF types and functions.
"""
from
enum
import
Enum
,
unique
@unique
class
SwfField
(
Enum
):
"""
Maps SWF columns and their meaning.
"""
JOB_ID
=
1
SUBMIT_TIME
=
2
WAIT_TIME
=
3
RUN_TIME
=
4
ALLOCATED_PROCESSOR_COUNT
=
5
AVERAGE_CPU_TIME_USED
=
6
USED_MEMORY
=
7
REQUESTED_NUMBER_OF_PROCESSORS
=
8
REQUESTED_TIME
=
9
REQUESTED_MEMORY
=
10
STATUS
=
11
USER_ID
=
12
GROUP_ID
=
13
APPLICATION_ID
=
14
QUEUD_ID
=
15
PARTITION_ID
=
16
PRECEDING_JOB_ID
=
17
THINK_TIME_FROM_PRECEDING_JOB
=
18
This diff is collapsed.
Click to expand it.
swf2depGraph.py
+
13
−
14
View file @
b7c3b9c1
...
@@ -8,7 +8,7 @@ import json
...
@@ -8,7 +8,7 @@ import json
import
re
import
re
import
networkx
as
nx
import
networkx
as
nx
from
swf
import
SwfField
from
workload
import
SwfField
# Global dictionnary
# Global dictionnary
users
=
{}
users
=
{}
...
@@ -23,21 +23,21 @@ class Job:
...
@@ -23,21 +23,21 @@ class Job:
class
User
:
class
User
:
"""
Class representing a user of the workload.
"""
def
__init__
(
self
,
user_id
):
def
__init__
(
self
,
user_id
,
no_dynamic_reduction
=
False
):
self
.
id
=
user_id
self
.
id
=
user_id
self
.
jobs
=
{}
self
.
jobs
=
{}
# The (directed) dependancy graph
# The (directed) dependancy graph
self
.
G
=
nx
.
DiGraph
()
self
.
G
=
nx
.
DiGraph
()
def
init_dyn_reduc
(
self
):
if
not
(
no_dynamic_reduction
):
"""
Necessary data to keep track of to do dynamic transitive reduction
"""
# jobs submitted but not finished, at time t
# jobs submitted but not finished, at time t
self
.
jobs_in_progress
=
set
()
self
.
jobs_in_progress
=
set
()
# jobs finished, constituting the minimal list
# jobs finished, constituting the minimal list
# of dependencies for a job sumbitted at time t
# of dependencies for a job sumbitted at time t
self
.
current_dep
=
set
()
self
.
current_dep
=
set
()
def
add_job
(
self
,
job_id
,
submit_time
,
finish_time
,
no_dynamic_reduction
):
def
add_job
(
self
,
job_id
,
submit_time
,
finish_time
,
no_dynamic_reduction
):
# Add the job to the user's list
# Add the job to the user's list
...
@@ -76,9 +76,10 @@ class User:
...
@@ -76,9 +76,10 @@ class User:
def
dependancies_of
(
self
,
job
):
def
dependancies_of
(
self
,
job
):
"""
Return the set of direct dependancies of the job.
"""
"""
Return the set of direct dependancies of the job.
"""
{
self
.
jobs
[
n
]
for
n
in
self
.
G
.
successors
(
job
.
id
)}
return
{
self
.
jobs
[
n
]
for
n
in
self
.
G
.
successors
(
job
.
id
)}
def
export_dependancy_graph
(
self
,
output_folder
,
transitive_reduction
):
def
export_dependancy_graph
(
self
,
output_folder
,
transitive_reduction
):
"""
Write the dependancy graph as a gml file, for each user.
"""
if
transitive_reduction
:
if
transitive_reduction
:
self
.
G
=
nx
.
transitive_reduction
(
self
.
G
)
self
.
G
=
nx
.
transitive_reduction
(
self
.
G
)
...
@@ -88,9 +89,7 @@ class User:
...
@@ -88,9 +89,7 @@ class User:
def
build_dep_graph
(
job_id
,
submit_time
,
finish_time
,
user_id
,
def
build_dep_graph
(
job_id
,
submit_time
,
finish_time
,
user_id
,
no_dynamic_reduction
):
no_dynamic_reduction
):
if
user_id
not
in
users
:
if
user_id
not
in
users
:
users
[
user_id
]
=
User
(
user_id
)
users
[
user_id
]
=
User
(
user_id
,
no_dynamic_reduction
)
if
not
no_dynamic_reduction
:
(
users
[
user_id
]).
init_dyn_reduc
()
user
=
users
[
user_id
]
user
=
users
[
user_id
]
user
.
add_job
(
job_id
,
submit_time
,
finish_time
,
no_dynamic_reduction
)
user
.
add_job
(
job_id
,
submit_time
,
finish_time
,
no_dynamic_reduction
)
...
...
This diff is collapsed.
Click to expand it.
swf2uStat.py
+
1
−
1
View file @
b7c3b9c1
...
@@ -9,7 +9,7 @@ import json
...
@@ -9,7 +9,7 @@ import json
import
re
import
re
from
copy
import
deepcopy
from
copy
import
deepcopy
from
swf
import
SwfField
from
workload
import
SwfField
# Global dictionnary
# Global dictionnary
users
=
{}
users
=
{}
...
...
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