Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions contentcuration/contentcuration/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ def gettext(s):
"result_serializer": "json",
"result_extended": True,
"worker_send_task_events": True,
# Graceful shutdown: allow 28 seconds for tasks to complete before forced termination
# This is 2 seconds less than Kubernetes terminationGracePeriodSeconds (30s)
"worker_soft_shutdown_timeout": int(
os.getenv("CELERY_WORKER_SOFT_SHUTDOWN_TIMEOUT") or "28"
),
}

# When cleaning up orphan nodes, only clean up any that have been last modified
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ x-studio-environment:
CELERY_BROKER_ENDPOINT: redis
CELERY_RESULT_BACKEND_ENDPOINT: redis
CELERY_REDIS_PASSWORD: ""
REMAP_SIGTERM: "SIGQUIT"
CELERY_WORKER_SOFT_SHUTDOWN_TIMEOUT: "28"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're already defaulting to 28, this adds no value.

PROBER_STUDIO_BASE_URL: http://studio-app:8080/{path}

x-studio-worker:
Expand Down
4 changes: 4 additions & 0 deletions k8s/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ Generate the shared environment variables between studio app and workers
secretKeyRef:
key: redis-password
name: {{ template "studio.fullname" . }}
- name: REMAP_SIGTERM
value: "SIGQUIT"
- name: CELERY_WORKER_SOFT_SHUTDOWN_TIMEOUT
value: "28"
- name: AWS_S3_ENDPOINT_URL
value: https://storage.googleapis.com
- name: RELEASE_COMMIT_SHA
Expand Down
1 change: 1 addition & 0 deletions k8s/templates/studio-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ spec:
app: {{ template "studio.fullname" . }}-workers
tier: workers
spec:
terminationGracePeriodSeconds: 30
containers:
- name: worker
image: {{ .Values.studioApp.imageName }}
Expand Down