Skip to content

Commit

Permalink
fix: indented job creation to allow multiple model deployment in a co…
Browse files Browse the repository at this point in the history
…nfiguration.
  • Loading branch information
antoniochavesgarcia committed Sep 18, 2024
1 parent e1f3c30 commit b77b5a0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backend/automl/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,13 +941,13 @@ def post(self, request, format=None):
}
}

if gpu_mem_to_allocate > 0:
job_manifest['spec']['template']['spec']['containers'][0]['resources'] = {'limits': {'nvidia.com/gpu': gpu_mem_to_allocate}}
job_manifest['spec']['template']['spec']['containers'][0]['env'].append({'name': 'NVIDIA_VISIBLE_DEVICES', 'value': "all"})
job_manifest['spec']['template']['spec']['runtimeClassName'] = 'nvidia'
if gpu_mem_to_allocate > 0:
job_manifest['spec']['template']['spec']['containers'][0]['resources'] = {'limits': {'nvidia.com/gpu': gpu_mem_to_allocate}}
job_manifest['spec']['template']['spec']['containers'][0]['env'].append({'name': 'NVIDIA_VISIBLE_DEVICES', 'value': "all"})
job_manifest['spec']['template']['spec']['runtimeClassName'] = 'nvidia'

resp = api_instance.create_namespaced_job(body=job_manifest, namespace=settings.KUBE_NAMESPACE)
logging.info("Job created. status='%s'" % str(resp.status))
resp = api_instance.create_namespaced_job(body=job_manifest, namespace=settings.KUBE_NAMESPACE)
logging.info("Job created. status='%s'" % str(resp.status))

return HttpResponse(status=status.HTTP_201_CREATED)
except ValueError as ve:
Expand Down

0 comments on commit b77b5a0

Please sign in to comment.