Skip to content

Commit

Permalink
feat(sessions): add recommended images to info endpoint (reanahub#688)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alputer committed Nov 1, 2024
1 parent 15d0b97 commit 035c99d
Show file tree
Hide file tree
Showing 3 changed files with 53 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 @@ -457,6 +457,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 @@ -587,6 +594,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 @@ -420,6 +420,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
27 changes: 27 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,
DASK_ENABLED,
REANA_DASK_CLUSTER_DEFAULT_NUMBER_OF_WORKERS,
REANA_DASK_CLUSTER_MAX_MEMORY_LIMIT,
Expand Down Expand Up @@ -106,6 +107,15 @@ def info(user, **kwargs): # noqa
type: string
x-nullable: true
type: object
interactive_session_recommended_jupyter_images:
properties:
title:
type: string
value:
type: array
items:
type: string
type: object
maximum_kubernetes_jobs_timeout:
properties:
title:
Expand Down Expand Up @@ -205,6 +215,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": [
'docker.io/jupyter/scipy-notebook:notebook-6.4.5',
'docker.io/jupyter/scipy-notebook:notebook-9.4.5',
]
},
"dask_enabled": {
"title": "Dask workflows allowed in the cluster",
"value": "False"
Expand Down Expand Up @@ -277,6 +294,15 @@ 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=[
item["image"]
for item in REANA_INTERACTIVE_SESSIONS_ENVIRONMENTS["jupyter"][
"recommended"
]
],
),
dask_enabled=dict(
title="Dask workflows allowed in the cluster",
value=bool(DASK_ENABLED),
Expand Down Expand Up @@ -343,6 +369,7 @@ class InfoSchema(Schema):
StringNullableInfoValue
)
kubernetes_max_memory_limit = fields.Nested(StringInfoValue)
interactive_session_recommended_jupyter_images = fields.Nested(ListStringInfoValue)
dask_enabled = fields.Nested(StringInfoValue)
if DASK_ENABLED:
dask_cluster_default_number_of_workers = fields.Nested(StringInfoValue)
Expand Down

0 comments on commit 035c99d

Please sign in to comment.