Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-data-api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-analytics-data-api
Commits
84925186
Commit
84925186
authored
May 08, 2014
by
Brian Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change tab to comma in UsersPerCountryReport.
Change-Id: I49ba1f0e90aeef39b81f4a955523fe9fc5510161
parent
c5696cc0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
edx/analytics/tasks/tests/test_user_location.py
+4
-0
edx/analytics/tasks/user_location.py
+4
-5
No files found.
edx/analytics/tasks/tests/test_user_location.py
View file @
84925186
...
...
@@ -277,6 +277,10 @@ class UsersPerCountryReportTestCase(unittest.TestCase):
self
.
assertEquals
(
output_lines
[
2
],
UsersPerCountryReport
.
create_csv_entry
(
float
(
34
)
/
77
,
34
,
"Country_1"
,
"Code_1"
)
)
# Also confirm the formatting:
for
line
in
output_lines
[
1
:
2
]:
self
.
assertTrue
(
line
.
startswith
(
'0.'
))
class
UsersPerCountryReportWorkflowTestCase
(
BaseUserLocationEventTestCase
):
...
...
edx/analytics/tasks/user_location.py
View file @
84925186
...
...
@@ -250,12 +250,12 @@ class UsersPerCountryReport(luigi.Task):
def
create_header
(
cls
,
date
):
"""Generate a header for CSV output."""
fields
=
[
'percent'
,
'count'
,
'country'
,
'code'
,
'date={date}'
.
format
(
date
=
date
)]
return
'
\t
'
.
join
(
fields
)
return
'
,
'
.
join
(
fields
)
@classmethod
def
create_csv_entry
(
cls
,
percent
,
count
,
country
,
code
):
"""Generate a single entry in CSV format."""
return
"{percent:.2
%
}
\t
{count}
\t
{country}
\t
{code}"
.
format
(
return
'{percent:.4f},{count},"{country}",{code}'
.
format
(
percent
=
percent
,
count
=
count
,
country
=
country
,
code
=
code
)
...
...
@@ -297,15 +297,14 @@ class UsersPerCountryReportWorkflow(UsersPerCountryReport):
src: a URL to the root location of input tracking log files.
include: a list of patterns to be used to match input files, relative to `src` URL.
The default value is ['*'].
dest: a URL to the root location to write output file(s).
manifest: a URL to a file location that can store the complete set of input files.
end_date: events before or on this date are kept, and after this date are filtered out.
geolocation_data: a URL to the location of country-level geolocation data.
Additional optional parameters are passed through to :py:class:`
UsersPerCountryReport
`:
Additional optional parameters are passed through to :py:class:`
MapReduceJobTask
`:
mapreduce_engine: 'hadoop' (the default) or 'local'.
input_format: override the input_format for Hadoop job to use. For example, when
base_
input_format: override the input_format for Hadoop job to use. For example, when
running with manifest file above, specify "oddjob.ManifestTextInputFormat" for input_format.
lib_jar: points to jar defining input_format, if any.
n_reduce_tasks: number of reducer tasks to use in upstream tasks.
...
...
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