Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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-platform
Commits
d2db4134
Commit
d2db4134
authored
Aug 02, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CodeResponse does basic error handling from xqueue submission
parent
6de2fa5e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
common/lib/capa/capa/responsetypes.py
+9
-6
lms/djangoapps/courseware/xqueue_interface.py
+5
-1
No files found.
common/lib/capa/capa/responsetypes.py
View file @
d2db4134
...
...
@@ -881,12 +881,15 @@ class CodeResponse(LoncapaResponse):
'edX_student_response'
:
submission
}
# Submit request
xqueue_interface
.
send_to_queue
(
header
=
xheader
,
body
=
json
.
dumps
(
contents
))
success
=
xqueue_interface
.
send_to_queue
(
header
=
xheader
,
body
=
json
.
dumps
(
contents
))
# Non-null CorrectMap['queuekey'] indicates that the problem has been queued
cmap
=
CorrectMap
()
cmap
.
set
(
self
.
answer_id
,
queuekey
=
queuekey
,
msg
=
'Submitted to queue'
)
cmap
=
CorrectMap
()
if
success
:
# Non-null CorrectMap['queuekey'] indicates that the problem has been queued
cmap
.
set
(
self
.
answer_id
,
queuekey
=
queuekey
,
msg
=
'Submitted to grader'
)
else
:
cmap
.
set
(
self
.
answer_id
,
msg
=
'Unable to deliver submission to grader! Please try again later'
)
return
cmap
...
...
@@ -908,7 +911,7 @@ class CodeResponse(LoncapaResponse):
self
.
context
[
'correct'
][
0
]
=
admap
[
ad
]
# Replace 'oldcmap' with new grading results if queuekey matches.
# If queuekey does not match, we keep waiting for the score_msg whose key actually matchs
# If queuekey does not match, we keep waiting for the score_msg whose key actually match
e
s
if
oldcmap
.
is_right_queuekey
(
self
.
answer_id
,
queuekey
):
msg
=
rxml
.
find
(
'message'
)
.
text
.
replace
(
' '
,
' '
)
oldcmap
.
set
(
self
.
answer_id
,
correctness
=
self
.
context
[
'correct'
][
0
],
msg
=
msg
,
queuekey
=
None
)
# Queuekey is consumed
...
...
lms/djangoapps/courseware/xqueue_interface.py
View file @
d2db4134
...
...
@@ -35,6 +35,7 @@ def send_to_queue(header, body, xqueue_url=None):
body: Serialized data for the receipient behind the queueing service. The operation of
xqueue is agnostic to the contents of 'body'
Returns a 'success' flag indicating successful submission
'''
if
xqueue_url
is
None
:
xqueue_url
=
XQUEUE_SUBMIT_URL
...
...
@@ -48,4 +49,7 @@ def send_to_queue(header, body, xqueue_url=None):
msg
=
'Error in xqueue_interface.send_to_queue
%
s: Cannot connect to server url=
%
s'
%
(
err
,
xqueue_url
)
raise
Exception
(
msg
)
#print r.text
# Xqueue responses are JSON-serialized dicts
xreply
=
json
.
loads
(
r
.
text
)
return
xreply
[
'return_code'
]
==
0
# return_code == 0 from xqueue indicates successful submission
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