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
2cff7083
Commit
2cff7083
authored
May 10, 2018
by
juga
Browse files
Rename scanner_started to tenerator_started
parent
8b84838e
Changes
4
Hide whitespace changes
Inline
Side-by-side
sbws/core/generate.py
View file @
2cff7083
...
...
@@ -106,8 +106,8 @@ def read_started_ts(conf):
"""
with
open
(
os
.
path
.
join
(
conf
[
'paths'
][
'datadir'
],
conf
[
'scanner'
][
'started_filepath'
]),
'r'
)
as
fd
:
scanne
r_started
_ts
=
fd
.
read
()
return
scanne
r_started
_ts
generato
r_started
=
fd
.
read
()
return
generato
r_started
def
main
(
args
,
conf
):
...
...
@@ -132,12 +132,12 @@ def main(args, conf):
data_lines
=
[
result_data_to_v3bw_line
(
results
,
fp
)
for
fp
in
results
]
data_lines
=
sorted
(
data_lines
,
key
=
lambda
d
:
d
.
bw
,
reverse
=
True
)
data_lines
=
scale_lines
(
args
,
data_lines
)
scanne
r_started
_ts
=
read_started_ts
(
conf
)
generato
r_started
=
read_started_ts
(
conf
)
if
results
:
header
=
V3BwHeader
(
earliest_bandwidth
=
earliest_bandwidth
,
scanne
r_started
_ts
=
scanne
r_started
_ts
)
generato
r_started
=
generato
r_started
)
else
:
header
=
V3BwHeader
(
scanne
r_started
_ts
=
scanne
r_started
_ts
)
header
=
V3BwHeader
(
generato
r_started
=
generato
r_started
)
log_stats
(
data_lines
)
output
=
conf
[
'paths'
][
'v3bw_fname'
]
if
args
.
output
:
...
...
sbws/core/scanner.py
View file @
2cff7083
...
...
@@ -283,11 +283,11 @@ def write_start_ts(conf):
:param ConfigParser conf: configuration
"""
scanne
r_started
_ts
=
str
(
time
.
time
())
log
.
info
(
'Scanner started at {}'
.
format
(
scanne
r_started
_ts
))
generato
r_started
=
str
(
time
.
time
())
log
.
info
(
'Scanner started at {}'
.
format
(
generato
r_started
))
with
open
(
os
.
path
.
join
(
conf
[
'paths'
][
'datadir'
],
conf
[
'scanner'
][
'started_filepath'
]),
'wt'
)
as
fd
:
fd
.
write
(
scanne
r_started
_ts
)
fd
.
write
(
generato
r_started
)
def
run_speedtest
(
args
,
conf
):
...
...
sbws/lib/v3bwfile.py
View file @
2cff7083
...
...
@@ -29,8 +29,8 @@ class V3BwHeader(object):
self
.
software_version
=
software_version
if
kwargs
.
get
(
'earliest_bandwidth'
):
self
.
earliest_bandwidth
=
kwargs
[
'earliest_bandwidth'
]
if
kwargs
.
get
(
'
scanne
r_started
_ts
'
):
self
.
scanner_started
=
kwargs
[
'
scanne
r_started
_ts
'
]
if
kwargs
.
get
(
'
generato
r_started'
):
self
.
scanner_started
=
kwargs
[
'
generato
r_started'
]
def
__str__
(
self
):
...
...
tests/lib/test_v3bwfile.py
View file @
2cff7083
...
...
@@ -25,8 +25,8 @@ def test_v3bwheader_earliest_bandwidth_str():
def
test_v3bwheader_scanner_started_str
():
"""Test header str with scanner_started"""
timestamp
=
1524661857
scanne
r_started
_ts
=
1523887747.2904038
header
=
V3BwHeader
(
timestamp
,
scanne
r_started
_ts
=
scanne
r_started
_ts
)
generato
r_started
=
1523887747.2904038
header
=
V3BwHeader
(
timestamp
,
generato
r_started
=
generato
r_started
)
assert
str
(
header
)
==
'{}
\n
scanner_started=1523887747.2904038'
\
'{}
\n
version=1.1.0
\n
software=sbws
\n
'
\
'software_version={}
\n
'
.
format
(
timestamp
,
version
)
...
...
@@ -42,15 +42,6 @@ def test_v3bwheader_earliest_bandwidth_str():
'timestamp=1524661857 version=1.1.0
\n
'
.
format
(
timestamp
)
def
test_v3bwheader_scanner_started_str
():
"""Test header str with scanner_started"""
timestamp
=
1524661857
scanner_started_ts
=
1523887747.2904038
header
=
V3BwHeader
(
timestamp
,
scanner_started_ts
=
scanner_started_ts
)
assert
str
(
header
)
==
'{}
\n
scanner_started=1523887747.2904038 '
\
'software=sbws software_version=0.1.0 '
\
'timestamp=1524661857 version=1.1.0
\n
'
.
format
(
timestamp
)
def
test_v3bwfile
():
"""Test generate v3bw file (including relay_lines)."""
pass
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