otter-service-stdalone 0.0.51__tar.gz → 0.0.55__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: otter_service_stdalone
3
- Version: 0.0.51
3
+ Version: 0.0.55
4
4
  Summary: Grading Service for Instructors using Otter Grader
5
5
  Home-page: https://github.com/sean-morris/otter-service-stdalone
6
6
  Author: Sean Morris
@@ -0,0 +1 @@
1
+ __version__ = "0.0.55"
@@ -11,13 +11,32 @@ import async_timeout
11
11
  __UPLOADS__ = "/tmp/uploads"
12
12
 
13
13
  class GradeNotebooks():
14
+ def get_otter_version(self, auto_path):
15
+ zip_folder = auto_path.split(".")[0]
16
+ with ZipFile(auto_path, 'r') as zObject:
17
+ zObject.extractall(path=zip_folder)
18
+ with open(f"{zip_folder}/requirements.txt") as file:
19
+ for line in file:
20
+ if "otter-grader" in line:
21
+ version = line.split("==")[1].split(".")[0]
22
+ log.write_logs("Preparation: Grading", f"Otter Version: {version}", "info", f'{os.environ.get("ENVIRONMENT")}-logs')
23
+ if int(version) < 3:
24
+ log.write_logs("Preparation: Grading", f"Otter Version less than 3: {version} - changed to version 3", "info", f'{os.environ.get("ENVIRONMENT")}-logs')
25
+ version = "3"
26
+
27
+ return version
28
+ return Exception("Otter-Grader version not found in requirements")
29
+
14
30
  async def grade(self, p, notebooks_zip):
15
31
  try:
16
32
  zip_folder = notebooks_zip.split(".")[0]
17
33
  with ZipFile(notebooks_zip, 'r') as zObject:
18
34
  zObject.extractall(path=zip_folder)
19
35
 
36
+ otter_version = self.get_otter_version(p)
37
+ path = f"/etc/venv-otter{otter_version}/bin/python3"
20
38
  command = [
39
+ path, "-m"
21
40
  'otter', 'grade',
22
41
  '-a', p,
23
42
  '-p', zip_folder,
@@ -100,7 +119,6 @@ class Upload(tornado.web.RequestHandler):
100
119
  autograder = self.request.files['autograder'][0] if "autograder" in files else None
101
120
  notebooks = self.request.files['notebooks'][0] if "notebooks" in files else None
102
121
  if autograder is not None and notebooks is not None:
103
- print("fileinfo is: ", autograder)
104
122
  notebooks_fname = notebooks['filename']
105
123
  notebooks_extn = os.path.splitext(notebooks_fname)[1]
106
124
  results_path = str(uuid.uuid4())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: otter-service-stdalone
3
- Version: 0.0.51
3
+ Version: 0.0.55
4
4
  Summary: Grading Service for Instructors using Otter Grader
5
5
  Home-page: https://github.com/sean-morris/otter-service-stdalone
6
6
  Author: Sean Morris
@@ -1 +0,0 @@
1
- __version__ = "0.0.51"