Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sbws
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
juga
sbws
Commits
589da111
Commit
589da111
authored
6 years ago
by
juga
Committed by
Matt Traudt
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix mispelled latest
parent
aa1dd5ad
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sbws/lib/v3bwfile.py
+8
-8
8 additions, 8 deletions
sbws/lib/v3bwfile.py
tests/unit/lib/test_v3bwfile.py
+5
-5
5 additions, 5 deletions
tests/unit/lib/test_v3bwfile.py
with
13 additions
and
13 deletions
sbws/lib/v3bwfile.py
+
8
−
8
View file @
589da111
...
...
@@ -18,7 +18,7 @@ KEYVALUE_SEP_V200 = ' '
EXTRA_ARG_KEYVALUES
=
[
'
software
'
,
'
software_version
'
,
'
file_created
'
,
'
earliest_bandwidth
'
,
'
generator_started
'
]
# List of all unordered KeyValues currently being used to generate the file
UNORDERED_KEYVALUES
=
EXTRA_ARG_KEYVALUES
+
[
'
la
s
test_bandwidth
'
]
UNORDERED_KEYVALUES
=
EXTRA_ARG_KEYVALUES
+
[
'
latest_bandwidth
'
]
# List of all the KeyValues currently being used to generate the file
ALL_KEYVALUES
=
[
'
version
'
]
+
UNORDERED_KEYVALUES
TERMINATOR
=
'
====
'
...
...
@@ -71,9 +71,9 @@ class V3BwHeader(object):
self
.
software
=
kwargs
.
get
(
'
software
'
,
'
sbws
'
)
self
.
software_version
=
kwargs
.
get
(
'
software_version
'
,
__version__
)
self
.
file_created
=
kwargs
.
get
(
'
file_created
'
,
now_isodt_str
())
# la
s
test_bandwidth should not be in kwargs, since it MUST be the
# latest_bandwidth should not be in kwargs, since it MUST be the
# same as timestamp
self
.
la
s
test_bandwidth
=
unixts_to_isodt_str
(
timestamp
)
self
.
latest_bandwidth
=
unixts_to_isodt_str
(
timestamp
)
[
setattr
(
self
,
k
,
v
)
for
k
,
v
in
kwargs
.
items
()
if
k
in
EXTRA_ARG_KEYVALUES
]
...
...
@@ -167,7 +167,7 @@ class V3BwHeader(object):
return
read_started_ts
(
conf
)
@staticmethod
def
la
s
test_bandwidth_from_results
(
results
):
def
latest_bandwidth_from_results
(
results
):
return
round
(
max
([
r
.
time
for
fp
in
results
for
r
in
results
[
fp
]]))
@staticmethod
...
...
@@ -177,11 +177,11 @@ class V3BwHeader(object):
@classmethod
def
from_results
(
cls
,
conf
,
results
):
kwargs
=
dict
()
la
s
test_bandwidth
=
cls
.
la
s
test_bandwidth_from_results
(
results
)
earliest_bandwidth
=
cls
.
la
s
test_bandwidth_from_results
(
results
)
latest_bandwidth
=
cls
.
latest_bandwidth_from_results
(
results
)
earliest_bandwidth
=
cls
.
latest_bandwidth_from_results
(
results
)
generator_started
=
cls
.
generator_started_from_file
(
conf
)
timestamp
=
str
(
la
s
test_bandwidth
)
kwargs
[
'
la
s
test_bandwidth
'
]
=
unixts_to_isodt_str
(
la
s
test_bandwidth
)
timestamp
=
str
(
latest_bandwidth
)
kwargs
[
'
latest_bandwidth
'
]
=
unixts_to_isodt_str
(
latest_bandwidth
)
kwargs
[
'
earliest_bandwidth
'
]
=
unixts_to_isodt_str
(
earliest_bandwidth
)
kwargs
[
'
generator_started
'
]
=
generator_started
h
=
cls
(
timestamp
,
**
kwargs
)
...
...
This diff is collapsed.
Click to expand it.
tests/unit/lib/test_v3bwfile.py
+
5
−
5
View file @
589da111
...
...
@@ -11,10 +11,10 @@ software_l = KEYVALUE_SEP_V110.join(['software', 'sbws'])
software_version_l
=
KEYVALUE_SEP_V110
.
join
([
'
software_version
'
,
version
])
file_created
=
'
2018-04-25T13:10:57
'
file_created_l
=
KEYVALUE_SEP_V110
.
join
([
'
file_created
'
,
file_created
])
la
s
test_bandwidth
=
'
2018-04-17T14:09:07
'
la
s
test_bandwidth_l
=
KEYVALUE_SEP_V110
.
join
([
'
la
s
test_bandwidth
'
,
la
s
test_bandwidth
])
header_ls
=
[
timestamp_l
,
version_l
,
file_created_l
,
la
s
test_bandwidth_l
,
latest_bandwidth
=
'
2018-04-17T14:09:07
'
latest_bandwidth_l
=
KEYVALUE_SEP_V110
.
join
([
'
latest_bandwidth
'
,
latest_bandwidth
])
header_ls
=
[
timestamp_l
,
version_l
,
file_created_l
,
latest_bandwidth_l
,
software_l
,
software_version_l
,
TERMINATOR
]
header_str
=
LINE_SEP
.
join
(
header_ls
)
+
LINE_SEP
earliest_bandwidth
=
'
2018-04-16T14:09:07
'
...
...
@@ -25,7 +25,7 @@ generator_started_l = KEYVALUE_SEP_V110.join(['generator_started',
generator_started
])
header_extra_ls
=
[
timestamp_l
,
version_l
,
earliest_bandwidth_l
,
file_created_l
,
generator_started_l
,
la
s
test_bandwidth_l
,
latest_bandwidth_l
,
software_l
,
software_version_l
,
TERMINATOR
]
header_extra_str
=
LINE_SEP
.
join
(
header_extra_ls
)
+
LINE_SEP
...
...
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