Skip to content

Commit

Permalink
Merge pull request #50 from elixir-cloud-aai/restartPolicy-limits-wor…
Browse files Browse the repository at this point in the history
…karound

Fix: restartPolicy and limits
  • Loading branch information
trispera authored Aug 29, 2024
2 parents d1fc869 + 35d7551 commit f3ac7c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

INSTALL_DEPS = ['kubernetes==9.0.0',
'requests>=2.20.0',
'urllib3==1.26.18',
'urllib3==1.26.19',
'boto3==1.16.18',
]
TEST_DEPS = [ 'pytest',
Expand Down
12 changes: 12 additions & 0 deletions src/tesk_core/taskmaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ def run_executor(executor, namespace, pvc=None):
if os.environ.get('EXECUTOR_BACKOFF_LIMIT') is not None:
executor['spec'].update({'backoffLimit': int(os.environ['EXECUTOR_BACKOFF_LIMIT'])})

if 'restartPolicy' not in spec.keys() and \
'restart_policy' in spec.keys():
spec['restartPolicy'] = spec['restart_policy']

for container in spec['containers']:
if 'limits' not in container['resources'].keys():
container['resources']['limits'] = None
if container['resources']['limits'] is None and \
('requests' in container['resources'].keys() and \
container['resources']['requests'] is not None):
container['resources']['limits'] = container['resources']['requests']

if pvc is not None:
mounts = spec['containers'][0].setdefault('volumeMounts', [])
mounts.extend(pvc.volume_mounts)
Expand Down

0 comments on commit f3ac7c2

Please sign in to comment.