Skip to content

Commit

Permalink
262 refactor assignment customisation options (#263)
Browse files Browse the repository at this point in the history
* refactor: added configurationable values for grading poll intervals and max grading time

* Bump chart to 0.6.3

* Bump service to 0.6.3

* fix: updated rabbitmq timeout to increase max grading time

* Bump chart to 0.6.4

* ci: removed management ci actions

* feat: updated lti process by changing rest method and including new sync options

* chore: make function get_latest and get_best_submissions reusable for both student and instructor version

#250

* fix: updated oauth_login endpoints

* refactor: changed kube autograde pod name to enhance user experience

Refs: #253

* feat: added new customisation options to kube_grader and deprecated old ones.

KubeGrader has now multiple new options to customise autograding pods (labels, tolerations, image pull secrets). Furthermore, autograding pods can be dynamically adapted before startup using the `post_auth_hook` traitlet.

Refs: #259

* refactor: added new kube customisation options to chart and deprecated old settings

* WIP: updated assignment model and setup running build with some default replacements

* feat: added new configuration option 'allowed_files' which contains glob patterns used to whitelist additional submission files

* feat: added assignment settings functionality to kube grader

---------

Co-authored-by: Marijana Petojevic <[email protected]>
  • Loading branch information
florian-jaeger and mpetojevic authored Jan 29, 2025
1 parent ea4847a commit 8b32abc
Show file tree
Hide file tree
Showing 49 changed files with 1,201 additions and 1,280 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/management_issue_assign.yml

This file was deleted.

37 changes: 0 additions & 37 deletions .github/workflows/management_issue_closure.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/management_issue_creation.yml

This file was deleted.

4 changes: 2 additions & 2 deletions charts/grader-service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.6.2
version: 0.6.4

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.6.2"
appVersion: "0.6.3"
2 changes: 1 addition & 1 deletion charts/grader-service/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
github_url = "https://github.com/TU-Wien-dataLAB/grader-service"

[tool.tbump.version]
current = "0.6.2"
current = "0.6.4"

# Example of a semver regexp.
# Make sure this matches current_version before
Expand Down
62 changes: 30 additions & 32 deletions charts/grader-service/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,42 @@ metadata:
{{- include "grader-service.labels" . | nindent 4 }}
data:
grader_service_config.py: |
{{ .Values.extraConfig | indent 4 }}
# Grader Service Config
### Log Level
c.GraderService.log_level = "{{ .Values.logLevel }}"
{{ if eq .Values.autogradeExecutorClass "KubeAutogradeExecutor" }}
### Autograde Executor
{{- if eq .Values.autogradeExecutorClass "KubeAutogradeExecutor" }}
from grader_service.autograding.kube.kube_grader import KubeAutogradeExecutor
c.RequestHandlerConfig.autograde_executor_class = KubeAutogradeExecutor
{{ else }}
from grader_service.autograding.local_grader import LocalAutogradeExecutor
c.RequestHandlerConfig.autograde_executor_class = LocalAutogradeExecutor
{{ end }}


{{- if .Values.requestHandlerConfig }}
{{- if .Values.requestHandlerConfig.git_max_file_mb }}
c.RequestHandlerConfig.git_max_file_size_mb = {{ .Values.requestHandlerConfig.git_max_file_mb }}
{{- end }}
{{- end }}

c.KubeAutogradeExecutor.kube_context = None

{{- if .Values.kubeAutogradeExecutor.namespace }}
{{- if .Values.kubeAutogradeExecutor.namespace }}
c.KubeAutogradeExecutor.namespace = {{ .Values.kubeAutogradeExecutor.namespace | quote }}
{{- end }}
{{- if .Values.kubeAutogradeExecutor.resolveImageName }}
c.KubeAutogradeExecutor.resolve_image_name = {{ .Values.kubeAutogradeExecutor.resolveImageName }}
{{- else }}

c.KubeAutogradeExecutor.resolve_image_name = lambda l, a: "{{ .Values.kubeAutogradeExecutor.image }}:{{ .Values.kubeAutogradeExecutor.tag | default .Chart.AppVersion }}"
{{- end }}
{{- end }}
c.KubeAutogradeExecutor.volume = {"name": "data", {{- if .Values.hostpath -}}"hostPath": {"path": "{{ .Values.hostpath }}", "type": "DirectoryOrCreate"} {{- else -}} "persistentVolumeClaim": {"claimName": "{{ include "grader-service.fullname" . }}"}{{- end -}} }
c.KubeAutogradeExecutor.extra_volumes = {{ .Values.kubeAutogradeExecutor.extraVolumes | default "[]" }}
c.KubeAutogradeExecutor.extra_volume_mounts = {{ .Values.kubeAutogradeExecutor.extraVolumeMounts | default "[]" }}
c.KubeAutogradeExecutor.labels = {{- .Values.kubeAutogradeExecutor.labels | toJson -}}
c.KubeAutogradeExecutor.image_pull_secrets = {{ .Values.kubeAutogradeExecutor.imagePullSecrets | toJson }}
{{- else }}
from grader_service.autograding.local_grader import LocalAutogradeExecutor
c.RequestHandlerConfig.autograde_executor_class = LocalAutogradeExecutor
{{- end }}

{{- if .Values.requestHandlerConfig }}
{{- if .Values.requestHandlerConfig.git_max_file_mb }}
c.RequestHandlerConfig.git_max_file_size_mb = {{ .Values.requestHandlerConfig.git_max_file_mb }}
{{- end }}
{{- end }}

### Database
c.GraderService.db_url = "{{ .Values.db.url }}"
c.GraderService.max_buffer_size = {{ .Values.requestHandlerConfig.max_buffer_size | int }}
c.GraderService.max_body_size = {{ .Values.requestHandlerConfig.max_body_size | int }}

### RabbitMQ
import os
broker_url=f'amqp://{os.getenv("RABBITMQ_GRADER_SERVICE_USERNAME")}:{os.getenv("RABBITMQ_GRADER_SERVICE_PASSWORD")}@rabbitmq-grader-service.{{.Release.Namespace}}.svc.cluster.local'

c.CeleryApp.conf = dict(
broker_url=broker_url,
result_backend='rpc://',
Expand All @@ -54,20 +51,21 @@ data:
accept_content=['json'],
broker_connection_retry_on_startup=True,
)
{{- if .Values.ltiSyncGrades.enabled }}
{{- if .Values.ltiSyncGrades.enabled }}
### LTI Grade Sync Plugin
c.LTISyncGrades.enabled = True
{{- if .Values.ltiSyncGrades.sync_on_feedback }}
{{- if .Values.ltiSyncGrades.sync_on_feedback }}
c.LTISyncGrades.sync_on_feedback = True
{{- end }}
{{- end }}
c.LTISyncGrades.token_url = {{ .Values.ltiSyncGrades.token_url | quote }}
c.LTISyncGrades.client_id = {{ .Values.ltiSyncGrades.client_id | quote }}
c.LTISyncGrades.token_private_key = {{ .Values.ltiSyncGrades.token_private_key | quote }}
c.LTISyncGrades.resolve_lti_urls = {{ .Values.ltiSyncGrades.resolve_lti_urls }}
c.LTISyncGrades.username_match = {{ .Values.ltiSyncGrades.username_match | quote }}
{{- end }}

c.GraderService.log_level = "{{ .Values.logLevel }}"
{{- end }}

{{- if .Values.extraConfig }}
### Extra Config
{{ .Values.extraConfig | indent 4 }}
{{- end }}
.gitconfig: |
[user]
name = {{ .Values.gitConfig.gitUser }}
Expand Down
4 changes: 3 additions & 1 deletion charts/grader-service/templates/rabbitmq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ spec:
replicas: 1
resources:
{{- toYaml .Values.rabbitmq.resources | nindent 4 }}

rabbitmq:
additionalConfig: |
consumer_timeout = 31622400000
10 changes: 6 additions & 4 deletions charts/grader-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,20 @@ volumePermissions:

autogradeExecutorClass: KubeAutogradeExecutor
kubeAutogradeExecutor:
annotations: {}
image: ghcr.io/tu-wien-datalab/grader-service-labextension
tag: latest
imagePullPolicy: "Always"
imagePullSecrets: {}
labels: {}
namespace: null
extraVolumes: ""
extraVolumeMounts: ""
resolveImageName: null

extraConfig: ""

requestHandlerConfig:
git_max_file_size_mb: 500
max_buffer_size: 104857600
max_body_size: 104857600

Expand All @@ -74,10 +79,7 @@ ltiSyncGrades:
sync_on_feedback: false
client_id: ""
token_url: ""
username_convert: null
username_match: "user_id"
token_private_key: ""
resolve_lti_urls: "None"

logLevel: "INFO"

Expand Down
48 changes: 0 additions & 48 deletions docs/databaseschema.txt

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/_static/openapi/grader_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ info:
description: The REST API for the grader service
license:
name: BSD-3-Clause
version: '0.6.2'
version: '0.6.3'
servers:
- url: /api
description: relative path to mock
Expand Down
2 changes: 1 addition & 1 deletion docs/source/_static/openapi/paths_shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ assignments:
type: integer
format: int64
requestBody:
description: The initial state of an assignment. Every field can be empty except `due_date` and `name`.
description: The initial state of an assignment. Every field can be empty except `name` and `settings`.
required: true
content:
application/json:
Expand Down
Loading

0 comments on commit 8b32abc

Please sign in to comment.