mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-30 18:13:23 +08:00
Rework k8s resource request parameters.
xref https://github.com/galaxyproject/galaxy/pull/4751#issuecomment-341196780
This commit is contained in:
@@ -248,14 +248,14 @@
|
||||
a requirement of the other.
|
||||
|
||||
-->
|
||||
<!-- <param id="k8s_default_requests_cpu">"500m"</param> -->
|
||||
<!-- <param id="k8s_default_requests_memory">"500Mi"</param> -->
|
||||
<!-- <param id="k8s_default_limits_cpu">"2"</param> -->
|
||||
<!-- <param id="k8s_default_limits_memory">"2Gi"</param> -->
|
||||
<!-- <param id="requests_cpu">500m</param> -->
|
||||
<!-- <param id="requests_memory">500Mi</param> -->
|
||||
<!-- <param id="limits_cpu">2</param> -->
|
||||
<!-- <param id="limits_memory">2Gi</param> -->
|
||||
<!-- Kubernetes resource Requests and Limits
|
||||
Parameters above (k8s_default_requests_* and k8s_default_limits_*) set default minimal (requests) and
|
||||
maximal (limits) CPU and memory resources to be allocated to all containers in Kubernetes jobs by
|
||||
default.
|
||||
Parameters above (requests_* and limits_*) set default minimal (requests) and
|
||||
maximal (limits) CPU and memory resources to be allocated to all containers in
|
||||
Kubernetes jobs by default.
|
||||
|
||||
Limits and requests for CPU resources are measured in cpu units. Fractional requests are allowed. A
|
||||
Container with requests_cpu of 0.5 is guaranteed half as much CPU as one that asks for 1 CPU. The
|
||||
@@ -271,14 +271,6 @@
|
||||
|
||||
For more details on the Kubernetes resources management, see:
|
||||
https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
|
||||
|
||||
It is the responsability of the tool developer or administrator to override these limits, either at the
|
||||
destination or the tool itself. If not set, current defaults set on the code are:
|
||||
|
||||
requests_cpu = "500m"
|
||||
limits_cpu = "1"
|
||||
requests_memory = "500Mi"
|
||||
limits_memory = "1Gi"
|
||||
-->
|
||||
|
||||
</plugin>
|
||||
|
||||
@@ -275,7 +275,7 @@ class KubernetesJobRunner(AsynchronousJobRunner):
|
||||
|
||||
if 'requests_memory' in job_destinantion.params:
|
||||
return self.__transform_memory_value(job_destinantion.params['requests_memory'])
|
||||
return self.runner_params['k8s_default_requests_memory']
|
||||
return None
|
||||
|
||||
def __get_memory_limit(self, job_wrapper):
|
||||
"""Obtains memory limits for job, checking if available on the destination, otherwise using the default"""
|
||||
@@ -283,7 +283,7 @@ class KubernetesJobRunner(AsynchronousJobRunner):
|
||||
|
||||
if 'limits_memory' in job_destinantion.params:
|
||||
return self.__transform_memory_value(job_destinantion.params['limits_memory'])
|
||||
return self.runner_params['k8s_default_limits_memory']
|
||||
return None
|
||||
|
||||
def __get_cpu_request(self, job_wrapper):
|
||||
"""Obtains cpu requests for job, checking if available on the destination, otherwise using the default"""
|
||||
@@ -291,7 +291,7 @@ class KubernetesJobRunner(AsynchronousJobRunner):
|
||||
|
||||
if 'requests_cpu' in job_destinantion.params:
|
||||
return self.__transform_cpu_value(job_destinantion.params['requests_cpu'])
|
||||
return self.runner_params['k8s_default_requests_cpu']
|
||||
return None
|
||||
|
||||
def __get_cpu_limit(self, job_wrapper):
|
||||
"""Obtains cpu requests for job, checking if available on the destination, otherwise using the default"""
|
||||
@@ -299,7 +299,7 @@ class KubernetesJobRunner(AsynchronousJobRunner):
|
||||
|
||||
if 'limits_cpu' in job_destinantion.params:
|
||||
return self.__transform_cpu_value(job_destinantion.params['limits_cpu'])
|
||||
return self.runner_params['k8s_default_limits_cpu']
|
||||
return None
|
||||
|
||||
def __transform_cpu_value(self, cpu_value):
|
||||
"""Transforms cpu value
|
||||
|
||||
Reference in New Issue
Block a user