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
7521f4cf
Commit
7521f4cf
authored
Apr 09, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an argument to disable progress output to stderr.
parent
034faedd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
apachedex/__init__.py
apachedex/__init__.py
+15
-9
No files found.
apachedex/__init__.py
View file @
7521f4cf
...
@@ -939,6 +939,8 @@ def main():
...
@@ -939,6 +939,8 @@ def main():
help
=
'Filename to write output to. Use - for stdout. Default: %(default)s'
)
help
=
'Filename to write output to. Use - for stdout. Default: %(default)s'
)
parser
.
add_argument
(
'-q'
,
'--quiet'
,
action
=
'store_true'
,
parser
.
add_argument
(
'-q'
,
'--quiet'
,
action
=
'store_true'
,
help
=
'Suppress warnings about malformed lines.'
)
help
=
'Suppress warnings about malformed lines.'
)
parser
.
add_argument
(
'-Q'
,
dest
=
'extra_quiet'
,
action
=
'store_true'
,
help
=
'Suppress progress indication (file being parsed, lines counter)'
)
parser
.
add_argument
(
'--state-file'
,
nargs
=
'+'
,
default
=
[],
type
=
file
,
parser
.
add_argument
(
'--state-file'
,
nargs
=
'+'
,
default
=
[],
type
=
file
,
help
=
'Use given JSON files as initial state. Mixing files generated with '
help
=
'Use given JSON files as initial state. Mixing files generated with '
'different parameters is allowed, but no correction is made. Output may '
'different parameters is allowed, but no correction is made. Output may '
...
@@ -1110,10 +1112,12 @@ def main():
...
@@ -1110,10 +1112,12 @@ def main():
no_url_lines
=
0
no_url_lines
=
0
all_lines
=
0
all_lines
=
0
skipped_user_agent
=
0
skipped_user_agent
=
0
show_progress
=
not
args
.
extra_quiet
start_time
=
time
.
time
()
start_time
=
time
.
time
()
for
fileno
,
filename
in
enumerate
(
infile_list
,
1
):
for
fileno
,
filename
in
enumerate
(
infile_list
,
1
):
print
>>
sys
.
stderr
,
'Processing %s [%i/%i]'
%
(
if
show_progress
:
filename
,
fileno
,
file_count
)
print
>>
sys
.
stderr
,
'Processing %s [%i/%i]'
%
(
filename
,
fileno
,
file_count
)
if
filename
==
'-'
:
if
filename
==
'-'
:
logfile
=
sys
.
stdin
logfile
=
sys
.
stdin
else
:
else
:
...
@@ -1130,9 +1134,8 @@ def main():
...
@@ -1130,9 +1134,8 @@ def main():
logfile
=
open
(
filename
)
logfile
=
open
(
filename
)
lineno
=
0
lineno
=
0
for
lineno
,
line
in
enumerate
(
logfile
,
1
):
for
lineno
,
line
in
enumerate
(
logfile
,
1
):
if
lineno
%
5000
==
0
:
if
show_progress
and
lineno
%
5000
==
0
:
sys
.
stderr
.
write
(
'%i
\
r
'
%
lineno
)
print
>>
sys
.
stderr
,
'%i
\
r
'
,
sys
.
stderr
.
flush
()
match
=
matchline
(
line
)
match
=
matchline
(
line
)
if
match
is
None
:
if
match
is
None
:
match
=
expensive_matchline
(
line
)
match
=
expensive_matchline
(
line
)
...
@@ -1176,15 +1179,17 @@ def main():
...
@@ -1176,15 +1179,17 @@ def main():
next_period
=
getNextPeriod
()
next_period
=
getNextPeriod
()
except
StopIteration
:
except
StopIteration
:
pass
pass
print
>>
sys
.
stderr
,
'Increasing period to'
,
period
,
'...'
,
if
show_progress
:
print
>>
sys
.
stderr
,
'Increasing period to'
,
period
,
'...'
,
old_date_format
=
date_format
old_date_format
=
date_format
asDate
,
decimator
,
graph_period
,
date_format
,
placeholder_delta
,
\
asDate
,
decimator
,
graph_period
,
date_format
,
placeholder_delta
,
\
round_date
=
period_parser
[
period
]
round_date
=
period_parser
[
period
]
period_increase_start
=
time
.
time
()
period_increase_start
=
time
.
time
()
for
site_data
in
per_site
.
itervalues
():
for
site_data
in
per_site
.
itervalues
():
site_data
.
rescale
(
rescale
,
getDuration
)
site_data
.
rescale
(
rescale
,
getDuration
)
print
>>
sys
.
stderr
,
'done (%s)'
%
timedelta
(
seconds
=
time
.
time
()
if
show_progress
:
-
period_increase_start
)
print
>>
sys
.
stderr
,
'done (%s)'
%
timedelta
(
seconds
=
time
.
time
()
-
period_increase_start
)
date
=
asDate
(
match
.
group
(
'timestamp'
))
date
=
asDate
(
match
.
group
(
'timestamp'
))
try
:
try
:
site_data
=
per_site
[
site
]
site_data
=
per_site
[
site
]
...
@@ -1193,7 +1198,8 @@ def main():
...
@@ -1193,7 +1198,8 @@ def main():
error_detail
=
error_detail
)
error_detail
=
error_detail
)
site_data
.
accumulate
(
match
,
url_match
,
date
)
site_data
.
accumulate
(
match
,
url_match
,
date
)
all_lines
+=
lineno
all_lines
+=
lineno
sys
.
stderr
.
write
(
'%i
\
n
'
%
lineno
)
if
show_progress
:
print
>>
sys
.
stderr
,
lineno
end_parsing_time
=
time
.
time
()
end_parsing_time
=
time
.
time
()
generator
,
out_encoding
=
format_generator
[
args
.
format
]
generator
,
out_encoding
=
format_generator
[
args
.
format
]
if
args
.
out
==
'-'
:
if
args
.
out
==
'-'
:
...
...
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