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
0c5415d4
Unverified
Commit
0c5415d4
authored
6 years ago
by
juga
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #255 from juga0/ticket27337_round_bw
Ticket27337 round bw
parents
1603c888
d09dc0e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
sbws/core/generate.py
+7
-2
7 additions, 2 deletions
sbws/core/generate.py
sbws/globals.py
+1
-0
1 addition, 0 deletions
sbws/globals.py
sbws/lib/v3bwfile.py
+17
-7
17 additions, 7 deletions
sbws/lib/v3bwfile.py
with
26 additions
and
9 deletions
CHANGELOG.md
+
1
−
0
View file @
0c5415d4
...
...
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
-
Implement Torflow scaling (#27108)
-
Create methods to easy graph generation and obtain statistics
to compare with current torflow results.(#27688)
-
Implement rounding bw in bandwidth files to 2 insignificant digits(#27337)
### Fixed
...
...
This diff is collapsed.
Click to expand it.
sbws/core/generate.py
+
7
−
2
View file @
0c5415d4
from
sbws.globals
import
(
fail_hard
,
SBWS_SCALE_CONSTANT
,
TORFLOW_SCALING
,
SBWS_SCALING
,
TORFLOW_BW_MARGIN
)
SBWS_SCALING
,
TORFLOW_BW_MARGIN
,
TORFLOW_ROUND_DIG
)
from
sbws.lib.v3bwfile
import
V3BWFile
from
sbws.lib.resultdump
import
load_recent_results_in_datadir
from
argparse
import
ArgumentDefaultsHelpFormatter
...
...
@@ -44,6 +44,10 @@ def gen_parser(sub):
type
=
float
,
help
=
"
Cap maximum bw when scaling as Torflow.
"
"
(Default: 0.05)
"
)
p
.
add_argument
(
'
-r
'
,
'
--torflow-round-digs
'
,
default
=
TORFLOW_ROUND_DIG
,
type
=
int
,
help
=
"
Number of most significant digits to round bw
"
"
when scaling as Torflow. (Default: 3)
"
)
def
main
(
args
,
conf
):
...
...
@@ -77,7 +81,8 @@ def main(args, conf):
state_fpath
=
conf
.
getpath
(
'
paths
'
,
'
state_fname
'
)
bw_file
=
V3BWFile
.
from_results
(
results
,
state_fpath
,
args
.
scale_constant
,
scaling_method
,
torflow_cap
=
args
.
torflow_bw_margin
)
torflow_cap
=
args
.
torflow_bw_margin
,
torflow_round_digs
=
args
.
torflow_round_digs
)
output
=
args
.
output
or
\
conf
.
getpath
(
'
paths
'
,
'
v3bw_fname
'
).
format
(
now_fname
())
bw_file
.
write
(
output
)
...
...
This diff is collapsed.
Click to expand it.
sbws/globals.py
+
1
−
0
View file @
0c5415d4
...
...
@@ -37,6 +37,7 @@ TORFLOW_BW_MARGIN = 0.05
TORFLOW_OBS_LAST
=
0
TORFLOW_OBS_MEAN
=
1
TORFLOW_OBS_DECAYING
=
3
TORFLOW_ROUND_DIG
=
3
BW_LINE_SIZE
=
510
...
...
This diff is collapsed.
Click to expand it.
sbws/lib/v3bwfile.py
+
17
−
7
View file @
0c5415d4
...
...
@@ -9,8 +9,9 @@ from statistics import median, mean
from
sbws
import
__version__
from
sbws.globals
import
(
SPEC_VERSION
,
BW_LINE_SIZE
,
SBWS_SCALE_CONSTANT
,
SBWS_SCALING
,
TORFLOW_BW_MARGIN
,
TORFLOW_SCALING
,
TORFLOW_OBS_LAST
,
TORFLOW_OBS_MEAN
)
TORFLOW_SCALING
,
SBWS_SCALING
,
TORFLOW_BW_MARGIN
,
TORFLOW_OBS_LAST
,
TORFLOW_OBS_MEAN
,
TORFLOW_ROUND_DIG
)
from
sbws.lib.resultdump
import
ResultSuccess
,
_ResultType
from
sbws.util.filelock
import
DirectoryLock
from
sbws.util.timestamp
import
now_isodt_str
,
unixts_to_isodt_str
...
...
@@ -48,6 +49,12 @@ BW_KEYVALUES_INT = ['bw', 'rtt', 'success', 'error_stream',
BW_KEYVALUES
=
BW_KEYVALUES_BASIC
+
BW_KEYVALUES_EXTRA
def
kb_round_x_sig_dig
(
bw_bs
,
digits
=
TORFLOW_ROUND_DIG
):
"""
Convert bw to KB and round to x most significat digits.
"""
bw_kb
=
bw_bs
/
1000
return
max
(
int
(
round
(
bw_kb
,
-
digits
)),
1
)
def
num_results_of_type
(
results
,
type_str
):
return
len
([
r
for
r
in
results
if
r
.
type
==
type_str
])
...
...
@@ -399,6 +406,7 @@ class V3BWFile(object):
scale_constant
=
SBWS_SCALE_CONSTANT
,
scaling_method
=
None
,
torflow_obs
=
TORFLOW_OBS_LAST
,
torflow_cap
=
TORFLOW_BW_MARGIN
,
torflow_round_digs
=
TORFLOW_ROUND_DIG
,
reverse
=
False
):
"""
Create V3BWFile class from sbws Results.
...
...
@@ -434,7 +442,7 @@ class V3BWFile(object):
# log.debug(bw_lines[-1])
elif
scaling_method
==
TORFLOW_SCALING
:
bw_lines
=
cls
.
bw_torflow_scale
(
bw_lines_raw
,
torflow_obs
,
torflow_cap
)
torflow_cap
,
torflow_round_digs
)
# log.debug(bw_lines[-1])
else
:
bw_lines
=
cls
.
bw_kb
(
bw_lines_raw
)
...
...
@@ -519,7 +527,8 @@ class V3BWFile(object):
@staticmethod
def
bw_torflow_scale
(
bw_lines
,
desc_obs_bws
=
TORFLOW_OBS_LAST
,
cap
=
TORFLOW_BW_MARGIN
,
reverse
=
False
):
cap
=
TORFLOW_BW_MARGIN
,
num_round_dig
=
TORFLOW_ROUND_DIG
,
reverse
=
False
):
"""
Obtain final bandwidth measurements applying Torflow
'
s scaling
method.
...
...
@@ -699,11 +708,12 @@ class V3BWFile(object):
elif
desc_obs_bws
==
TORFLOW_OBS_MEAN
:
desc_obs_bw
=
l
.
desc_obs_bw_bs_mean
# just applying the formula above:
bw_new
=
max
(
bw_new
=
kb_round_x_sig_dig
(
max
(
l
.
bw_bs_mean
/
mu
,
# ratio
min
(
l
.
bw_bs_mean
,
mu
)
/
muf
# ratio filtered
)
*
desc_obs_bw
\
/
1000
# convert to KB
)
*
desc_obs_bw
,
\
digits
=
num_round_dig
)
# convert to KB
# Cap maximum bw
if
cap
is
not
None
:
bw_new
=
min
(
hlimit
,
bw_new
)
...
...
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