Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
3b5e0eb5
Commit
3b5e0eb5
authored
6 years ago
by
asadazam93
Browse files
Options
Downloads
Patches
Plain Diff
Add time logs
parent
ebede188
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cms/djangoapps/contentstore/api/views/course_quality.py
+45
-12
45 additions, 12 deletions
cms/djangoapps/contentstore/api/views/course_quality.py
with
45 additions
and
12 deletions
cms/djangoapps/contentstore/api/views/course_quality.py
+
45
−
12
View file @
3b5e0eb5
# pylint: disable=missing-docstring
import
logging
import
time
import
numpy
as
np
from
scipy
import
stats
from
rest_framework.generics
import
GenericAPIView
...
...
@@ -81,31 +82,63 @@ class CourseQualityView(DeveloperErrorViewMixin, GenericAPIView):
"""
Returns validation information for the given course.
"""
def
_execute_method_and_log_time
(
func
,
*
args
):
"""
Call func passed in method with logging the time it took to complete.
Logging is temporary, we will remove this once we get required information.
"""
start_time
=
time
.
time
()
output
=
func
(
*
args
)
log
.
info
(
'
[%s] completed in [%f]
'
,
func
.
__name__
,
(
time
.
time
()
-
start_time
))
return
output
all_requested
=
get_bool_param
(
request
,
'
all
'
,
False
)
store
=
modulestore
()
with
store
.
bulk_operations
(
course_key
):
course
=
store
.
get_course
(
course_key
,
depth
=
self
.
_required_course_depth
(
request
,
all_requested
))
# Added for EDUCATOR-3660
course_key_harward
=
True
if
course_key
==
'
course-v1:HarvardX+SW12.1x+2016
'
else
False
response
=
dict
(
is_self_paced
=
course
.
self_paced
,
)
if
get_bool_param
(
request
,
'
sections
'
,
all_requested
):
response
.
update
(
sections
=
self
.
_sections_quality
(
course
)
)
if
course_key_harward
:
response
.
update
(
sections
=
_execute_method_and_log_time
(
self
.
_sections_quality
,
course
)
)
else
:
response
.
update
(
sections
=
self
.
_sections_quality
(
course
)
)
if
get_bool_param
(
request
,
'
subsections
'
,
all_requested
):
response
.
update
(
subsections
=
self
.
_subsections_quality
(
course
,
request
)
)
if
course_key_harward
:
response
.
update
(
subsections
=
_execute_method_and_log_time
(
self
.
_subsections_quality
,
course
,
request
)
)
else
:
response
.
update
(
subsections
=
self
.
_subsections_quality
(
course
,
request
)
)
if
get_bool_param
(
request
,
'
units
'
,
all_requested
):
response
.
update
(
units
=
self
.
_units_quality
(
course
,
request
)
)
if
course_key_harward
:
response
.
update
(
units
=
_execute_method_and_log_time
(
self
.
_units_quality
,
course
,
request
)
)
else
:
response
.
update
(
units
=
self
.
_units_quality
(
course
,
request
)
)
if
get_bool_param
(
request
,
'
videos
'
,
all_requested
):
response
.
update
(
videos
=
self
.
_videos_quality
(
course
)
)
if
course_key_harward
:
response
.
update
(
videos
=
_execute_method_and_log_time
(
self
.
_videos_quality
,
course
)
)
else
:
response
.
update
(
videos
=
self
.
_videos_quality
(
course
)
)
return
Response
(
response
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment