Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

comparing S4V main branch vs. OpenEdX master branch #1

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3d671a9
add clear documentation and ExecWrappedStudentCodeTest
Jan 12, 2021
70dbd4c
Grader
ducnm0 Feb 27, 2021
7e6f442
Add flag _only_check_input to check student's input only and do not r…
vodinhhung Jul 24, 2022
8f3c3c8
Add feature to add multiple answers per exercise
vodinhhung Jul 24, 2022
a0b536a
Merge branch 'master' of https://github.com/steamforvietnam/xqueue-wa…
vodinhhung Jul 24, 2022
e4ef9c1
Fix bug with redundant gradelib declaration
vodinhhung Jul 26, 2022
be33ec1
update .gitignore to ignore Visual Studio Code files
TheVinhLuong102 Aug 9, 2022
365e6d1
add Prospector linting configs
TheVinhLuong102 Aug 9, 2022
cef1b27
update linting settings
TheVinhLuong102 Aug 9, 2022
c40e9d6
update linting settings
TheVinhLuong102 Aug 9, 2022
8477b4d
update linting settings
TheVinhLuong102 Aug 9, 2022
4ddb02d
update linting settings
TheVinhLuong102 Aug 9, 2022
fd3bb3a
update linting settings
TheVinhLuong102 Aug 9, 2022
d9802fb
minor fixes to xqueue_watcher.jailedgrader.main(...)
TheVinhLuong102 Aug 10, 2022
30a8890
set default codejail_python as python3 in xqueue_watcher.jailedgrader…
TheVinhLuong102 Aug 10, 2022
cd3fa17
update linting settings
TheVinhLuong102 Aug 10, 2022
59bdcb6
update linting settings
TheVinhLuong102 Aug 10, 2022
8b09f60
configure codejail for python3 in xqueue_watcher.jailedgrader.main(...)
TheVinhLuong102 Aug 10, 2022
c6d1469
update linting settings
TheVinhLuong102 Aug 13, 2022
ee4d6ef
*** comment out erroneous install_requires in setup.py, which prevent…
TheVinhLuong102 Aug 13, 2022
5e9b104
minor enhancement to xqueue_watcher.jailedgrader.JailedGrader.grade(...)
TheVinhLuong102 Aug 13, 2022
b442698
update linting settings
TheVinhLuong102 Aug 19, 2022
4955aa1
update deps, setup & VSCode settings
TheVinhLuong102 Aug 19, 2022
a45b8bc
disable outdated importlib-metadata dep
TheVinhLuong102 Sep 10, 2022
bfe325a
Merge branch 'master' of https://GitHub.com/EdX/XQueue-Watcher
TheVinhLuong102 Jul 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ reports/
\#*\#
*.egg-info
.idea/


# Visual Studio Code
.vscode/*.log
*.code-workspace
62 changes: 62 additions & 0 deletions .prospector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
mccabe:
disable:
- MC0001

pep8:
disable:
- E305
- E306
- E115
- E116
- E501
- E722
- E741

pycodestyle:
disable:
- E115
- E116
- E305
- E306
- E501
- E722
- E741

pyflakes:
disable:
- F401
- F821
- F841

pylint:
disable:
- arguments-renamed
- bare-except
- consider-using-f-string
- consider-using-with
- deprecated-module
- django-not-configured
- import-error
- import-outside-toplevel
- inconsistent-return-statements
- line-too-long
- logging-format-interpolation
- logging-not-lazy
- method-hidden
- multiple-imports
- no-else-raise
- no-else-return
- pointless-statement
- super-with-arguments
- too-many-arguments
- too-many-branches
- too-many-locals
- too-many-statements
- undefined-variable
- unidiomatic-typecheck
- unused-argument
- unused-import
- unused-variable
- unspecified-encoding
- useless-object-inheritance
- useless-suppression
91 changes: 91 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"editor.rulers": [79],

"files.exclude": {
"**/*.egg-info": true,
"**/.git": true,
"**/.mypy_cache": true,
"**/*.pyc": {"when": "$(basename).py"},
"**/__pycache__": true,
"**/.ropeproject": true
},

"python.analysis.diagnosticSeverityOverrides": {
"reportMissingImports" : "none",
"reportMissingModuleSource" : "none",
"reportUndefinedVariable" : "none"
},

"python.linting.enabled": true,

