Skip to content

Commit

Permalink
feat(sessions): add recommended images to info endpoint (reanahub#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alputer committed May 27, 2024
1 parent 3f716f7 commit 0d2fcee
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,13 @@
"title": "Default workspace",
"value": "/usr/share"
},
"interactive_session_recommended_jupyter_images": {
"title": "Recommended jupyter images for interactive sessions",
"value": [
"docker.io/jupyter/scipy-notebook:notebook-6.4.5",
"docker.io/jupyter/scipy-notebook:notebook-9.4.5"
]
},
"kubernetes_max_memory_limit": {
"title": "Maximum allowed memory limit for Kubernetes jobs",
"value": "10Gi"
Expand Down Expand Up @@ -516,6 +523,20 @@
},
"type": "object"
},
"interactive_session_recommended_jupyter_images": {
"properties": {
"title": {
"type": "string"
},
"value": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"kubernetes_max_memory_limit": {
"properties": {
"title": {
Expand Down
5 changes: 5 additions & 0 deletions reana_server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ def _get_rate_limit(env_variable: str, default: str) -> str:
)
"""Maximum allowed period (in days) for interactive session inactivity before automatic closure."""

REANA_INTERACTIVE_SESSIONS_ENVIRONMENTS = json.loads(
os.getenv("REANA_INTERACTIVE_SESSIONS_ENVIRONMENTS", "{}")
)
"""Allowed and recommended environments to be used for interactive sessions."""

# Kubernetes jobs timeout
# ==================
REANA_KUBERNETES_JOBS_TIMEOUT_LIMIT = os.getenv("REANA_KUBERNETES_JOBS_TIMEOUT_LIMIT")
Expand Down
22 changes: 22 additions & 0 deletions reana_server/rest/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
REANA_KUBERNETES_JOBS_TIMEOUT_LIMIT,
REANA_KUBERNETES_JOBS_MAX_USER_TIMEOUT_LIMIT,
REANA_INTERACTIVE_SESSION_MAX_INACTIVITY_PERIOD,
REANA_INTERACTIVE_SESSIONS_ENVIRONMENTS,
)
from reana_server.decorators import signin_required

Expand Down Expand Up @@ -125,6 +126,15 @@ def info(user, **kwargs): # noqa
type: string
type: array
type: object
interactive_session_recommended_jupyter_images:
type: array
items:
type: object
properties:
image:
type: string
name:
type: string
type: object
examples:
application/json:
Expand Down Expand Up @@ -165,6 +175,13 @@ def info(user, **kwargs): # noqa
"title": "Maximum timeout for Kubernetes jobs",
"value": "1209600"
},
"interactive_session_recommended_jupyter_images": {
"title": "Recommended jupyter images for interactive sessions",
"value": [
{'image': 'docker.io/jupyter/scipy-notebook:notebook-6.4.5', 'name': 'Jupyter SciPy Notebook 6.4.5'},
{'image': 'docker.io/jupyter/scipy-notebook:notebook-9.4.5', 'name': 'Jupyter SciPy Notebook 9.4.5'}
]
},
}
500:
description: >-
Expand Down Expand Up @@ -217,6 +234,10 @@ def info(user, **kwargs): # noqa
title="Maximum inactivity period in days before automatic closure of interactive sessions",
value=REANA_INTERACTIVE_SESSION_MAX_INACTIVITY_PERIOD,
),
interactive_session_recommended_jupyter_images=dict(
title="Recommended jupyter images for interactive sessions",
value=REANA_INTERACTIVE_SESSIONS_ENVIRONMENTS["jupyter"]["recommended"],
),
)
return InfoSchema().dump(cluster_information)

Expand Down Expand Up @@ -260,3 +281,4 @@ class InfoSchema(Schema):
maximum_interactive_session_inactivity_period = fields.Nested(
StringNullableInfoValue
)
interactive_session_recommended_jupyter_images = fields.Nested(StringInfoValue)

0 comments on commit 0d2fcee

Please sign in to comment.