Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
juga
sbws
Commits
73c01a47
Commit
73c01a47
authored
Oct 22, 2018
by
Matt Traudt
Browse files
Merge remote-tracking branch 'juga/ticket28105_fix_recent_results'
parents
8f862024
52e22215
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
73c01a47
...
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
...
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
-
Number of results comparison and number of results away from each other are
-
Number of results comparison and number of results away from each other are
incorrect (#28041)
incorrect (#28041)
-
Stop removing results that are not away from some other X secs (#28103)
-
Stop removing results that are not away from some other X secs (#28103)
-
Use secs-away when provided instead of data_period (#28105)
## [0.8.0] - 2018-10-08
## [0.8.0] - 2018-10-08
...
...
sbws/core/generate.py
View file @
73c01a47
from
math
import
ceil
from
sbws.globals
import
(
fail_hard
,
SBWS_SCALE_CONSTANT
,
TORFLOW_SCALING
,
from
sbws.globals
import
(
fail_hard
,
SBWS_SCALE_CONSTANT
,
TORFLOW_SCALING
,
SBWS_SCALING
,
TORFLOW_BW_MARGIN
,
TORFLOW_ROUND_DIG
,
SBWS_SCALING
,
TORFLOW_BW_MARGIN
,
TORFLOW_ROUND_DIG
,
DAY_SECS
,
NUM_MIN_RESULTS
)
DAY_SECS
,
NUM_MIN_RESULTS
)
...
@@ -79,8 +81,10 @@ def main(args, conf):
...
@@ -79,8 +81,10 @@ def main(args, conf):
scaling_method
=
None
scaling_method
=
None
else
:
else
:
scaling_method
=
TORFLOW_SCALING
scaling_method
=
TORFLOW_SCALING
if
args
.
secs_recent
:
fresh_days
=
conf
.
getint
(
'general'
,
'data_period'
)
fresh_days
=
ceil
(
args
.
secs_recent
/
24
/
60
/
60
)
else
:
fresh_days
=
conf
.
getint
(
'general'
,
'data_period'
)
reset_bw_ipv4_changes
=
conf
.
getboolean
(
'general'
,
'reset_bw_ipv4_changes'
)
reset_bw_ipv4_changes
=
conf
.
getboolean
(
'general'
,
'reset_bw_ipv4_changes'
)
reset_bw_ipv6_changes
=
conf
.
getboolean
(
'general'
,
'reset_bw_ipv6_changes'
)
reset_bw_ipv6_changes
=
conf
.
getboolean
(
'general'
,
'reset_bw_ipv6_changes'
)
results
=
load_recent_results_in_datadir
(
results
=
load_recent_results_in_datadir
(
...
...
sbws/lib/v3bwfile.py
View file @
73c01a47
...
@@ -288,10 +288,7 @@ class V3BWLine(object):
...
@@ -288,10 +288,7 @@ class V3BWLine(object):
# [unixts_to_isodt_str(r.time) for r in results_away])
# [unixts_to_isodt_str(r.time) for r in results_away])
results_recent
=
cls
.
results_recent_than
(
results_away
,
secs_recent
)
results_recent
=
cls
.
results_recent_than
(
results_away
,
secs_recent
)
if
not
results_recent
:
if
not
results_recent
:
log
.
debug
(
"There are no results that are more recent than {}"
" secs"
.
format
(
secs_recent
))
return
None
return
None
# the most recent should be the last
kwargs
[
'desc_avg_bw_bs'
]
=
\
kwargs
[
'desc_avg_bw_bs'
]
=
\
results_recent
[
-
1
].
relay_average_bandwidth
results_recent
[
-
1
].
relay_average_bandwidth
kwargs
[
'rtt'
]
=
cls
.
rtt_from_results
(
results_recent
)
kwargs
[
'rtt'
]
=
cls
.
rtt_from_results
(
results_recent
)
...
@@ -345,10 +342,14 @@ class V3BWLine(object):
...
@@ -345,10 +342,14 @@ class V3BWLine(object):
def
results_recent_than
(
results
,
secs_recent
=
None
):
def
results_recent_than
(
results
,
secs_recent
=
None
):
if
secs_recent
is
None
:
if
secs_recent
is
None
:
return
results
return
results
results_recent
=
filter
(
results_recent
=
list
(
filter
(
lambda
x
:
(
now_unixts
()
-
x
.
time
)
<
secs_recent
,
lambda
x
:
(
now_unixts
()
-
x
.
time
)
<
secs_recent
,
results
)
results
))
return
list
(
results_recent
)
# if not results_recent:
# log.debug("Results are NOT more recent than %ss: %s",
# secs_recent,
# [unixts_to_isodt_str(r.time) for r in results])
return
results_recent
@
staticmethod
@
staticmethod
def
bw_bs_median_from_results
(
results
):
def
bw_bs_median_from_results
(
results
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment