Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Run lichen plagiarism as submitty daemon job and some interface chang…
…es (#2423) * add rerun plagiarism button * plagiarism interface changes 1 * plagiarism interface changes 2 * plagiarism interface changes 3 * plagiarism interface changes 4 * add script which will run lichen plagiarism * lichen run by submitty daemon * modified plagiarism provided code path * empty provided code for gradeable if edit configuration to no provided code * user exist check fix * lichen run by daemon 2 * add delete plagiarism result job * add Trash Can functionality * add delete plagiarism form and resolved bugs * update lichen version
- Loading branch information
Showing
7 changed files
with
680 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# This script is run by a cron job as the DAEMON_USER | ||
# | ||
# Runs lichen plagiarism detector for saved configuration | ||
# | ||
|
||
import os | ||
import sys | ||
import pwd | ||
import time | ||
import subprocess | ||
from submitty_utils import glob | ||
import json | ||
|
||
|
||
# ------------------------------------------------------------------------ | ||
def run_lichen_plagiarism(data): | ||
semester = data["semester"] | ||
course = data["course"] | ||
gradeable = data["gradeable"] | ||
language = data["language"] | ||
window = data["sequence_length"] | ||
threshold = data["threshold"] | ||
regrex = None | ||
instructor_provided_code_path = None | ||
prior_term_gradeables = None | ||
ignore_submissions = None | ||
|
||
# construct the command line agruments | ||
if data["file_option"] == "matching_regrex": | ||
regrex = data["regrex"] | ||
|
||
if data["instructor_provided_code"]: | ||
instructor_provided_code_path = data["instructor_provided_code_path"] | ||
|
||
if len(data["prev_term_gradeables"]) != 0: | ||
prior_term_gradeables = [] | ||
for prior_term_gradeable in data["prev_term_gradeables"]: | ||
prior_term_gradeables.append(prior_term_gradeable) | ||
|
||
if len(data["ignore_submissions"]) != 0: | ||
ignore_submissions = [] | ||
for submission in data["ignore_submissions"]: | ||
ignore_submissions.append(submission) | ||
|
||
subprocess.call(['/usr/local/submitty/Lichen/bin/concatenate_all.py', semester, course, gradeable ]) | ||
subprocess.call(['/usr/local/submitty/Lichen/bin/tokenize_all.py', semester, course, gradeable, '--{}'.format(language) ]) | ||
subprocess.call(['/usr/local/submitty/Lichen/bin/hash_all.py', semester, course, gradeable, '--window', window, '--{}'.format(language) ]) | ||
subprocess.call(['/usr/local/submitty/Lichen/bin/compare_hashes.out', semester, course, gradeable, '--window', window ]) | ||
|
||
|
||
# ------------------------------------------------------------------------ | ||
# MAIN LOOP | ||
|
||
# ------------------------------------------------------------------------ | ||
# this script is intended to be run only from the cron job of DAEMON_USER | ||
def main(): | ||
username = pwd.getpwuid(os.getuid()).pw_name | ||
if username != "submitty_daemon": | ||
raise SystemError("ERROR! This script must be run by submitty_daemon") | ||
|
||
if len(sys.argv) != 4: | ||
raise SystemError("ERROR! This script must be given 3 argument which should be path of lichen config") | ||
|
||
semester = sys.argv[1]; | ||
course = sys.argv[2]; | ||
gradeable = sys.argv[3]; | ||
|
||
config_path = "/var/local/submitty/courses/"+ semester + "/" +course+ "/lichen/config/lichen_"+ semester+"_"+ course+ "_" +gradeable+".json" | ||
with open(config_path) as saved_config: | ||
data = json.load(saved_config) | ||
|
||
run_lichen_plagiarism(data) | ||
print("finished running lichen plagiarism for " + config_path) | ||
|
||
|
||
# ------------------------------------------------------------------------ | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.