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
3ec08766
Commit
3ec08766
authored
Aug 14, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #410 from MITx/feature/cale/queue_config
Feature/cale/queue config
parents
d7fc2d66
9c0e4169
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
14 deletions
+53
-14
cms/envs/common.py
+10
-0
common/lib/capa/capa/xqueue_interface.py
+5
-10
lms/djangoapps/courseware/module_render.py
+17
-4
lms/envs/aws.py
+2
-0
lms/envs/dev.py
+9
-0
lms/envs/test.py
+10
-0
No files found.
cms/envs/common.py
View file @
3ec08766
...
...
@@ -90,6 +90,16 @@ TEMPLATE_CONTEXT_PROCESSORS = (
################################# Jasmine ###################################
JASMINE_TEST_DIRECTORY
=
PROJECT_ROOT
+
'/static/coffee'
#################### CAPA External Code Evaluation #############################
XQUEUE_INTERFACE
=
{
'url'
:
'http://localhost:8888'
,
'django_auth'
:
{
'username'
:
'local'
,
'password'
:
'local'
},
'basic_auth'
:
None
,
}
################################# Middleware ###################################
# List of finder classes that know how to find static files in
# various locations.
...
...
common/lib/capa/capa/xqueue_interface.py
View file @
3ec08766
...
...
@@ -7,13 +7,10 @@ import logging
import
requests
import
time
# TODO: Collection of parameters to be hooked into rest of edX system
XQUEUE_LMS_AUTH
=
{
'username'
:
'LMS'
,
'password'
:
'PaloAltoCA'
}
XQUEUE_URL
=
'http://xqueue.edx.org'
log
=
logging
.
getLogger
(
'mitx.'
+
__name__
)
def
make_hashkey
(
seed
=
None
):
'''
Generate a string key by hashing
...
...
@@ -58,15 +55,15 @@ def parse_xreply(xreply):
return
(
return_code
,
content
)
class
X
queueInterface
:
class
X
QueueInterface
(
object
)
:
'''
Interface to the external grading system
'''
def
__init__
(
self
,
url
=
XQUEUE_URL
,
auth
=
XQUEUE_LMS_AUTH
):
def
__init__
(
self
,
url
,
django_auth
,
requests_auth
=
None
):
self
.
url
=
url
self
.
auth
=
auth
self
.
session
=
requests
.
session
()
self
.
auth
=
django_
auth
self
.
session
=
requests
.
session
(
auth
=
requests_auth
)
def
send_to_queue
(
self
,
header
,
body
,
file_to_upload
=
None
):
'''
...
...
@@ -117,5 +114,3 @@ class XqueueInterface:
return
(
1
,
'unexpected HTTP status code [
%
d]'
%
r
.
status_code
)
return
parse_xreply
(
r
.
text
)
qinterface
=
XqueueInterface
()
lms/djangoapps/courseware/module_render.py
View file @
3ec08766
...
...
@@ -7,9 +7,9 @@ from django.http import Http404
from
django.http
import
HttpResponse
from
django.views.decorators.csrf
import
csrf_exempt
from
capa.xqueue_interface
import
XQueueInterface
from
django.contrib.auth.models
import
User
from
xmodule.modulestore.django
import
modulestore
from
capa.xqueue_interface
import
qinterface
from
mitxmako.shortcuts
import
render_to_string
from
models
import
StudentModule
,
StudentModuleCache
from
static_replace
import
replace_urls
...
...
@@ -19,10 +19,23 @@ from xmodule_modifiers import replace_static_urls, add_histogram, wrap_xmodule
from
courseware.courses
import
(
has_staff_access_to_course
,
has_staff_access_to_location
)
from
requests.auth
import
HTTPBasicAuth
log
=
logging
.
getLogger
(
"mitx.courseware"
)
if
settings
.
XQUEUE_INTERFACE
[
'basic_auth'
]
is
not
None
:
requests_auth
=
HTTPBasicAuth
(
*
settings
.
XQUEUE_INTERFACE
[
'basic_auth'
])
else
:
requests_auth
=
None
xqueue_interface
=
XQueueInterface
(
settings
.
XQUEUE_INTERFACE
[
'url'
],
settings
.
XQUEUE_INTERFACE
[
'django_auth'
],
requests_auth
,
)
def
make_track_function
(
request
):
'''
Make a tracking function that logs what happened.
...
...
@@ -172,9 +185,9 @@ def get_module(user, request, location, student_module_cache, position=None):
# TODO: Queuename should be derived from 'course_settings.json' of each course
xqueue_default_queuename
=
descriptor
.
location
.
org
+
'-'
+
descriptor
.
location
.
course
xqueue
=
{
'interface'
:
q
interface
,
'callback_url'
:
xqueue_callback_url
,
'default_queuename'
:
xqueue_default_queuename
.
replace
(
' '
,
'_'
)
}
xqueue
=
{
'interface'
:
xqueue_
interface
,
'callback_url'
:
xqueue_callback_url
,
'default_queuename'
:
xqueue_default_queuename
.
replace
(
' '
,
'_'
)
}
def
_get_module
(
location
):
return
get_module
(
user
,
request
,
location
,
...
...
lms/envs/aws.py
View file @
3ec08766
...
...
@@ -54,3 +54,5 @@ AWS_ACCESS_KEY_ID = AUTH_TOKENS["AWS_ACCESS_KEY_ID"]
AWS_SECRET_ACCESS_KEY
=
AUTH_TOKENS
[
"AWS_SECRET_ACCESS_KEY"
]
DATABASES
=
AUTH_TOKENS
[
'DATABASES'
]
XQUEUE_INTERFACE
=
AUTH_TOKENS
[
'XQUEUE_INTERFACE'
]
lms/envs/dev.py
View file @
3ec08766
...
...
@@ -53,6 +53,15 @@ CACHES = {
}
}
XQUEUE_INTERFACE
=
{
"url"
:
"http://xqueue.sandbox.edx.org"
,
"django_auth"
:
{
"username"
:
"lms"
,
"password"
:
"***REMOVED***"
},
"basic_auth"
:
(
'anant'
,
'agarwal'
),
}
# Make the keyedcache startup warnings go away
CACHE_TIMEOUT
=
0
...
...
lms/envs/test.py
View file @
3ec08766
...
...
@@ -50,6 +50,16 @@ COMMON_TEST_DATA_ROOT = COMMON_ROOT / "test" / "data"
GITHUB_REPO_ROOT
=
ENV_ROOT
/
"data"
XQUEUE_INTERFACE
=
{
"url"
:
"http://xqueue.sandbox.edx.org"
,
"django_auth"
:
{
"username"
:
"lms"
,
"password"
:
"***REMOVED***"
},
"basic_auth"
:
(
'anant'
,
'agarwal'
),
}
# TODO (cpennington): We need to figure out how envs/test.py can inject things
# into common.py so that we don't have to repeat this sort of thing
STATICFILES_DIRS
=
[
...
...
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