|
17 | 17 | from sqlalchemy.orm import Session |
18 | 18 | from traitlets.config import Config |
19 | 19 | from traitlets.config.configurable import LoggingConfigurable |
20 | | -from traitlets.traitlets import Callable, Int, TraitError, Unicode, validate |
| 20 | +from traitlets.traitlets import Callable, Int, TraitError, Type, Unicode, validate |
21 | 21 |
|
22 | 22 | from grader_service.autograding.git_manager import GitSubmissionManager |
23 | 23 | from grader_service.autograding.utils import collect_logs, executable_validator, rmtree |
24 | 24 | from grader_service.convert.converters.autograde import Autograde |
25 | 25 | from grader_service.convert.gradebook.models import GradeBookModel |
26 | 26 | from grader_service.orm.assignment import Assignment |
27 | | -from grader_service.orm.lecture import Lecture |
28 | 27 | from grader_service.orm.submission import AutoStatus, ManualStatus, Submission |
29 | 28 | from grader_service.orm.submission_logs import SubmissionLogs |
30 | 29 | from grader_service.orm.submission_properties import SubmissionProperties |
@@ -327,32 +326,6 @@ def _cleanup(self) -> None: |
327 | 326 | if self.close_session: |
328 | 327 | self.session.close() |
329 | 328 |
|
330 | | - def _run_subprocess(self, command: str, cwd: str) -> subprocess.CompletedProcess: |
331 | | - """ |
332 | | - Execute the command as a subprocess. |
333 | | - :param command: The command to execute as a string. |
334 | | - :param cwd: The working directory the subprocess should run in. |
335 | | - :return: CompletedProcess object which contains information about the execution. |
336 | | - """ |
337 | | - try: |
338 | | - result = subprocess.run( |
339 | | - shlex.split(command), |
340 | | - stdout=subprocess.PIPE, |
341 | | - stderr=subprocess.PIPE, |
342 | | - cwd=cwd, |
343 | | - text=True, # Decodes output to string |
344 | | - check=True, # Raises a CalledProcessError on non-zero exit code |
345 | | - ) |
346 | | - return result |
347 | | - except subprocess.CalledProcessError as e: |
348 | | - self.grading_logs = e.stderr |
349 | | - self.log.error(self.grading_logs) |
350 | | - raise |
351 | | - except Exception as e: |
352 | | - self.grading_logs = (self.grading_logs or "") + str(e) |
353 | | - self.log.error(e) |
354 | | - raise |
355 | | - |
356 | 329 | def _determine_cell_timeout(self): |
357 | 330 | cell_timeout = self.default_cell_timeout |
358 | 331 | if self.assignment.settings.cell_timeout is not None: |
|
0 commit comments