8000 feat(openapi): add K8s resource requests and limits in reana.yaml by Alputer · Pull Request #486 · reanahub/reana-commons · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(openapi): add K8s resource requests and limits in reana.yaml #486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2025

Conversation

Alputer
Copy link
Member
@Alputer Alputer commented Mar 28, 2025

Allow users to set CPU and memory requests/limits via reana.yaml. If not specified, default values configured by cluster admins will be applied.

Closes reanahub/reana#883

@Alputer Alputer requested a review from tiborsimko March 28, 2025 16:42
@Alputer Alputer self-assigned this Mar 28, 2025
Alputer added a commit to Alputer/reana-commons that referenced this pull request Apr 1, 2025
…nahub#486)

Allow users to set CPU and memory requests/limits via `reana.yaml`.
If not specified, default values configured by cluster admins will be
applied.

Closes reanahub/reana#883
Copy link
codecov bot commented Apr 1, 2025

Codecov Report

Attention: Patch coverage is 52.63158% with 9 lines in your changes missing coverage. Please review.

Project coverage is 41.62%. Comparing base (2caa2e2) to head (e56e6f7).
Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
reana_commons/errors.py 0.00% 6 Missing ⚠️
reana_commons/config.py 0.00% 2 Missing ⚠️
reana_commons/job_utils.py 90.90% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #486      +/-   ##
==========================================
- Coverage   41.79%   41.62%   -0.17%     
==========================================
  Files          28       28              
  Lines        2010     2042      +32     
==========================================
+ Hits          840      850      +10     
- Misses       1170     1192      +22     
Files with missing lines Coverage Δ
reana_commons/job_utils.py 93.75% <90.90%> (-1.71%) ⬇️
reana_commons/config.py 0.00% <0.00%> (ø)
reana_commons/errors.py 7.50% <0.00%> (-1.33%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Alputer added a commit to Alputer/reana-commons that referenced this pull request Apr 1, 2025
…nahub#486)

Allow users to set CPU and memory requests/limits via `reana.yaml`.
If not specified, default values configured by cluster admins will be
applied.

Closes reanahub/reana#883
Alputer added a commit to Alputer/reana-commons that referenced this pull request Apr 1, 2025
…nahub#486)

Allow users to set CPU and memory requests/limits via `reana.yaml`.
If not specified, default values configured by cluster admins will be
applied.

Closes reanahub/reana#883
Alputer added a commit to Alputer/reana-commons that referenced this pull request Apr 2, 2025
…nahub#486)

Allow users to set CPU and memory requests/limits via `reana.yaml`.
If not specified, default values configured by cluster admins will be
applied.

Closes reanahub/reana#883
Alputer added a commit to Alputer/reana-commons that referenced this pull request Apr 3, 2025
…nahub#486)

Allow users to set CPU and memory requests/limits via `reana.yaml`.
If not specified, default values configured by cluster admins will be
applied.

Closes reanahub/reana#883
"value": "2"
},
"kubernetes_cpu_request": {
"title": "Default cpu request for Kubernetes jobs",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the title, please use CPU is uppercase, here and elsewhere.

"kubernetes_max_memory_limit": {
"title": "Maximum allowed memory limit for Kubernetes jobs",
"value": "10Gi"
"value": "10Gi\""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove extra backquote.

"kubernetes_cpu_request": {
"type": "string",
"title": "Kubernetes cpu request",
"description": "Kubernetes cpu request (e.g. 1 - read more about the expected memory values on the official Kubernetes documentation: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put CPU in uppercase, here and in lower lines.

],
)
def test_kubernetes_cpu_to_millicores(k8s_cpu, millicores):
"""Test conversion of k8s CPU format to millicores."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cosmetics; In textual documentation, the usual abbreviation is "K8s" i.e. uppercase K.

@@ -420,6 +420,9 @@ def default_workspace():
)
"""Kubernetes valid memory format regular expression e.g. Ki, M, Gi, G, etc."""

KUBERNETES_CPU_FORMAT = r"^(?P<value_millicpu>[1-9]\d*)m$|^(?P<value_cpu>(0*[1-9]\d*(\.\d+)?|0*\.\d*[1-9]\d*))$"
"""Kubernetes valid CPU format regex. Supports formats like 500m, 1, 0.1. Values must be greater than 0."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cosmetics: please put the example values in ascending order, so... "0.1" (or "100m"), "0.9" (or "900m"). This would also gently hint that 0.1=100m and that the two value systems are just two ways how to express the same thing.

Example: Valid K8s CPU core limit format, such as "0.1" (or "100m"), "0.9" (or "900m").

@@ -99,6 +99,9 @@ def submit( # noqa: C901
compute_backend=None,
kerberos=False,
kubernetes_uid=None,
kubernetes_cpu_request=None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a minor patchlevel release, and since somebody may be using Python API to submit workflows, perhaps we should add the new optional arguments at the end? Ideally, they would be close together, but let's check how RECAST uses the API to make sure that we don't break their submission workflow by rearranging argument order.

(The safest option would be just to add them at the end, even though it's not pretty...)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, just checked recast-atlas sources: https://github.com/recast-hep/recast-atlas/blob/main/src/recastatlas/backends/reana.py

We should be good WRT parameter order, since the RECAST client does not seem to be using submit() from the REANA client API.

Alputer added a commit to Alputer/reana-commons that referenced this pull request Apr 4, 2025
…nahub#486)

Allow users to set CPU and memory requests/limits via `reana.yaml`.
If not specified, default values configured by cluster admins will be
applied.

Closes reanahub/reana#883
@Alputer Alputer force-pushed the job-cpu-limits branch 2 times, most recently from 6834cb2 to a9a0031 Compare April 4, 2025 08:20
@tiborsimko tiborsimko changed the base branch from master to maint-0.9 April 4, 2025 08:28
…anahub#486)

Allow users to set CPU and memory requests/limits via `reana.yaml`.
If not specified, default values configured by cluster admins will be
applied.

Closes reanahub/reana#883
@Alputer Alputer changed the title feat(helm): introduce resource requests and limits in reana.yaml feat(openapi): add K8s resource requests and limits in reana.yaml Apr 4, 2025
8000
Copy link
Member
@tiborsimko tiborsimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely 👍

@tiborsimko tiborsimko merged commit 53457cb into reanahub:maint-0.9 Apr 4, 2025
16 checks passed
Alputer added a commit to Alputer/reana-commons that referenced this pull request Apr 4, 2025
…anahub#486)

Allow users to set CPU and memory requests/limits via `reana.yaml`.
If not specified, default values configured by cluster admins will be
applied.

Closes reanahub/reana#883
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Would be nice to have job CPU limits in reana.yaml file
2 participants
0