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

refactoring/git_service #78

Closed
31 tasks
adammccartney opened this issue Apr 26, 2023 · 0 comments
Closed
31 tasks

refactoring/git_service #78

adammccartney opened this issue Apr 26, 2023 · 0 comments
Labels
backlog Will be adressed in the future

Comments

@adammccartney
Copy link
Member

adammccartney commented Apr 26, 2023

Is your feature request related to a problem? Please describe.
It originally stems from the want to add support group assignments, in the process of adding this feature we realized that there was room for refactoring in the way that our service handles git operations. Basically there are a bunch of different handlers all managing various levels of filesystem IO related to git repositories in an ad-hoc way. We only like ad-hoc dance moves, so we are trying here to consolidate all such gyrations into a specific git-service.

Describe the solution you'd like

Basically we'd like to create a new module called services/git.py. This will house:

  • all our helper classes and functions as well as
  • an enum of possible commands
  • anything related to filesystem handler
  • any checks needed for (user auth, repo validity and whether the repo has been released or not)

TODO Seperate business logic from handlers

  • grader business logic
  • git (repo) business logic

TODO new suite of unit tests

  • Write a set of specific unit tests that proves that our helper classes properly represent all the repositories we want to represent
  • Test that we can cleanly construct directory structures using the helper classes

TODO Move functions from handlers/base_handler.py to grader_service/services/git.py

TODO Move gitbase

  • grader_service/grader_service/handlers/base_handler.py|172 col 9| def gitbase(self):
  • grader_service/grader_service/handlers/base_handler.py|186 col 31| os.path.join(self.gitbase, lecture.code, str(assignment.id))
  • grader_service/grader_service/handlers/git/server.py|235 col 27| root=self.gitbase, lecture_code=pathlets[0],
  • grader_service/grader_service/handlers/git/server.py|280 col 58| lecture_path = os.path.abspath(os.path.join(self.gitbase, pathlets[0]))
  • grader_service/grader_service/handlers/git/server.py|295 col 31| os.path.join(self.gitbase, pathlets[0], pathlets[1]))
  • grader_service/grader_service/handlers/submissions.py|526 col 18| self.gitbase,
  • grader_service/grader_service/handlers/submissions.py|535 col 18| self.gitbase,

TODO Move construct_git_dir

  • grader_service/grader_service/handlers/assignment.py|286 col 34| repo_path_release = self.construct_git_dir('release',
  • grader_service/grader_service/handlers/assignment.py|289 col 31| repo_path_user = self.construct_git_dir(str(assignment.type),
  • grader_service/grader_service/handlers/base_handler.py|176 col 9| def construct_git_dir(self, repo_type: str, lecture: Lecture,
  • grader_service/grader_service/handlers/git/server.py|178 col 21| path = self.construct_git_dir(self.git_repo.repo_type, self.lecture,
  • grader_service/grader_service/handlers/git/server.py|194 col 42| repo_path_release = self.construct_git_dir(
  • grader_service/grader_service/handlers/submissions.py|259 col 30| git_repo_path = self.construct_git_dir(
  • grader_service/grader_service/tests/handlers/test_git.py|75 col 42| constructed_git_dir = GitBaseHandler.construct_git_dir(handler_mock, repo_type="source",
  • grader_service/grader_service/tests/handlers/test_git.py|105 col 42| constructed_git_dir = GitBaseHandler.construct_git_dir(handler_mock, repo_type="release",
  • grader_service/grader_service/tests/handlers/test_git.py|277 col 42| constructed_git_dir = GitBaseHandler.construct_git_dir(handler_mock, repo_type="autograde",
  • grader_service/grader_service/tests/handlers/test_git.py|336 col 42| constructed_git_dir = GitBaseHandler.construct_git_dir(handler_mock, repo_type="feedback",
  • grader_service/grader_service/tests/handlers/test_git.py|387 col 42| constructed_git_dir = GitBaseHandler.construct_git_dir(handler_mock, repo_type="feedback",

TODO Move is_base_git_dir

  • grader_service/grader_service/handlers/base_handler.py|228 col 9| def is_base_git_dir(path: str) -> bool:
  • grader_service/grader_service/handlers/git/server.py|184 col 50| if not ((os.path.exists(path)) and (self.is_base_git_dir(path))):

TODO Move duplicate_release_repo

  • grader_service/grader_service/handlers/assignment.py|293 col 14| self.duplicate_release_repo(repo_path_release=repo_path_release,
  • grader_service/grader_service/handlers/base_handler.py|238 col 9| def duplicate_release_repo(self, repo_path_release: str,
  • cgrader_service/grader_service/handlers/git/server.py|200 col 22| self.duplicate_release_repo(

TODO Move helper classes / functions from grader_service/handlers/git/server.py to grader_service/services/git.py

  • GitRepoBasePath
  • GitRepoSubmissionExtendedPath
  • GitRepoUserExtendedPath

TODO Move gitlookup and related functions from .../git/server.py to .../services/git.py

  • rewrite caller get_gitdir

TODO create table in git service to handle permissions

Should contain ID and PATH

TODO codify filesystem operations

This should lead towards a class or function that handles all filesystem management for git

Describe alternatives you've considered

We've thought about doing throwing out all existing functionality and rewriting git service as a microservice.

@adammccartney adammccartney changed the title Refactoring git service (or making one to begin with!) refactoring/git_service Apr 26, 2023
@adammccartney adammccartney added the backlog Will be adressed in the future label Sep 1, 2023
@adammccartney adammccartney added this to the Backlog milestone Sep 1, 2023
@meffmadd meffmadd removed this from the Backlog milestone Mar 13, 2024
@meffmadd meffmadd closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Will be adressed in the future
Projects
None yet
Development

No branches or pull requests

2 participants