Skip to content

Commit

Permalink
feat(sessions): update info endpoint to include recommended images (r…
Browse files Browse the repository at this point in the history
  • Loading branch information
Alputer committed May 23, 2024
1 parent 3f716f7 commit 6b15300
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
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
26 changes: 25 additions & 1 deletion 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:
properties:
title:
type: string
value:
items:
type: string
type: array
type: object
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": [
"docker.io/jupyter/scipy-notebook:notebook-6.4.5",
"docker.io/jupyter/scipy-notebook:notebook-9.4.5"
]
},
}
500:
description: >-
Expand Down Expand Up @@ -216,7 +233,11 @@ def info(user, **kwargs): # noqa
maximum_interactive_session_inactivity_period=dict(
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,6 @@ class InfoSchema(Schema):
maximum_interactive_session_inactivity_period = fields.Nested(
StringNullableInfoValue
)
interactive_session_recommended_jupyter_images = fields.Nested(StringInfoValue)


0 comments on commit 6b15300

Please sign in to comment.