Skip to content

Commit

Permalink
feat(sessions): add recommended images to info endpoint (#688)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alputer committed Aug 8, 2024
1 parent 703af19 commit 36e254e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The list of contributors in alphabetical order:

- [Adelina Lintuluoto](https://orcid.org/0000-0002-0726-1452)
- [Alp Tuna](https://orcid.org/0009-0001-1915-3993)
- [Anton Khodak](https://orcid.org/0000-0003-3263-4553)
- [Audrius Mecionis](https://orcid.org/0000-0002-3759-1663)
- [Bruno Rosendo](https://orcid.org/0000-0002-0923-3148)
Expand Down
21 changes: 21 additions & 0 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,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 @@ -512,6 +519,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
7 changes: 6 additions & 1 deletion reana_server/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2017, 2018, 2019, 2020, 2021, 2022, 2023 CERN.
# Copyright (C) 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down Expand Up @@ -397,6 +397,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
24 changes: 23 additions & 1 deletion reana_server/rest/info.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2021, 2022 CERN.
# Copyright (C) 2021, 2022, 2024 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -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 36e254e

Please sign in to comment.