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
5c4d3570
Commit
5c4d3570
authored
Apr 14, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Toward Python3: print_function
parent
16c75a95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
apachedex/__init__.py
apachedex/__init__.py
+18
-15
No files found.
apachedex/__init__.py
View file @
5c4d3570
...
...
@@ -26,6 +26,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
__future__
import
print_function
from
cgi
import
escape
from
collections
import
defaultdict
,
Counter
from
datetime
import
datetime
,
timedelta
,
date
...
...
@@ -1241,7 +1242,7 @@ def main():
parser
.
error
(
'stdin cannot be used both as log and state input.'
)
loading_start_time
=
time
.
time
()
for
state_file_name
in
args
.
state_file
:
print
>>
sys
.
stderr
,
'Loading'
,
state_file_name
,
'...'
,
print
(
'Loading %s...'
%
state_file_name
,
end
=
''
,
file
=
sys
.
stderr
)
if
state_file_name
==
'-'
:
state_file
=
sys
.
stdin
else
:
...
...
@@ -1261,7 +1262,8 @@ def main():
site
=
None
action
=
default_action
if
action
is
None
:
print
>>
sys
.
stderr
,
'Info: no prefix match %r, stats skipped'
%
url
print
(
'Info: no prefix match %r, stats skipped'
%
url
,
file
=
'sys.stderr'
)
continue
site_stats
=
action
.
func
.
fromJSONState
(
site_state
,
getDuration
,
action
.
keywords
[
'suffix'
])
...
...
@@ -1269,8 +1271,8 @@ def main():
per_site
[
site
].
accumulateFrom
(
site_stats
)
else
:
per_site
[
site
]
=
site_stats
print
>>
sys
.
stderr
,
'done (%s)'
%
timedelta
(
seconds
=
time
.
time
()
-
load_start
)
print
(
'done (%s)'
%
timedelta
(
seconds
=
time
.
time
()
-
load_start
),
file
=
sys
.
stderr
)
skip_user_agent
=
list
(
itertools
.
chain
(
*
args
.
skip_user_agent
))
malformed_lines
=
0
skipped_lines
=
0
...
...
@@ -1281,8 +1283,8 @@ def main():
parsing_start_time
=
time
.
time
()
for
fileno
,
filename
in
enumerate
(
infile_list
,
1
):
if
show_progress
:
print
>>
sys
.
stderr
,
'Processing %s [%i/%i]'
%
(
file
name
,
fileno
,
file_count
)
print
(
'Processing %s [%i/%i]'
%
(
filename
,
fileno
,
file_count
),
file
=
sys
.
stderr
)
if
filename
==
'-'
:
logfile
=
sys
.
stdin
else
:
...
...
@@ -1300,14 +1302,14 @@ def main():
lineno
=
0
for
lineno
,
line
in
enumerate
(
logfile
,
1
):
if
show_progress
and
lineno
%
5000
==
0
:
print
>>
sys
.
stderr
,
lineno
,
'
\
r
'
,
print
(
lineno
,
end
=
'
\
r
'
,
file
=
sys
.
stderr
)
match
=
matchline
(
line
)
if
match
is
None
:
match
=
expensive_matchline
(
line
)
if
match
is
None
:
if
not
quiet
:
print
>>
sys
.
stderr
,
'Malformed line at %s:%i: %r'
%
(
file
name
,
lineno
,
line
)
print
(
'Malformed line at %s:%i: %r'
%
(
filename
,
lineno
,
line
),
file
=
sys
.
stderr
)
malformed_lines
+=
1
continue
if
match
.
group
(
'agent'
)
in
skip_user_agent
:
...
...
@@ -1346,7 +1348,8 @@ def main():
if
original_period
!=
period
:
original_period
=
period
if
show_progress
:
print
>>
sys
.
stderr
,
'Increasing period to'
,
period
,
'...'
,
print
(
'Increasing period to %s...'
%
period
,
end
=
''
,
file
=
sys
.
stderr
)
old_date_format
=
date_format
asDate
,
decimator
,
graph_period
,
date_format
,
placeholder_delta
,
\
round_date
,
graph_coefficient
=
period_parser
[
period
]
...
...
@@ -1356,8 +1359,8 @@ def main():
for
site_data
in
per_site
.
itervalues
():
site_data
.
rescale
(
rescale
,
getDuration
)
if
show_progress
:
print
>>
sys
.
stderr
,
'done (%s)'
%
timedelta
(
seconds
=
time
.
time
()
-
period_increase_start
)
print
(
'done (%s)'
%
timedelta
(
seconds
=
time
.
time
()
-
period_increase_start
)
,
file
=
sys
.
stderr
)
hit_date
=
asDate
(
match
.
group
(
'timestamp'
))
try
:
site_data
=
per_site
[
site
]
...
...
@@ -1368,12 +1371,12 @@ def main():
site_data
.
accumulate
(
match
,
url_match
,
hit_date
)
except
Exception
:
if
not
quiet
:
print
>>
sys
.
stderr
,
'Error analysing line at %s:%i: %r'
%
(
filename
,
lineno
,
line
)
print
(
'Error analysing line at %s:%i: %r'
%
(
filename
,
lineno
,
line
)
,
file
=
sys
.
stderr
)
traceback
.
print_exc
(
file
=
sys
.
stderr
)
all_lines
+=
lineno
if
show_progress
:
print
>>
sys
.
stderr
,
lineno
print
(
lineno
,
file
=
sys
.
stderr
)
end_parsing_time
=
time
.
time
()
generator
,
out_encoding
=
format_generator
[
args
.
format
]
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