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
8f4c5b8a
Commit
8f4c5b8a
authored
Oct 16, 2018
by
juga
Browse files
Merge branch 'ticket28041_fix_num_results'
parents
74856970
a9deba5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
8f4c5b8a
...
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
...
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
### Changed
-
Move
``examples/``
to
``docs/``
(#28040)
-
Move
``examples/``
to
``docs/``
(#28040)
-
Number of results comparison and number of results away from each other are
incorrect (#28041)
## [0.8.0] - 2018-10-08
## [0.8.0] - 2018-10-08
...
...
sbws/lib/v3bwfile.py
View file @
8f4c5b8a
...
@@ -275,14 +275,19 @@ class V3BWLine(object):
...
@@ -275,14 +275,19 @@ class V3BWLine(object):
kwargs
.
update
(
cls
.
result_types_from_results
(
results
))
kwargs
.
update
(
cls
.
result_types_from_results
(
results
))
# useful args for scaling
# useful args for scaling
if
success_results
:
if
success_results
:
min_num_success_results
=
cls
.
min_num_results
(
success_results
,
if
not
len
(
success_results
)
>=
min_num
:
min_num
)
# log.debug('The number of results is les than %s', min_num)
if
not
min_num_success_results
:
return
None
return
None
results_away
=
\
results_away
=
\
cls
.
results_away_each_other
(
min_num_success_results
,
secs_away
)
cls
.
results_away_each_other
(
success_results
,
secs_away
)
if
not
results_away
:
log
.
debug
(
"There are no results with relays' results away from"
" each other {}"
.
format
(
secs_away
))
return
None
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
# the most recent should be the last
kwargs
[
'desc_avg_bw_bs'
]
=
\
kwargs
[
'desc_avg_bw_bs'
]
=
\
...
@@ -321,14 +326,10 @@ class V3BWLine(object):
...
@@ -321,14 +326,10 @@ class V3BWLine(object):
bw_line
=
cls
(
node_id
,
bw
,
**
kwargs
)
bw_line
=
cls
(
node_id
,
bw
,
**
kwargs
)
return
bw_line
return
bw_line
@
staticmethod
def
min_num_results
(
results
,
min_num
=
0
):
if
len
(
results
)
>
min_num
:
return
results
return
None
@
staticmethod
@
staticmethod
def
results_away_each_other
(
results
,
secs_away
=
None
):
def
results_away_each_other
(
results
,
secs_away
=
None
):
# log.debug("Checking whether results are away from each other in %s "
# "secs.", secs_away)
if
secs_away
is
None
or
len
(
results
)
<
2
:
if
secs_away
is
None
or
len
(
results
)
<
2
:
return
results
return
results
# the last one should be the most recent
# the last one should be the most recent
...
@@ -337,6 +338,10 @@ class V3BWLine(object):
...
@@ -337,6 +338,10 @@ class V3BWLine(object):
for
r
in
reversed
(
results
[:
-
1
]):
for
r
in
reversed
(
results
[:
-
1
]):
if
abs
(
results_away
[
0
].
time
-
r
.
time
)
>
secs_away
:
if
abs
(
results_away
[
0
].
time
-
r
.
time
)
>
secs_away
:
results_away
.
insert
(
0
,
r
)
results_away
.
insert
(
0
,
r
)
# if there is only 1 result, is the one inserted at the beginning,
# so there are no results away from each other
if
len
(
results_away
)
<
2
:
return
None
return
results_away
return
results_away
@
staticmethod
@
staticmethod
...
...
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