Restrict k8s max job name length to 63 and shorten prefix

This commit is contained in:
Nuwan Goonasekera
2020-10-14 00:39:35 +05:30
parent 05aa4c28d6
commit 2409326812
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -211,7 +211,7 @@ class KubernetesJobRunner(AsynchronousJobRunner):
def __produce_unique_k8s_job_name(self, galaxy_internal_job_id):
# wrapper.get_id_tag() instead of job_id for compatibility with TaskWrappers.
instance_id = self._galaxy_instance_id or ''
return produce_unique_k8s_job_name(app_prefix='galaxy', instance_id=instance_id, job_id=galaxy_internal_job_id)
return produce_unique_k8s_job_name(app_prefix='gxy', instance_id=instance_id, job_id=galaxy_internal_job_id)
def __get_k8s_job_spec(self, ajs):
"""Creates the k8s Job spec. For a Job spec, the only requirement is to have a .spec.template.
+1 -1
View File
@@ -57,7 +57,7 @@ def produce_unique_k8s_job_name(app_prefix=None, instance_id=None, job_id=None):
if instance_id and len(instance_id) > 0:
job_name += "%s-" % instance_id
return "{}{}-{}".format(job_name, job_id, uuid.uuid4())
return "{}{}-{}".format(job_name, job_id, uuid.uuid4())[-63:]
def pull_policy(params):