mirror of
https://github.com/clearml/clearml-agent
synced 2025-06-26 18:16:15 +00:00
Fix conform queue name to k8s standard
This commit is contained in:
parent
0b36cb0f85
commit
9a3f950ac6
@ -3,6 +3,7 @@ from __future__ import print_function, division, unicode_literals
|
|||||||
import base64
|
import base64
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
@ -238,6 +239,10 @@ class K8sIntegration(Worker):
|
|||||||
except Exception:
|
except Exception:
|
||||||
queue_name = 'k8s'
|
queue_name = 'k8s'
|
||||||
|
|
||||||
|
# conform queue name to k8s standards
|
||||||
|
safe_queue_name = queue_name.lower().strip()
|
||||||
|
safe_queue_name = re.sub(r'\W+', '', safe_queue_name).replace('_', '').replace('-', '')
|
||||||
|
|
||||||
# Search for a free pod number
|
# Search for a free pod number
|
||||||
pod_number = 1
|
pod_number = 1
|
||||||
while self.ports_mode:
|
while self.ports_mode:
|
||||||
@ -278,13 +283,13 @@ class K8sIntegration(Worker):
|
|||||||
output, error = self._kubectl_apply(
|
output, error = self._kubectl_apply(
|
||||||
create_trains_conf=create_trains_conf,
|
create_trains_conf=create_trains_conf,
|
||||||
labels=labels, docker_image=docker_image, docker_args=docker_args,
|
labels=labels, docker_image=docker_image, docker_args=docker_args,
|
||||||
task_id=task_id, queue=queue, queue_name=queue_name)
|
task_id=task_id, queue=queue, queue_name=safe_queue_name)
|
||||||
else:
|
else:
|
||||||
output, error = self._kubectl_run(
|
output, error = self._kubectl_run(
|
||||||
create_trains_conf=create_trains_conf,
|
create_trains_conf=create_trains_conf,
|
||||||
labels=labels, docker_image=docker_image,
|
labels=labels, docker_image=docker_image,
|
||||||
task_data=task_data,
|
task_data=task_data,
|
||||||
task_id=task_id, queue=queue, queue_name=queue_name)
|
task_id=task_id, queue=queue, queue_name=safe_queue_name)
|
||||||
|
|
||||||
error = '' if not error else (error if isinstance(error, str) else error.decode('utf-8'))
|
error = '' if not error else (error if isinstance(error, str) else error.decode('utf-8'))
|
||||||
output = '' if not output else (output if isinstance(output, str) else output.decode('utf-8'))
|
output = '' if not output else (output if isinstance(output, str) else output.decode('utf-8'))
|
||||||
|
Loading…
Reference in New Issue
Block a user