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
642687f8
Commit
642687f8
authored
Feb 20, 2014
by
Gabe Mulley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix minor bugs blocking report generation
Change-Id: I5c1d8f476587362b5d20d028aeb6283c4c3b18b0
parent
8ad6b877
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
3 deletions
+27
-3
edx/analytics/tasks/mapreduce.py
+4
-2
edx/analytics/tasks/reports/tests/test_total_enrollments.py
+17
-0
edx/analytics/tasks/reports/total_enrollments.py
+6
-1
No files found.
edx/analytics/tasks/mapreduce.py
View file @
642687f8
...
...
@@ -5,8 +5,6 @@ from __future__ import absolute_import
import
luigi.hadoop
from
stevedore
import
ExtensionManager
class
MapReduceJobTask
(
luigi
.
hadoop
.
JobTask
):
"""
...
...
@@ -19,6 +17,10 @@ class MapReduceJobTask(luigi.hadoop.JobTask):
)
def
job_runner
(
self
):
# Lazily import this since this module will be loaded on hadoop worker nodes however stevedore will not be
# available in that environment.
from
stevedore
import
ExtensionManager
extension_manager
=
ExtensionManager
(
'mapreduce.engine'
)
try
:
engine_class
=
extension_manager
[
self
.
mapreduce_engine
]
.
plugin
...
...
edx/analytics/tasks/reports/tests/test_total_enrollments.py
View file @
642687f8
...
...
@@ -237,6 +237,23 @@ class TestWeeklyAllUsersAndEnrollments(unittest.TestCase):
self
.
assertEqual
(
res
.
loc
[
self
.
enrollment_label
][
'2013-01-08'
],
4
)
self
.
assertEqual
(
res
.
loc
[
self
.
enrollment_label
][
'2013-01-15'
],
6
)
def
test_blacklist_course_not_in_enrollments
(
self
):
enrollments
=
"""
course_1 2013-01-02 1
course_2 2013-01-02 2
course_3 2013-01-02 4
course_2 2013-01-09 1
course_3 2013-01-15 2
"""
blacklist
=
"""
course_4
course_1
course_2
"""
res
=
self
.
run_task
(
''
,
enrollments
,
'2013-01-15'
,
2
,
blacklist
=
blacklist
)
self
.
assertEqual
(
res
.
loc
[
self
.
enrollment_label
][
'2013-01-08'
],
4
)
self
.
assertEqual
(
res
.
loc
[
self
.
enrollment_label
][
'2013-01-15'
],
6
)
def
test_unicode
(
self
):
course_id
=
u'course_
\u2603
'
...
...
edx/analytics/tasks/reports/total_enrollments.py
View file @
642687f8
...
...
@@ -98,8 +98,13 @@ class AllCourseEnrollmentCountMixin(CourseEnrollmentCountMixin):
Returns:
None, the `course_data` is modified in place.
"""
for
course_id
in
course_blacklist
:
try
:
# Drop from axis 1 because we are dropping columns, not rows.
course_data
.
drop
(
course_blacklist
,
axis
=
1
,
inplace
=
True
)
course_data
.
drop
(
course_id
,
axis
=
1
,
inplace
=
True
)
except
ValueError
:
# There is no column for this course.
pass
def
save_output
(
self
,
results
,
output_file
):
"""
...
...
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