"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--disable", "arguments-renamed",
"--disable", "bare-except",
"--disable", "broad-except",
"--disable", "c-extension-no-member",
"--disable", "consider-using-f-string",
"--disable", "consider-using-with",
"--disable", "deprecated-module",
"--disable", "fixme",
"--disable", "import-error",
"--disable", "import-outside-toplevel",
"--disable", "inconsistent-return-statements",
"--disable", "invalid-name",
"--disable", "line-too-long",
"--disable", "logging-format-interpolation",
"--disable", "logging-not-lazy",
"--disable", "method-hidden",
"--disable", "missing-class-docstring",
"--disable", "missing-function-docstring",
"--disable", "missing-module-docstring",
"--disable", "multiple-imports",
"--disable", "no-else-raise",
"--disable", "no-else-return",
"--disable", "no-self-use",
"--disable", "pointless-statement",
"--disable", "super-with-arguments",
"--disable", "too-few-public-methods",
"--disable", "too-many-arguments",
"--disable", "too-many-branches",
"--disable", "too-many-instance-attributes",
"--disable", "too-many-locals",
"--disable", "too-many-return-statements",
"--disable", "too-many-statements",
"--disable", "undefined-variable",
"--disable", "unidiomatic-typecheck",
"--disable", "unnecessary-pass",
"--disable", "unspecified-encoding",
"--disable", "unused-argument",
"--disable", "unused-import",
"--disable", "unused-variable",
"--disable", "useless-object-inheritance",
"--disable", "wrong-import-order"
],

"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"--ignore=E115,E116,E123,E128,E226,E231,E261,E265,E266,E302,E303,E305,E306,E401,E501,E722,E741,F401,F821,F841,N806"
],

"python.linting.mypyEnabled": false,

"python.linting.pydocstyleEnabled": false,

"python.linting.pycodestyleEnabled": true,
"python.linting.pycodestyleArgs": [
"--ignore=E115,E116,E123,E128,E226,E261,E265,E231,E266,E302,E303,E305,E306,E401,E501,E722,E741"
],

"python.linting.prospectorEnabled": true,

"python.linting.pylamaEnabled": true,
"python.linting.pylamaArgs": [
"--ignore=C901,E115,E116,E123,E128,E226,E231,E261,E265,E266,E302,E303,E305,E306,E401,E501,E0602,E722,E741,W0611,W0612"
],

"python.linting.banditEnabled": true,
"python.linting.banditArgs": [
"--skip=B103,B108,B110,B311"
]
}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,18 @@ The course configuration JSON file in `conf.d` should have the following structu
Submissions Handler
===================

<<<<<<< HEAD
When xqueue_watcher detects any new submission, it will be passed to the submission handler for grading. It will instantiate a new handler based on the name configured above, with submission information retrieved
from XQueue. There is a base grader defined in xqueue_watcher: Grader and JailedGrader (for Python, using CodeJail). If you don't use JailedGrader, you'd have to implement your own Grader by subclassing `xqueue_watcher.grader.Grader

The payload from XQueue will be a JSON that usually looks like this, notice that "grader" is a required field in the "grader_payload" and must be configured accordingly in the Studio for the exercise.
=======
When `xqueue_watcher` detects any new submission, it will be passed to the submission handler for grading. It will instantiate a new handler based on the name configured above, with submission information retrieved
from XQueue. Base graders are defined in `xqueue_watcher`: Grader and JailedGrader (for Python, using CodeJail). If you don't use JailedGrader, you'd have to implement your own Grader by subclassing `xqueue_watcher.grader.Grader`

The payload received from XQueue will be a JSON object that usually looks like the JSON below. Note that "grader" is a required field in the "grader_payload" and must be configured accordingly in Studio.

>>>>>>> 180d12060386e88b36f0bcdc12a2e4c77db2a49f
```json
{
"student_info": {
Expand Down
9 changes: 9 additions & 0 deletions grader_support/gradelib.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ def __init__(self):
# list of functions: submission_text -> error text or None
self._input_checks = []

# Flag: Do not run, just check input
self._only_check_input = False

# list of functions: submission_text -> processed_submission_text. Run
# in the specified order. (foldl)
self._preprocessors = [fix_line_endings]
Expand All @@ -88,6 +91,12 @@ def input_errors(self, submission_str):
"""
return [_f for _f in [check(submission_str) for check in self._input_checks] if _f]

def only_check_input(self):
return self._only_check_input

def set_only_check_input(self, value):
self._only_check_input = value

def preprocess(self, submission_str):
"""
submission: string
Expand Down
7 changes: 7 additions & 0 deletions xqueue_watcher/grader.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,13 @@ def process_item(self, content, queue=None):
files = content['xqueue_files']

# Delivery from the lms
print("____ DEBUG ____")
print(body)
body = json.loads(body)
student_response = body['student_response']
payload = body['grader_payload']
print(student_response)
print(payload)
try:
grader_config = json.loads(payload)
except ValueError as err:
Expand All @@ -132,6 +136,9 @@ def process_item(self, content, queue=None):
self.log.debug(f"Processing submission, grader payload: {payload}")
relative_grader_path = grader_config['grader']
grader_path = (self.grader_root / relative_grader_path).abspath()
print("___ DEBUG ___")
print("Grader path", grader_path)
print("Relative path", relative_grader_path)
start = time.time()
results = self.grade(grader_path, grader_config, student_response)

Expand Down
Loading
Loading