Skip to content

Commit

Permalink
make request timeout configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Panaetius committed Jun 21, 2022
1 parent 7a3c84e commit 42bd578
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
12 changes: 12 additions & 0 deletions helm-chart/renku-core/templates/configmap.yaml
Expand Up @@ -7,6 +7,8 @@ data:
{{- range $version := .Values.versions }}
upstream {{ $version.name }} {
server {{ include "renku-core.fullname" $ }}-{{ $version.name }};
keepalive 32;
keepalive_timeout {{ $.Values.requestTimeout }};s
}
{{ end }}
Expand All @@ -30,12 +32,22 @@ data:
rewrite /renku/{{ $version.prefix }}/(.*) /renku/$1 break;
proxy_set_header Host $host;
proxy_pass http://{{ $version.name }};
proxy_connect_timeout {{ $.Values.requestTimeout }}s;
proxy_send_timeout {{ $.Values.requestTimeout }}s;
proxy_read_timeout {{ $.Values.requestTimeout }}s;
proxy_http_version 1.1;
proxy_set_header "Connection" "";
}
{{- end }}
location /renku {
proxy_set_header Host $host;
proxy_pass http://{{ .Values.versions.latest.name }};
proxy_connect_timeout {{ $.Values.requestTimeout }}s;
proxy_send_timeout {{ $.Values.requestTimeout }}s;
proxy_read_timeout {{ $.Values.requestTimeout }}s;
proxy_http_version 1.1;
proxy_set_header "Connection" "";
}
}
version.json: |
Expand Down
2 changes: 2 additions & 0 deletions helm-chart/renku-core/templates/deployment.yaml
Expand Up @@ -106,6 +106,8 @@ spec:
value: {{ $.Values.templateCloneDepth | quote }}
- name: MAX_CONTENT_LENGTH
value: {{ $.Values.maximumUploadSizeBytes | quote }}
- name: REQUEST_TIMEOUT
value: {{ $.Values.requestTimeout | quote }}
- name: CORE_SERVICE_PREFIX
value: /renku
- name: CORE_SERVICE_API_BASE_PATH
Expand Down
4 changes: 4 additions & 0 deletions helm-chart/renku-core/values.schema.json
Expand Up @@ -32,6 +32,10 @@
"minimum": 1,
"pattern": "^\\d+"
},
"requestTimeout": {
"description": "Time before requests time out.",
"type": "integer"
},
"datasetsWorkerQueues": {
"description": "Name of the worker queue for dataset jobs",
"type": "string"
Expand Down
1 change: 1 addition & 0 deletions helm-chart/renku-core/values.yaml
Expand Up @@ -40,6 +40,7 @@ cleanupInterval: 60 # NOTE: This needs to be a divisor of, and less than cleanu
projectCloneDepth: 1
templateCloneDepth: 1
maximumUploadSizeBytes: "1073741824" # 1 Gigabyte, store as string to keep Helm from converting it to scientific notation
requestTimeout: 600

datasetsWorkerQueues: datasets.jobs,delayed.ctrl.DatasetsCreateCtrl,delayed.ctrl.DatasetsAddFileCtrl,delayed.ctrl.DatasetsRemoveCtrl,delayed.ctrl.DatasetsImportCtrl,delayed.ctrl.DatasetsEditCtrl,delayed.ctrl.DatasetsUnlinkCtrl
managementWorkerQueues: cache.cleanup.files,cache.cleanup.projects,delayed.ctrl.MigrateProjectCtrl,delayed.ctrl.SetConfigCtrl
Expand Down
4 changes: 3 additions & 1 deletion renku/ui/cli/service.py
Expand Up @@ -44,6 +44,8 @@ def run_api(addr="0.0.0.0", port=8080, timeout=600):
svc_num_workers = os.getenv("RENKU_SVC_NUM_WORKERS", "1")
svc_num_threads = os.getenv("RENKU_SVC_NUM_THREADS", "2")

svc_timeout = int(os.getenv("REQUEST_TIMEOUT", timeout))

loading_opt = "--preload"

sys.argv = [
Expand All @@ -53,7 +55,7 @@ def run_api(addr="0.0.0.0", port=8080, timeout=600):
"-b",
f"{addr}:{port}",
"--timeout",
f"{timeout}",
f"{svc_timeout}",
"--workers",
svc_num_workers,
"--worker-class",
Expand Down

0 comments on commit 42bd578

Please sign in to comment.