Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apachedex
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
apachedex
Commits
a7e0a644
Commit
a7e0a644
authored
Apr 09, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for reading state data from stdin.
parent
6f7c77f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
28 deletions
+38
-28
apachedex/__init__.py
apachedex/__init__.py
+38
-28
No files found.
apachedex/__init__.py
View file @
a7e0a644
...
@@ -993,10 +993,12 @@ def main():
...
@@ -993,10 +993,12 @@ def main():
parser
.
add_argument
(
'-Q'
,
dest
=
'extra_quiet'
,
action
=
'store_true'
,
parser
.
add_argument
(
'-Q'
,
dest
=
'extra_quiet'
,
action
=
'store_true'
,
help
=
'Suppress progress indication (file being parsed, lines counter). '
help
=
'Suppress progress indication (file being parsed, lines counter). '
'Does not imply -q.'
)
'Does not imply -q.'
)
parser
.
add_argument
(
'--state-file'
,
nargs
=
'+'
,
default
=
[],
type
=
file
,
parser
.
add_argument
(
'--state-file'
,
nargs
=
'+'
,
default
=
[],
help
=
'Use given JSON files as initial state. Mixing files generated with '
help
=
'Use given JSON files as initial state. Use - for stdin. Loading'
'different parameters is allowed, but no correction is made. Output may '
'multiple files through stdin is not possible). Mixing '
'be unusable (ex: different --apdex, different --period, ...).'
)
'files generated with different parameters is allowed, but no '
'correction is made. Output may be unusable (ex: different --apdex, '
'different --period, ...).'
)
group
=
parser
.
add_argument_group
(
'generated content'
)
group
=
parser
.
add_argument_group
(
'generated content'
)
group
.
add_argument
(
'-a'
,
'--apdex'
,
default
=
1.0
,
type
=
float
,
group
.
add_argument
(
'-a'
,
'--apdex'
,
default
=
1.0
,
type
=
float
,
...
@@ -1132,32 +1134,40 @@ def main():
...
@@ -1132,32 +1134,40 @@ def main():
error_detail
=
args
.
error_detail
error_detail
=
args
.
error_detail
file_count
=
len
(
infile_list
)
file_count
=
len
(
infile_list
)
per_site
=
{}
per_site
=
{}
for
state_file
in
args
.
state_file
:
if
'-'
in
args
.
state_file
and
'-'
in
infile_list
:
print
>>
sys
.
stderr
,
'Loading'
,
state_file
.
name
,
'...'
,
print
>>
sys
.
stderr
,
'stdin cannot be used both as log and state input.'
load_start
=
time
.
time
()
sys
.
exit
(
1
)
state
=
json
.
load
(
state_file
,
encoding
=
'ascii'
)
for
state_file_name
in
args
.
state_file
:
for
url
,
site_state
in
state
:
print
>>
sys
.
stderr
,
'Loading'
,
state_file_name
,
'...'
,
if
url
is
None
:
if
state_file_name
==
'-'
:
site
=
None
state_file
=
sys
.
stdin
action
=
default_action
else
:
else
:
state_file
=
open
(
state_file_name
)
for
site
,
prefix_match
,
action
in
site_list
:
with
state_file
:
if
site
==
url
:
load_start
=
time
.
time
()
break
state
=
json
.
load
(
state_file
,
encoding
=
'ascii'
)
else
:
for
url
,
site_state
in
state
:
if
url
is
None
:
site
=
None
site
=
None
action
=
default_action
action
=
default_action
if
action
is
None
:
else
:
print
>>
sys
.
stderr
,
'Info: no prefix match %r, stats skipped'
%
url
for
site
,
prefix_match
,
action
in
site_list
:
continue
if
site
==
url
:
site_stats
=
action
.
func
.
fromJSONState
(
site_state
,
break
getDuration
,
action
.
keywords
[
'suffix'
])
else
:
if
site
in
per_site
:
site
=
None
per_site
[
site
].
accumulateFrom
(
site_stats
)
action
=
default_action
else
:
if
action
is
None
:
per_site
[
site
]
=
site_stats
print
>>
sys
.
stderr
,
'Info: no prefix match %r, stats skipped'
%
url
print
>>
sys
.
stderr
,
'done (%s)'
%
timedelta
(
seconds
=
time
.
time
()
continue
-
load_start
)
site_stats
=
action
.
func
.
fromJSONState
(
site_state
,
getDuration
,
action
.
keywords
[
'suffix'
])
if
site
in
per_site
:
per_site
[
site
].
accumulateFrom
(
site_stats
)
else
:
per_site
[
site
]
=
site_stats
print
>>
sys
.
stderr
,
'done (%s)'
%
timedelta
(
seconds
=
time
.
time
()
-
load_start
)
skip_user_agent
=
list
(
itertools
.
chain
(
*
args
.
skip_user_agent
))
skip_user_agent
=
list
(
itertools
.
chain
(
*
args
.
skip_user_agent
))
malformed_lines
=
0
malformed_lines
=
0
skipped_lines
=
0
skipped_lines
=
0
...
...
Write
Preview
Markdown
is supported
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