Skip to content

Commit

Permalink
Remove hard-coded CPU and memory request
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Mar 31, 2022
1 parent 9212798 commit 962a98d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pman/kubernetesmgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ def create_job(self, image, command, name, resources_dict, mountdir=None) -> V1J
memory_limit = str(resources_dict.get('memory_limit')) + 'Mi'
gpu_limit = resources_dict.get('gpu_limit')

# configure pod's containers
requests = {'memory': '150Mi', 'cpu': '250m'}
# About requests and limits:
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
#
# > Note: If a container specifies its own memory limit, but does not specify a memory
# > request, Kubernetes automatically assigns a memory request that matches the limit.

limits = {'memory': memory_limit, 'cpu': cpu_limit}
env = []
if gpu_limit > 0:
Expand All @@ -139,7 +143,7 @@ def create_job(self, image, command, name, resources_dict, mountdir=None) -> V1J
env=env,
command=command,
security_context=k_client.V1SecurityContext(**security_context),
resources=k_client.V1ResourceRequirements(limits=limits, requests=requests),
resources=k_client.V1ResourceRequirements(limits=limits),
volume_mounts=[k_client.V1VolumeMount(mount_path='/share',
name='storebase')]
)
Expand Down

0 comments on commit 962a98d

Please sign in to comment.