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
a4071324
Commit
a4071324
authored
6 years ago
by
asadazam93
Browse files
Options
Downloads
Patches
Plain Diff
Added logs
parent
837219f7
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/api/v1/serializers/course_runs.py
+27
-2
27 additions, 2 deletions
cms/djangoapps/api/v1/serializers/course_runs.py
with
27 additions
and
2 deletions
cms/djangoapps/api/v1/serializers/course_runs.py
+
27
−
2
View file @
a4071324
"""
Course run serializers.
"""
import
logging
import
time
import
six
from
django.contrib.auth
import
get_user_model
from
django.db
import
transaction
...
...
@@ -16,6 +19,7 @@ IMAGE_TYPES = {
'
image/png
'
:
'
png
'
,
}
User
=
get_user_model
()
log
=
logging
.
getLogger
(
__name__
)
class
CourseAccessRoleSerializer
(
serializers
.
ModelSerializer
):
...
...
@@ -173,6 +177,19 @@ class CourseRunRerunSerializer(CourseRunSerializerCommonFieldsMixin, CourseRunTe
return
value
def
update
(
self
,
instance
,
validated_data
):
def
_execute_method_and_log_time
(
func
,
*
args
):
"""
Call func passed in method with logging the time it took to complete.
Temporarily added for EDUCATOR-4013, we will remove this once we get the required information.
"""
course_run_key
=
args
[
1
]
if
'
MITx+7.00x
'
not
in
unicode
(
course_run_key
):
return
func
(
*
args
)
start_time
=
time
.
time
()
output
=
func
(
*
args
)
log
.
info
(
u
'
[%s] [%s] completed in [%f]
'
,
func
.
__name__
,
course_run_key
,
(
time
.
time
()
-
start_time
))
return
output
course_run_key
=
instance
.
id
_id
=
validated_data
.
pop
(
'
id
'
)
team
=
validated_data
.
pop
(
'
team
'
,
[])
...
...
@@ -181,8 +198,16 @@ class CourseRunRerunSerializer(CourseRunSerializerCommonFieldsMixin, CourseRunTe
'
display_name
'
:
instance
.
display_name
}
fields
.
update
(
validated_data
)
new_course_run_key
=
rerun_course
(
user
,
course_run_key
,
course_run_key
.
org
,
course_run_key
.
course
,
_id
[
'
run
'
],
fields
,
background
=
False
)
new_course_run_key
=
_execute_method_and_log_time
(
rerun_course
,
user
,
course_run_key
,
course_run_key
.
org
,
course_run_key
.
course
,
_id
[
'
run
'
],
fields
,
False
)
course_run
=
get_course_and_check_access
(
new_course_run_key
,
user
)
self
.
update_team
(
course_run
,
team
)
...
...
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