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
a951cee8
Commit
a951cee8
authored
2 years ago
by
Maël Madon
Browse files
Options
Downloads
Patches
Plain Diff
start working on SWF -> SABjson parser
parent
b7c3b9c1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+4
-1
4 additions, 1 deletion
.gitignore
user_session_builder.py
+1
-0
1 addition, 0 deletions
user_session_builder.py
workload.py
+81
-0
81 additions, 0 deletions
workload.py
with
86 additions
and
1 deletion
.gitignore
+
4
−
1
View file @
a951cee8
__pycache__
.vscode
out/*
\ No newline at end of file
out/*
workloads/*
!workloads/KTH-SP2-1996-2.1-cln.swf
This diff is collapsed.
Click to expand it.
user_session_builder.py
0 → 100644
+
1
−
0
View file @
a951cee8
from
workload
import
SwfField
,
Job
\ No newline at end of file
This diff is collapsed.
Click to expand it.
workload.py
0 → 100644
+
81
−
0
View file @
a951cee8
#!/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
class
Job
:
"""
Class representing a job in the workload.
"""
def
__init__
(
self
,
job_id
,
submit_time
,
finish_time
,
start_time
=
None
,
nb_requested_resources
=
None
,
walltime
=
None
):
self
.
id
=
job_id
self
.
submit_time
=
submit_time
self
.
start_time
=
start_time
self
.
finish_time
=
finish_time
self
.
res
=
nb_requested_resources
self
.
walltime
=
walltime
def
to_dict
(
self
):
"""
Job object to dictionnary, for printing or json export.
"""
run_time
=
self
.
finish_time
-
self
.
start_time
return
{
"
id
"
:
self
.
id
,
"
profile
"
:
str
(
run_time
),
"
res
"
:
self
.
res
,
"
subtime
"
:
self
.
submit_time
,
"
walltime
"
:
self
.
walltime
}
class
Session
:
"""
Class representing a user session.
"""
def
__init__
(
self
,
id
,
first_submit
):
self
.
id
=
id
self
.
first_submit
=
first_submit
self
.
preceding_sessions
=
[]
self
.
tt_after_prec_sess
=
[]
self
.
jobs
=
[]
def
to_dict
(
self
):
"""
Session object to dictionnary, for printing or json export.
"""
return
{
"
id
"
:
self
.
id
,
"
first_submit_time
"
:
self
.
first_submit
,
"
preceding_sessions
"
:
self
.
preceding_sessions
,
"
thinking_time_after_preceding_session
"
:
self
.
tt_after_prec_sess
,
"
nb_jobs
"
:
len
(
self
.
jobs
),
"
jobs
"
:
[
j
.
to_dict
()
for
j
in
self
.
jobs
]
}
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