Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
17ea5a64
Commit
17ea5a64
authored
Feb 01, 2019
by
Markus Scheidgen
Browse files
Added basic liveness/readiness for api+worker
parent
d4d11fc6
Changes
4
Hide whitespace changes
Inline
Side-by-side
nomad/api/app.py
View file @
17ea5a64
...
...
@@ -82,6 +82,12 @@ def handle(error: Exception):
return
response
@
app
.
route
(
"%s/alive"
%
base_path
)
def
alive
():
""" Simply endpoint to utilize kubernetes liveness/readiness probing. """
return
"I am, alive!"
def
with_logger
(
func
):
"""
Decorator for endpoint implementations that provides a pre configured logger and
...
...
ops/helm/nomad/templates/api-deployment.yaml
View file @
17ea5a64
...
...
@@ -71,6 +71,18 @@ spec:
-
name
:
NOMAD_COE_REPO_DB_NAME
value
:
"
{{
.Values.dbname
}}"
command
:
[
"
python"
,
"
-m"
,
"
gunicorn.app.wsgiapp"
,
"
-b
0.0.0.0:8000"
,
"
nomad.api:app"
]
livenessProbe
:
httpGet
:
path
:
"
{{ .Values.proxy.external.path
}}/alive"
port
:
8000
initialDelaySeconds
:
15
periodSeconds
:
15
readinessProbe
:
httpGet
:
path
:
"
{{ .Values.proxy.external.path
}}/alive"
port
:
8000
initialDelaySeconds
:
5
periodSeconds
:
5
imagePullSecrets
:
-
name
:
{{
.Values.images.secret
}}
imagePullPolicy
:
always
...
...
ops/helm/nomad/templates/worker-deployment.yaml
View file @
17ea5a64
...
...
@@ -59,6 +59,26 @@ spec:
-
name
:
NOMAD_COE_REPO_DB_NAME
value
:
"
{{
.Values.dbname
}}"
command
:
[
"
python"
,
"
-m"
,
"
celery"
,
"
worker"
,
"
-l"
,
"
info"
,
"
-A"
,
"
nomad.processing"
]
livenessProbe
:
exec
:
env
:
-
name
:
NOMAD_LOGSTASH_LEVEL
-
value
:
30
command
:
-
sh -c
-
celery -A nomad.processing status
initialDelaySeconds
:
30
periodSeconds
:
30
readinessProbe
:
exec
:
env
:
-
name
:
NOMAD_LOGSTASH_LEVEL
-
value
:
30
command
:
-
sh -c
-
celery -A nomad.processing status
initialDelaySeconds
:
5
periodSeconds
:
5
imagePullSecrets
:
-
name
:
{{
.Values.images.secret
}}
imagePullPolicy
:
always
...
...
tests/test_api.py
View file @
17ea5a64
...
...
@@ -56,6 +56,11 @@ def client(mockmongo):
Upload
.
_get_collection
().
drop
()
def
test_alive
(
client
):
rv
=
client
.
get
(
'/alive'
)
assert
rv
.
status_code
==
200
def
create_auth_headers
(
user
):
basic_auth_str
=
'%s:password'
%
user
.
email
basic_auth_bytes
=
basic_auth_str
.
encode
(
'utf-8'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment