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
f023dc6e
Commit
f023dc6e
authored
Aug 03, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xqueue_interface generates hashkeys
parent
fbed664d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
common/lib/capa/capa/responsetypes.py
+2
-10
lms/djangoapps/courseware/xqueue_interface.py
+11
-0
No files found.
common/lib/capa/capa/responsetypes.py
View file @
f023dc6e
...
...
@@ -8,7 +8,6 @@ Used by capa_problem.py
'''
# standard library imports
import
hashlib
import
inspect
import
json
import
logging
...
...
@@ -17,7 +16,6 @@ import numpy
import
random
import
re
import
requests
import
time
import
traceback
import
abc
...
...
@@ -856,18 +854,12 @@ class CodeResponse(LoncapaResponse):
raise
Exception
(
err
)
self
.
context
.
update
({
'submission'
:
submission
})
extra_payload
=
{
'edX_student_response'
:
submission
}
# Prepare xqueue request
#------------------------------------------------------------
# Queuekey generation
h
=
hashlib
.
md5
()
h
.
update
(
str
(
self
.
system
.
seed
))
h
.
update
(
str
(
time
.
time
()))
queuekey
=
h
.
hexdigest
()
# Generate header
queuekey
=
xqueue_interface
.
make_hashkey
(
self
.
system
.
seed
)
xheader
=
xqueue_interface
.
make_xheader
(
lms_callback_url
=
self
.
system
.
xqueue_callback_url
,
lms_key
=
queuekey
,
queue_name
=
self
.
queue_name
)
...
...
@@ -886,7 +878,7 @@ class CodeResponse(LoncapaResponse):
cmap
=
CorrectMap
()
if
error
:
cmap
.
set
(
self
.
answer_id
,
msg
=
'Unable to deliver your submission to grader! Please try again later'
)
cmap
.
set
(
self
.
answer_id
,
queuekey
=
None
,
msg
=
'Unable to deliver your submission to grader! Please try again later'
)
else
:
# Non-null CorrectMap['queuekey'] indicates that the problem has been queued
cmap
.
set
(
self
.
answer_id
,
queuekey
=
queuekey
,
msg
=
'Submitted to grader'
)
...
...
lms/djangoapps/courseware/xqueue_interface.py
View file @
f023dc6e
#
# LMS Interface to external queueing system (xqueue)
#
import
hashlib
import
json
import
requests
import
time
from
boto.s3.connection
import
S3Connection
from
boto.s3.key
import
Key
...
...
@@ -39,6 +41,15 @@ def upload_files_to_s3(submission_file):
print
s3_identifier
return
s3_identifier
def
make_hashkey
(
seed
=
None
):
'''
Generate a string key by hashing
'''
h
=
hashlib
.
md5
()
if
seed
is
not
None
:
h
.
update
(
str
(
seed
))
h
.
update
(
str
(
time
.
time
()))
return
h
.
hexdigest
()
def
make_xheader
(
lms_callback_url
,
lms_key
,
queue_name
):
'''
...
...
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